Main Content

getdata

Current WDS data

Description

d = getdata(c,s,f) returns the current Wind Data Feed Services (WDS) market data for the specified securities and fields using the WDS connection.

example

d = getdata(c,s,f,Name,Value) specifies additional options using one or more name-value pair arguments. For example, 'TradeDate',datetime('today') returns market data for the current day.

example

[d,e] = getdata(___) 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, retrieve current data for a single security and display the data. Then close the connection.

Create a WDS connection.

c = wind;

Format output data for currency.

format bank

Using the 0001.HK security, retrieve the current high and low prices.

s = '0001.HK';
f = ["high","low"];
d = getdata(c,s,f)
d=1×2 table
               HIGH      LOW 
               _____    _____

    0001.HK    99.50    98.00

d is a table with one row for the single security. Each variable in the table corresponds to each specified field.

Close the WDS connection.

close(c)

Using a WDS connection, retrieve current data for a single security for the day and display the data.

Create a WDS connection.

c = wind;

Format output data for currency.

format bank

For the 0001.HK security, retrieve the high and low prices for the day using the WDS connection. Use the name-value pair argument 'Cycle' to specify the period.

s = {'0001.HK'};
f = ["high","low"];
d = getdata(c,s,f,'Cycle','D')
d=1×2 table
               HIGH      LOW 
               _____    _____

    0001.HK    99.50    98.00

d is a table with a row for the security. The variables in the table correspond to the specified fields.

Close the WDS connection.

close(c)

Input Arguments

collapse all

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

Securities, specified as a character vector, string scalar, cell array of character vectors, or string array. For a single security, use a character vector or string scalar. For multiple securities, use a cell array of character vectors or string array.

Example: '0001.HK'

Data Types: char | string | cell

Fields, specified as a character vector, string scalar, cell array of character vectors, or string array. For a single field, use a character vector or string scalar. For multiple fields, use a cell array of character vectors or string array.

For details about valid fields, contact Wind Information Co., Ltd.

Example: {"high","low"}

Data Types: char | string | cell

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: getdata(c,s,f,'TradeDate',datetime('yesterday')) retrieves current WDS market data for yesterday.

Trade date, specified as the comma-separated pair consisting of 'TradeDate' and a datetime scalar, numeric scalar, character vector, or string scalar.

If you do not specify a date, the getdata function sets the trade date to the current day.

Example: 731878

Example: datetime('yesterday')

Data Types: datetime | double | char | string

Price adjustment, specified as the comma-separated pair consisting of 'PriceAdj' and one of these values.

ValueDescription

'N'

No

'F'

Forward

'B'

Backward

'T'

As per selected ex-rights time

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

Cycle, specified as the comma-separated pair consisting of 'Cycle' and one of these values.

ValueDescription

'D'

Daily

'W'

Weekly

'M'

Monthly

'Q'

Quarterly

'S'

Semi-annually

'Y'

Annually

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

Output Arguments

collapse all

Current WDS market data, returned as a table. The rows in the table correspond to the securities specified in the s input argument. The variables in the table correspond to the fields specified in the f input argument.

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

Version History

Introduced in R2018a