Main Content

history

Historical WDS data

Description

d = history(c,s,f,startdate,enddate) returns the historical Wind Data Feed Services (WDS) market data for the specified security and fields using the WDS connection. Specify a date range for the historical data to return.

example

d = history(c,s,f,startdate,enddate,Name,Value) specifies additional options using one or more name-value pair arguments. For example, 'Currency','EUR' returns data in the Euro currency.

example

[d,e] = history(___) 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 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)

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

collapse all

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

Security, specified as a character vector or string scalar.

Example: '0001.HK'

Data Types: char | string

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

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

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, 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, 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, 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, specified as the comma-separated pair consisting of 'Period' and one of these values.

ValueDescription

'D'

Daily

'W'

Weekly

'M'

Monthly

'Q'

Quarterly

'Y'

Annually

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

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

ValueDescription

'F'

Forward

'B'

Backward

'T'

Fixed

'CP'

Clean price

'DP'

Dirty price

'MP'

Market price

'YTM'

Yield

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

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

collapse all

Historical WDS market data, returned as a timetable. The rows in the timetable correspond to the dates in the date range, as specified by the startdate and enddate input arguments. The variables in the timetable correspond to the specified fields in the f input argument.

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