Documentation Center

  • Trial Software
  • Product Updates

history

Bloomberg V3 historical data

Syntax

  • [d,sec] = history(c,s,f,fromdate,todate) example
  • [...] = history(...,period) example
  • [...] = history(...,currency) example
  • [...] = history(...,Name,Value) example

Description

example

[d,sec] = history(c,s,f,fromdate,todate) returns the historical data for the security list s and the connection object c for the fields f for the dates FromDate through ToDate. Date strings can be input in any format recognized by MATLAB®. sec is the security list that maps the order of the return data. The return data, d and sec, are sorted to match the input order of s.

example

[...] = history(...,period) returns the historical data for the fields f and the dates fromdate through todate with a specific periodicity period.

example

[...] = history(...,currency) returns the historical data for the security list s for the fields f and the dates fromdate through todate based on the given currency currency.

example

[...] = history(...,Name,Value) returns the historical data for the security list s using Name,Value pair arguments for additional Bloomberg® request settings.

Examples

expand all

Retrieve the Daily Closing Price for a Date Range

Create the Bloomberg connection.

c = blp;

Get the daily closing price from August 1, 2010 through August 10, 2010 for the IBM® security.

[d,sec] = history(c,'IBM US Equity','LAST_PRICE',...
                  '8/01/2010','8/10/2010')
d =

     734352.00        123.55
     734353.00        123.18
     734354.00        124.03
     734355.00        124.56
     734356.00        123.58
     734359.00        125.34
     734360.00        125.19


sec = 

    'IBM US Equity'

d contains the numeric representation for the date in the first column and the closing price in the second column. sec contains the name of the IBM security.

Close the Bloomberg connection.

close(c);

Retrieve the Monthly Closing Price for a Date Range

Create the Bloomberg connection.

c = blp;

Get the monthly closing price from August 1, 2010 through December 10, 2010 for the IBM security.

[d,sec] = history(c,'IBM US Equity','LAST_PRICE',...
                  '8/01/2010','12/10/2010','monthly')
d =

     734360.00        125.19
     734391.00        121.53
     734421.00        131.85
     734452.00        139.78
     734482.00        138.13


sec = 

    'IBM US Equity'

d contains the numeric representation for the date in the first column and the closing price in the second column. sec contains the name of the IBM security.

Close the Bloomberg connection.

close(c);

Retrieve the Monthly Closing Price for a Date Range Using U.S. Currency

Create the Bloomberg connection.

c = blp;

Get the monthly closing price from August 1, 2010 through December 10, 2010 for the IBM security in U.S. currency USD.

[d,sec] = history(c,'IBM US Equity','LAST_PRICE',...
                  '8/01/2010','12/10/2010','monthly','USD')
d =

     734360.00        125.19
     734391.00        121.53
     734421.00        131.85
     734452.00        139.78
     734482.00        138.13


sec = 

    'IBM US Equity'

d contains the numeric representation for the date in the first column and the closing price in the second column. sec contains the name of the IBM security.

Close the Bloomberg connection.

close(c);

Retrieve the Monthly Closing Price for a Date Range Using U.S. Currency with a Specified Period

Create the Bloomberg connection.

c = blp;

Get the monthly closing price from August 1, 2010 through August 10, 2010 for the IBM security in U.S. currency USD. The period values daily, actual, and all_calendar_days specify returning actual daily data for all calendar days. The period value nil_value specifies filling missing data values with a NaN.

[d,sec] = history(c,'IBM US Equity','LAST_PRICE',...
                  '8/01/2010','8/10/2010',{'daily','actual',...
                  'all_calendar_days','nil_value'},'USD')
d =

     734351.00           NaN
     734352.00        123.55
     734353.00        123.18
     734354.00        124.03
     734355.00        124.56
     734356.00        123.58
     734357.00           NaN
     734358.00           NaN
     734359.00        125.34
     734360.00        125.19


sec = 

    'IBM US Equity'

d contains the numeric representation for the date in the first column and the closing price in the second column. sec contains the name of the IBM security.

Close the Bloomberg connection.

close(c);

Retrieve the Weekly Closing Price for a Date Range Using U.S. Currency

Create the Bloomberg connection.

c = blp;

Get the monthly closing price from November 1, 2010 through December 23, 2010 for the IBM security in U.S. currency USD. Note that the anchor date depends on the date December 23, 2010 in this case. Because this date is a Thursday, each previous value is reported for the Thursday of the week in question.

[d,sec] = history(c,'IBM US Equity','LAST_PRICE',...
                 '11/01/2010','12/23/2010',{'weekly'},'USD')
