getdata
Current WDS data
Description
specifies additional options using one or more name-value pair arguments. For
example, d
= getdata(c
,s
,f
,Name,Value
)'TradeDate',datetime('today')
returns market data for
the current day.
Examples
Retrieve Current WDS Data for Security
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)
Retrieve Daily Current WDS Data
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
c
— WDS connection
connection object
WDS connection, specified as a connection object created with the wind
function.
s
— Securities
character vector | string scalar | cell array of character vectors | string array
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
f
— Fields
character vector | string scalar | cell array of character vectors | string array
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.
TradeDate
— Trade date
datetime
scalar | numeric scalar | character vector | string scalar
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
PriceAdj
— Price adjustment
'N'
| 'F'
| 'B'
| 'T'
Price adjustment, specified as the comma-separated pair consisting of
'PriceAdj'
and one of these values.
Value | Description |
---|---|
| No |
| Forward |
| Backward |
| As per selected ex-rights time |
For details about these values, contact Wind Information Co., Ltd.
Cycle
— Cycle
'D'
| 'W'
| 'M'
| ...
Cycle, specified as the comma-separated pair consisting of
'Cycle'
and one of these values.
Value | Description |
---|---|
| Daily |
| Weekly |
| Monthly |
| Quarterly |
| Semi-annually |
| Annually |
For details about these values, contact Wind Information Co., Ltd.
Output Arguments
e
— WDS error identifier
numeric scalar
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
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
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.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)