d = createorder(c,s,direction,price,quantity)
returns order information after sending an order to the Wind Data Feed Services (WDS) order management system using the WDS connection. Specify the
security, trade side, order price, and quantity of shares for the order.
d = createorder(c,s,direction,price,quantity,Name,Value)
specifies additional options using one or more name-value pair arguments. For
example, 'TradePassword',"abcdefghi" specifies the password for
the WDS order management system.
[d,e] = createorder(___)
also returns the WDS error identifier using any of the input argument combinations
in the previous syntaxes. For troubleshooting, contact Wind Information Co.,
Ltd.
Create a buy order of 100 shares of the 600000.SH
security using the WDS connection. Buy shares with the order price
12.0, specified in the CNY currency.
s = '600000.SH';
direction = 'buy';
price = '12.0';
quantity = '100';
d = createorder(c,s,direction,price,quantity)
Query for the order status of the executed order and display the status.
The order status 'Normal' indicates a successful order
execution.
d = query(c,'Order');
d.OrderStatus
d =
'Normal'
This result assumes that the WDS order management system contains only one
valid order execution.
Log out from the WDS order management system using the login identifier
returned by the tradelogin function.
logonid = dlogin.LogonID;
d = tradelogout(c,logonid);
Close the WDS connection.
close(c)
Create Order for Security Using Credentials
Using a WDS connection, log in to the order management system
and create a buy order of a single security. Use name-value pair arguments to
specify the login identifier and password.
Create a WDS connection.
c = wind;
Log in to the WDS order management system using the WDS connection.
Specify the broker, branch, user name, password, and account type.
Create a buy order of 100 shares of the 600000.SH
security using the WDS connection. Buy shares with the order price
12.0, specified in the CNY currency. Use the
'LogonID' and 'TradePassword'
name-value pair arguments to specify the login identifier and
password.
s = '600000.SH';
direction = 'buy';
price = '12.0';
quantity = '100';
logonid = '1';
password = "abcdefghi";
d = createorder(c,s,direction,price,quantity, ...'LogonID',logonid,'TradePassword',password)
WDS connection, specified as a connection object created with the wind function.
s — Security character vector | string scalar
Security, specified as a character vector or string scalar.
Example: '0001.HK'
Data Types: char | string
direction — Trade side 'Buy' | 'Short' | 'Cover' | ...
Trade side of the order, specified as one of these values:
'Buy'
'BuyCollateral'
'Cover'
'CoverCovered'
'CoverToday'
'Merge'
'Redemption'
'Sell'
'SellCollateral'
'SellToday'
'Short'
'ShortCovered'
'Split'
'Subscription'
The values for the direction input argument depend on
the instrument type.
Instrument Type
Values
Stocks
'Buy' or 'Sell' —
Buy or sell stocks
Futures and options
'Buy' — Buy long
'Sell' — Sell long
'Short' — Buy short
'Cover' — Sell short
SHF futures only
'Buy' — Buy long
'Sell' — Sell long position
yesterday or before
'SellToday' — Sell long
position today
'Short' — Buy short
'Cover' — Sell short
position yesterday or before
'CoverToday' — Sell short
position today
SHO options only
'Buy' — Buy long
'Sell' — Sell long
'Short' — Buy short
'ShortCovered' — Buy short
with frozen underlying stock (not frozen
margin)
'Cover' — Sell short
'CoverCovered' — Sell short
covered
Short margin
'Buy' — Margin
purchase
'Sell' — Repayment
'Short' — Short sale
'Cover' — Return
stock
'BuyCollateral' — Buy
collateral
'SellCollateral' — Sell
collateral
Funds and split-capital funds
'Buy' — Buy fund in floor
trading
'Sell' — Sell fund in floor
trading
'Subscription' — Buy fund
in OTC
'Redemption' — Sell fund in
OTC
Split-capital funds only
'Merge' — SCT merge to Fund
of Funds
'Split' — Fund of Funds
split to SCT
price — Order price character vector | string scalar
Order price, specified as a character vector or string scalar. Specify the
price of the order in the CNY currency.
Example: '12.0'
Data Types: char | string
quantity — Order quantity character vector | string scalar
Order quantity, specified as a character vector or string scalar. Specify
the number of shares for the order transaction.
Example: '100'
Data Types: char | string
Name-Value Pair Arguments
Specify optional
comma-separated pairs of Name,Value arguments. Name is
the argument name and Value is the corresponding value.
Name must appear inside quotes. You can specify several name and value
pair arguments in any order as
Name1,Value1,...,NameN,ValueN.
Example: d =
createorder(c,'600000.SH','buy','12.0','100','OrderType','LMT')
returns order information after sending a limit order of the
600000.SH security to the WDS order management system. This
order buys 100 shares of the security with an order price of 12, specified in CNY
currency.
'OrderType' — Order type 'LMT' | 'B5TC' | 'B5TL'
Order type, specified as the comma-separated pair consisting of
'OrderType' and one of these
values.
Value
Description
'LMT'
Limit
'BOC'
Best of counterparty
'BOP'
Best of party
'ITC'
Immediately then cancel
'B5TC'
Best 5 then cancel
'FOK'
Fill or kill
'B5TL'
Best 5 then limit
For details about these values, contact Wind Information Co.,
Ltd.
'HedgeType' — Hedge type 'SPEC' | 'HEDG'
Hedge type, specified as the comma-separated pair consisting of
'HedgeType' and 'SPEC' for
speculation or 'HEDG' for hedging (when trading
futures).
For details about these values, contact Wind Information Co.,
Ltd.
'LogonID' — Login identifier character vector | string scalar
Login identifier, specified as the comma-separated pair consisting of
'LogonID' and a character vector or string scalar. Set the value
of the 'LogonID' name-value pair argument by using the
LogonID variable in the d output argument of
the tradelogin function.
Example: '1'
Data Types: char | string
'TradePassword' — Account password character vector | string scalar
Account password, specified as the comma-separated pair consisting of 'TradePassword' and a character vector or string scalar. For credentials, contact Wind Information Co., Ltd.
Example: "abcdefghi"
Data Types: char | string
'FundsType' — Fund type 'ETF'
Fund type, specified as the comma-separated pair consisting of
'FundsType' and 'ETF'.
For details about this value, contact Wind Information Co.,
Ltd.
'PortfolioNo' — Portfolio number character vector | string scalar
Portfolio number, specified as the comma-separated pair consisting of
'PortfolioNo' and a character vector or string
scalar.
Order information, returned as a table. The variables in the table depend
on the specified order.
For details about the variables in the table, contact Wind Information
Co., Ltd.
e — WDS error identifier numeric scalar
WDS error identifier, returned as a numeric scalar. The value 0 indicates a
successful execution of the createorder function. Otherwise, for
details about the error, contact Wind Information Co., Ltd.
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.