query

Query WDS account and order information

Description

example

d = query(c,q) returns account, order, and portfolio information associated with a Wind Data Feed Services (WDS) account using the WDS connection and a query term.

example

d = query(c,q,Name,Value) specifies additional options using one or more name-value pair arguments. For example, 'LogonID','1' returns information filtered by the login identifier.

[d,e] = query(___) 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 WDS order management system and query for account information.

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)
d =

  1×5 table

    LogonID     LogonAccount      AccountType    ErrorCode    ErrorMsg
    _______    _______________    ___________    _________    ________

       1       '1234567891011'      'SZSHA'          0           ''   

d is a table with these variables:

  • Login identifier

  • Account number

  • Account type

  • Error code

  • Error message

If the error code is 0 and the message is an empty character vector, then the login is successful.

Query for account information using the WDS connection and the Account query term.

q = 'Account';
d = query(c,q)
d =

  4×10 table

    ShareholderStatus    MainShareholderFlag    AccountType    MarketType    Shareholder      AssetAccount        Customer         Seat       ErrorCode    ErrorMsg
    _________________    ___________________    ___________    __________    ____________    _______________    _____________    _________    _________    ________

           48                     0               'SZSHA'         'SH'       '0123456789'    '1234567891011'    '12345678910'    '0001000'        0           ''   
           48                     0               'SHB'           'SH'       '0123456789'    '1234567891011'    '12345678910'    '0001000'        0           ''   
           48                     0               'SZSHA'         'SZ'       '0123456789'    '1234567891011'    '12345678910'    '0001000'        0           ''   
           48                     0               'SZB'           'SZ'       '0123456789'    '1234567891011'    '12345678910'    '0001000'        0           ''   

d is a table with these variables:

  • Shareholder status

  • Shareholder flag

  • Account type

  • Market type

  • Shareholder

  • Account number

  • Customer number

  • Seat

  • 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)
d =

  1×3 table

    LogonID    ErrorCode    ErrorMsg
    _______    _________    ________

      '1'          0        'logout'

d is a table with these variables:

  • Login identifier

  • Error code

  • Error message

Close the WDS connection.

close(c)

Using a WDS connection, log in to the WDS order management system and query for account information by using the login identifier.

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";
d = tradelogin(c,broker,branch, ...
    capitalaccount,password,accttype)
d =

  1×5 table

    LogonID     LogonAccount      AccountType    ErrorCode    ErrorMsg
    _______    _______________    ___________    _________    ________

       1       '1234567891011'      'SZSHA'          0           ''   

d is a table with these variables:

  • Login identifier

  • Account number

  • Account type

  • Error code

  • Error message

If the error code is 0 and the message is an empty character vector, then the login is successful.

Query for account information using the WDS connection, Account query term, and login identifier. Use the login identifier returned by the tradelogin function with the 'LogonID' name-value pair argument.

q = 'Account';
logonid = d.LogonID;
d = query(c,q,'LogonID',logonid)
d =

  4×10 table

    ShareholderStatus    MainShareholderFlag    AccountType    MarketType    Shareholder      AssetAccount        Customer         Seat       ErrorCode    ErrorMsg
    _________________    ___________________    ___________    __________    ____________    _______________    _____________    _________    _________    ________

           48                     0               'SZSHA'         'SH'       '0123456789'    '1234567891011'    '12345678910'    '0001000'        0           ''   
           48                     0               'SHB'           'SH'       '0123456789'    '1234567891011'    '12345678910'    '0001000'        0           ''   
           48                     0               'SZSHA'         'SZ'       '0123456789'    '1234567891011'    '12345678910'    '0001000'        0           ''   
           48                     0               'SZB'           'SZ'       '0123456789'    '1234567891011'    '12345678910'    '0001000'        0           ''   

d is a table with these variables:

  • Shareholder status

  • Shareholder flag

  • Account type

  • Market type

  • Shareholder

  • Account number

  • Customer number

  • Seat

  • Error code

  • Error message

Log out from the WDS order management system using the login identifier.

d = tradelogout(c,logonid)
d =

  1×3 table

    LogonID    ErrorCode    ErrorMsg
    _______    _________    ________

      '1'          0        'logout'

d is a table with these variables:

  • Login identifier

  • Error code

  • Error message

Close the WDS connection.

close(c)

Input Arguments

collapse all

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

Query term, specified as one of these values.

Query Term ValueDescription

'Account'

WDS account information

'Capital'

Current account values

'CreditFund'

Credit status associated with the WDS account

'CreditPos'

Credit position

'Liabilities'

Debt status associated with the WDS account

'LogonID'

User name information

'Order'

Orders associated with the WDS account

'Portfolio'

Portfolio information from asset management system

'Position'

Portfolio positions associated with the WDS account

'ShortInfo'

Securities lending information

'Trade'

Trading information for the current day

You can specify these values using character vectors or string scalars.

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 = query(c,'Order','LogonID','1','OrderNumber','12') returns order information, filtered by the login identifier, for orders that have order number '12'.

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.

For example, d = query(c,'Order','LogonID','1') returns order information only for the orders associated with the login identifier '1'.

Example: '1'

Data Types: char | string

Request identifier, specified as the comma-separated pair consisting of 'RequestID' and a character vector or string scalar. Set the value of the 'RequestID' name-value pair argument by using the RequestID variable in the d output argument of the createorder function.

For example, d = query(c,'Order','RequestID','12') returns order information only for the orders associated with the request identifier '12'.

Example: "27"

Data Types: double

Order number, specified as the comma-separated pair consisting of 'OrderNumber' and a character vector or string scalar. To find the value, set the q input argument of the query function to 'Order'. Then, use the OrderNumber variable in the d output argument of the query function.

For example, d = query(c,'Order','OrderNumber','10') returns order information only for the orders associated with the order number '10'.

Example: "6"

Data Types: double

Order type, specified as the comma-separated pair consisting of 'OrderType' and the value 'All' for all orders or 'Withdrawable' for orders that can be withdrawn.

For example, d = query(c,'Order','OrderType','All') returns all order types.

Portfolio number, specified as the comma-separated pair consisting of 'PortfolioNo' and a character vector or string scalar.

For example, d = query(c,'Portfolio','PortfolioNo','3') returns portfolio information for the portfolio number '3'.

Example: '3'

Data Types: char | string

Output Arguments

collapse all

Account information about the account, order, and portfolio, returned as a table. The variables in the table depend on the specified query in the q input argument.

For details about these variables, contact Wind Information Co., Ltd.

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

Introduced in R2018a