d =

     734446.00        139.39
     734453.00        138.71
     734460.00        137.69
     734467.00        139.07
     734474.00        138.47
     734481.00        137.63
     734488.00        137.87
     734495.00        139.15


sec = 

    'IBM US Equity'

d contains the numeric representation for the date in the first column and the closing price in the second column. sec contains the name of the IBM security.

Close the Bloomberg connection.

close(c);

Retrieve the Closing Price for a Date Range Using U.S. Currency with the Default Period

Create the Bloomberg connection.

c = blp;

Get the closing price from August 1, 2010 through September 10, 2010 for the IBM security in U.S. currency USD with the default period of the data set using []. The default period of a security depends on the security itself.

[d,sec] = history(c,'IBM US Equity','LAST_PRICE',...
                  '8/01/2010','9/10/2010',[],'USD')
d =

     734352.00        123.55
     734353.00        123.18
     734354.00        124.03
     ...

sec = 

    'IBM US Equity'

d contains the numeric representation for the date in the first column and the closing price in the second column. sec contains the name of the IBM security.

Close the Bloomberg connection.

close(c);

Retrieve the Daily Closing Price for a Date Range Using U.S. Currency with Name-Value Pairs

Create the Bloomberg connection.

c = blp;

Get the daily closing price from August 1, 2010 through August 10, 2010 for the IBM security in U.S. currency USD. The prices are adjusted for normal cash and splits.

[d,sec] = history(c,'IBM US Equity','LAST_PRICE',...
                  '8/01/2010','8/10/2010','daily','USD',...
                  'adjustmentNormal',true,...
                  'adjustmentSplit',true)
d =

     734352.00        123.55
     734353.00        123.18
     734354.00        124.03
     734355.00        124.56
     734356.00        123.58
     734359.00        125.34
     734360.00        125.19


sec = 

    'IBM US Equity'

d contains the numeric representation for the date in the first column and the closing price in the second column. sec contains the name of the IBM security.

Close the Bloomberg connection.

close(c);

Retrieve the Daily Closing Price Using a CUSIP Number with a Pricing Source

Create the Bloomberg connection.

c = blp;

Get the daily closing price from January 1, 2012 through January 1, 2013 for the security specified with a CUSIP number /cusip/459200101 and with pricing source BGN.

d = history(c,'/cusip/459200101@BGN','LAST_PRICE',...
            '01/01/2012','01/01/2013')
d =

     734871.00        180.69
     734872.00        179.96
     734873.00        179.10
     ...

d contains the numeric representation for the date in the first column and the closing price in the second column.

Close the Bloomberg connection.

close(c);

Retrieve the Closing Price for a Date Range Using an International Date Format

Create the Bloomberg connection.

c = blp;

Return the closing price for the given dates in international format for the security MSFT@BGN US Equity.

stDt = datenum('01/06/11','dd/mm/yyyy'); 
endDt = datenum('01/06/12','dd/mm/yyyy'); 
[d,sec] = history(c,'MSFT@BGN US Equity','LAST_PRICE',...
                  stDt,endDt,{'previous_value','all_calendar_days'})
d =

     734655.00         22.92
     734656.00         22.72
     734657.00         22.42
     ...

sec = 

    'MSFT@BGN US Equity'

d contains the numeric representation for the date in the first column and the closing price in the second column. sec contains the name of the IBM security.

Close the Bloomberg connection.

close(c);

Retrieve the Median Estimated Earnings Per Share Using an Override Value

Create the Bloomberg connection.

c = blp;

Retrieve the median estimated earnings per share for AkzoNobel® from October 1, 2010 through October 30, 2010. When specifying Bloomberg override fields, use the string 'overrideFields'. The overrideFields argument must be an n-by-2 cell array, where the first column is the override field and the second column is the override value.

d = history(c,'AKZA NA Equity', ...
            'BEST_EPS_MEDIAN',datenum('01.10.2010', ...
            'dd.mm.yyyy'),datenum('30.10.2010','dd.mm.yyyy'), ...
            {'daily','calendar'},[],'overrideFields', ...
            {'BEST_FPERIOD_OVERRIDE','BF'},'CapChg',true)
d =

     734412.00          3.75
     734415.00          3.75
     734416.00          3.75
     ...

d returns the numeric representation for the date in the first column and the median estimated earnings per share in the second column.

Close the Bloomberg connection.

close(c);

Input Arguments

expand all

c — Bloomberg connectionconnection object

Bloomberg connection, specified as a connection object created using blp.

s — Security liststring | cell array

Security list, specified as a string for one security or a cell array for multiple securities. You can specify the security by name or by CUSIP, and with or without the pricing source.

Data Types: char | cell

f — Bloomberg data fieldsstring | cell array of strings

