history
Historical WDS data
Syntax
Description
Examples
Retrieve Historical WDS Data for Security
Using a WDS connection, retrieve historical data for a single security and display the data.
Create a WDS connection.
c = wind;
Format output data for currency.
format bank
Using the 0001.HK
security, retrieve the open, high, low, and closing prices from August 10, 2017 through August 15, 2017.
s = '0001.HK'; f = ["open","high","low","close"]; startdate = '2017-08-10'; enddate = '2017-08-15'; d = history(c,s,f,startdate,enddate)
d=4×4 timetable
Time OPEN HIGH LOW CLOSE
____________________ ______ ______ ______ ______
10-Aug-2017 00:00:00 104.50 105.00 103.30 103.30
11-Aug-2017 00:00:00 102.00 102.70 101.00 101.10
14-Aug-2017 00:00:00 102.10 102.20 101.30 102.00
15-Aug-2017 00:00:00 101.40 102.50 101.20 102.00
d
is a timetable that contains one row for each trading day with the time and a variable for each specified field.
Close the WDS connection.
close(c)
Retrieve Historical WDS Data in Specified Currency
Using a WDS connection, retrieve historical data for a single security and display the data. Specify the currency for the data.
Create a WDS connection.
c = wind;
Format output data for currency.
format bank
Using the 0001.HK
security, retrieve the open, high, low, and closing prices from August 10, 2017 through August 15, 2017. Specify the EUR
currency by using the 'Currency'
name-value pair argument.
s = '0001.HK'; f = ["open","high","low","close"]; startdate = '2017-08-10'; enddate = '2017-08-15'; currency = 'EUR'; d = history(c,s,f,startdate,enddate,'Currency',currency)
d=4×4 timetable
Time OPEN HIGH LOW CLOSE
____________________ _____ _____ _____ _____
10-Aug-2017 00:00:00 11.37 11.43 11.24 11.24
11-Aug-2017 00:00:00 11.10 11.18 10.99 11.00
14-Aug-2017 00:00:00 11.05 11.06 10.97 11.04
15-Aug-2017 00:00:00 11.01 11.13 10.99 11.07
d
is a timetable that contains one row for each trading day with the time and a variable for each specified field.
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
— Security
character vector | string scalar
Security, specified as a character vector or string scalar.
Example: '0001.HK'
Data Types: char
| string
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
startdate
— Start date
datetime
scalar | numeric scalar | character vector | string scalar
Start date of the historical date range, specified as a
datetime
scalar, numeric scalar, character vector, or
string scalar.
Example: 731878
Example: datetime('yesterday')
Data Types: datetime
| double
| char
| string
enddate
— End date
datetime
scalar | numeric scalar | character vector | string scalar
End date of the historical date range, specified as a
datetime
scalar, numeric scalar, character vector, or
string scalar.
Example: 731878
Example: datetime('today')
Data Types: datetime
| double
| 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: history(c,s,f,'Days','Weekdays','Currency','EUR')
returns historical WDS market data only for weekdays and in the Euro
currency.
Currency
— Currency
character vector | string scalar
Currency, specified as the comma-separated pair consisting of
'Currency'
and a character vector or string
scalar that contains three characters identifying the ISO® code for the currency. For example, specify
'USD'
for the US currency.
Data Types: char
| string
Days
— Days
'Alldays'
(default) | 'Weekdays'
Days, specified as the comma-separated pair consisting of
'Days'
and the value 'Alldays'
to return data for all days, or the value 'Weekdays'
to return data for weekdays only.
Fill
— Fill
'Null'
(default) | 'Previous'
Fill, specified as the comma-separated pair consisting of
'Fill'
and the value 'Null'
to
fill missing data with NULL
values, or the value
'Previous'
to fill missing data with previous
values.
Period
— Period
'D'
| 'W'
| 'M'
| ...
Period, specified as the comma-separated pair consisting of
'Period'
and one of these values.
Value | Description |
---|---|
| Daily |
| Weekly |
| Monthly |
| Quarterly |
| Annually |
For details about these values, contact Wind Information Co., Ltd.
PriceAdj
— Price adjustment
'F'
| 'B'
| 'T'
| ...
Price adjustment, specified as the comma-separated pair consisting of
'PriceAdj'
and one of these values.
Value | Description |
---|---|
| Forward |
| Backward |
| Fixed |
| Clean price |
| Dirty price |
| Market price |
| Yield |
For details about these values, contact Wind Information Co., Ltd.
TradingCalendar
— Exchange code
character vector | string scalar
Exchange code, specified as the comma-separated pair consisting of
'TradingCalendar'
and a character vector or
string scalar. For example, specify 'NYSE'
for the
New York Stock Exchange.
Data Types: char
| string
Output Arguments
d
— Historical WDS market data
timetable
e
— WDS error identifier
numeric scalar
WDS error identifier, returned as a numeric scalar. The value 0
indicates a
successful execution of the history
function. Otherwise, for
details about the error, contact Wind Information Co., Ltd.
Version History
Introduced in R2018a
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)