Main Content

deleteorder

Cancel WDS order

Description

example

d = deleteorder(c,orderno) cancels a Wind Data Feed Services (WDS) order using the WDS connection.

example

d = deleteorder(c,orderno,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] = deleteorder(___) also returns the WDS error identifier using any of the input argument combinations in the previous syntaxes. For troubleshooting, contact Wind Information Co., Ltd.

Examples

collapse all

Using a WDS connection, log in to the order management system, create a buy order for a single security, and delete the order.

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.

broker = "0000";
branch = "0";
capitalaccount = "1234567891011";
password = "abcdefghi";
accttype = "SHSZ";
dlogin = tradelogin(c,broker,branch, ...
    capitalaccount,password,accttype);

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 number of the executed order and display the number.

d = query(c,'Order');
orderno = d.OrderNumber
orderno =

  '12'

This result assumes that the WDS order management system contains only one valid order execution.

Delete the order using the WDS connection and the order number.

d = deleteorder(c,orderno)
d =

  1×3 table

    OrderNumber    ErrorCode      ErrorMsg   
    ___________    _________    _____________

       '12'            0        'Sending ...'

d is a table that contains these variables:

  • Order number

  • Error code

  • Error message

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)

Using a WDS connection, log in to the order management system, create a buy order of a single security, and delete the order by using the account 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.

broker = "0000";
branch = "0";
capitalaccount = "1234567891011";
password = "abcdefghi";
accttype = "SHSZ";
dlogin = tradelogin(c,broker,branch, ...
    capitalaccount,password,accttype);

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 number of the executed order and display the number.

d = query(c,'Order');
orderno = d.OrderNumber
orderno =

  '12'

This result assumes that the WDS order management system contains only one valid order execution.

Delete the order using the WDS connection and the order number. Specify the account password using the 'TradePassword' name-value pair argument.

d = deleteorder(c,orderno,'TradePassword',password)
d =

  1×3 table

    OrderNumber    ErrorCode      ErrorMsg   
    ___________    _________    _____________

       '12'            0        'Sending ...'

d is a table that contains these variables:

  • Order number

  • Error code

  • Error message

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)

Input Arguments

collapse all

WDS connection, specified as a connection object created with the wind function.

Order number, specified as a character vector or string scalar. To find the order number, use the query function with the query term 'Order'.

Example: '12'

Data Types: char | string

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: d = deleteorder(c,'12','LogonID','1','TradePassword',"abcdefghi") cancels the order, identified by the order number '12', in the WDS order management system using the login identifier '1' and the account password "abcdefghi".

Security market identifier, specified as one of these values.

ValueDescription

'SZ'

Shenzhen Stock Exchange

'SH'

Shanghai Stock Exchange

'OC'

National Equities Exchange and Quotations

'HK'

Hong Kong Stock Exchange

'CZC'

Zhengzhou Commodity Exchange

'SHF'

Shanghai Futures Exchange

'DCE'

Dalian Commodity Exchange

'CFE'

China Financial Futures Exchange

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

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

Order price, specified as a character vector or string scalar. Specify the order price in the CNY currency.

For HK only, use the 'OrderPrice' name-value pair argument to change the price of an existing order. If the 'OrderPrice' and 'OrderVolume' name-value pair arguments are not specified, then the Wind Financial Terminal cancels the order.

Example: '30'

Data Types: char | string

Order volume, specified as a character vector or string scalar.

For HK only, use the 'OrderVolume' name-value pair argument to change the volume of an existing order. If the 'OrderPrice' and 'OrderVolume' name-value pair arguments are not specified, then the Wind Financial Terminal cancels the order.

Example: '100'

Data Types: char | string

Output Arguments

collapse all

Deletion information, returned as a table with these variables:

  • Order number

  • Error code

  • Error message

WDS error identifier, returned as a numeric scalar. The value 0 indicates a successful execution of the deleteorder function. Otherwise, for details about the error, contact Wind Information Co., Ltd.

Version History

Introduced in R2018a