Bloomberg data fields, specified as a Bloomberg specific string for one data field or a cell array of Bloomberg specific strings for multiple data fields. For details about the strings you can specify, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Example: {'LAST_PRICE';'OPEN'}

Data Types: char | cell

period — Periodicitydaily | weekly | monthly | quarterly | semi_annually | ...

Periodicity, specified as a cell array of enumerated strings to denote the period of the data to return. For example, when period is set to {'daily','calendar'}, the history function returns daily data for all calendar days reporting missing data as NaNs. When period is set to{'actual'}, the history function returns the data using the default periodicity and default calendar reporting missing data as NaNs. The default periodicity depends on the security. If a security is reported on a monthly basis, the default periodicity is monthly. The default calendar is actual trading days. The possible values of period are as follows.

ValueTime Period
dailyDaily
weeklyWeekly
monthlyMonthly
quarterlyQuarterly
semi_annuallySemiannually
yearlyYearly
actualAnchor date specification
calendarAnchor date specification
fiscalAnchor date specification
non_trading_weekdaysNon-trading weekdays
all_calendar_daysReturn all calendar days
active_days_onlyActive trading days only
previous_valueFill missing values with previous values
nil_valueFill missing values with a NaN

Data Types: char | cell

currency — Currencystring

Currency, specified as a string to denote the ISO code for the currency of the returned data. For example, to specify output money values in U.S. currency, use USD for this argument.

Data Types: char

fromdate — Beginning datescalar | vector | matrix | string | cell array

Beginning date for the historical data, specified as a double scalar, double vector, double matrix, string, or cell array of strings. You can specify dates in any of the formats supported by datestr and datenum that show a year, month, and day.

Data Types: double | char | cell

todate — End datescalar | vector | matrix | string | cell array

End date for the historical data, specified as a double scalar, double vector, double matrix, string, or cell array of strings. You can specify dates in any of the formats supported by datestr and datenum that show a year, month, and day.

Data Types: double | char | cell

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 single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'adjustmentNormal',true

'adjustmentNormal' — Historical normal pricing adjustmenttrue | false

Historical normal pricing adjustment, specified as a Boolean to reflect: Regular Cash, Interim, 1st Interim, 2nd Interim, 3rd Interim, 4th Interim, 5th Interim, Income, Estimated, Partnership Distribution, Final, Interest on Capital, Distribution, and Prorated. For details about these additional name-value pairs, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Data Types: logical

'adjustmentAbnormal' — Historical abnormal pricing adjustmenttrue | false

Historical abnormal pricing adjustment, specified as a Boolean to reflect: Special Cash, Liquidation, Capital Gains, Long-Term Capital Gains, Short-Term Capital Gains, Memorial, Return of Capital, Rights Redemption, Miscellaneous, Return Premium, Preferred Rights Redemption, Proceeds/Rights, Proceeds/Shares, and Proceeds/Warrants. For details about these additional name-value pairs, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Data Types: logical

'adjustmentSplit' — Historical split pricing or volume adjustmenttrue | false

Historical split pricing or volume adjustment, specified as a Boolean to reflect: Spin-Offs, Stock Splits/Consolidations, Stock Dividend/Bonus, and Rights Offerings/Entitlement. For details about these additional name-value pairs, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Data Types: logical

'adjustmentFollowDPDF' — Historical pricing adjustmenttrue (default) | false

Historical pricing adjustment, specified as a Boolean. Setting this name-value pair follows the DPDF <GO> option from the Bloomberg terminal. For details about these additional name-value pairs, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

Data Types: logical

Output Arguments

expand all

d — Bloomberg return datamatrix

Bloomberg return data, returned as a matrix with the Bloomberg data. The first column of the matrix is the numeric representation of the date. The remaining columns contain the requested data fields. For details about the return data, see the Bloomberg API Developer's Guide using the WAPI <GO> option from the Bloomberg terminal.

sec — Security listcell array

Security list, returned as a cell array of strings for the corresponding securities in s. The contents of sec are identical in value and order to s. You can return securities with any of the following identifiers:

  • buid

  • cats

  • cins

  • common

  • cusip

  • isin

  • sedol1

  • sedol2

  • sicovam

  • svm

  • ticker (default)

  • wpk

More About

expand all

Anchor Date

The anchor date is the date to which all other reported dates are related. For blp.history, for periodicities other than daily, ToDate is the anchor date. For example, if you set the period to weekly and the ToDate is a Thursday, every reported data point would also be a Thursday, or the nearest prior business day to Thursday. Similarly, if you set the period to monthly and the ToDate is the 20th of a month, each reported data point would be for the 20th of each month in the date range.

See Also

| | |

Was this topic helpful?