Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

history

Historical data for Bloomberg connection V3

Syntax

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

Description

example

d = 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 is sorted to match the input order of s.

example

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

example

d = history(c,s,f,fromdate,todate,period,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

d = history(c,s,f,fromdate,todate,period,currency,Name,Value) returns the historical data for the security list s using additional options specified by one or more Name,Value pair arguments.

example

[d,sec] = history(___) additionally returns the security list sec using any of the input arguments in the previous syntaxes. The return data, d and sec, are sorted to match the input order of s.

Examples

collapse all

Create the Bloomberg® connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE® using bpipe.

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)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

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)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

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)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

Get the monthly closing price from August 1, 2010 through August 1, 2011 for the IBM security in U.S. currency 'USD'. The period values 'monthly', 'actual', and 'all_calendar_days' specify returning actual monthly 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/01/2011',{'monthly','actual',...
                  'all_calendar_days','nil_value'},'USD')
d =

     734351.00        128.40
     734382.00        125.77
     734412.00        135.64
     734443.00        143.32
     734473.00        144.41
     734504.00        146.76
     734535.00        163.56
     734563.00        159.97
     734594.00        164.27
     734624.00        170.58
     734655.00        166.56
     734685.00        174.54
     734716.00        180.75


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)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

Get the weekly 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)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

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)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

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)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

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)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

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)

Create the Bloomberg connection.

c = blp;

Alternatively, you can connect to the Bloomberg Server API using blpsrv or Bloomberg B-PIPE using bpipe.

Retrieve the median estimated earnings per share for AkzoNobel® from October 1, 2010 through October 30, 2010. When specifying Bloomberg override fields, use the character vector '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'})
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)

Related Examples

Input Arguments

collapse all

Bloomberg connection, specified as a connection object created using blp, blpsrv, or bpipe.

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

Data Types: char | cell

Bloomberg data fields, specified as a character vector or a cell array of character vectors. A character vector denotes one Bloomberg data field name. A cell array of character vectors denotes multiple Bloomberg data field names. For details about the character vectors 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

Periodicity, specified as one of these values to denote the data to return. For specifying multiple values, use a cell array. For example, when period is set to {'daily','all_calendar_days'}, history returns daily data for all calendar days, and reports missing data as NaNs. When period is set to 'active_days_only', history returns data using the default periodicity for active trading days only. The default periodicity depends on the security. If a security is reported on a monthly basis, the default periodicity is monthly. These tables show the values for period.

To specify the periodicity of the return data, see this table.

ValueDescription
'daily'

Return data for each day.

'weekly'

Return data for each week.

'monthly'

Return data for each month.

'quarterly'

Return data for each quarter.

'semi_annually'

Return data semiannually.

'yearly'

Return data for each year.

The anchor date is the date to which all other reported dates are related. To specify the anchor date, see this table.

ValueDescription
'actual'

Anchor date specification for an actual date. For this function, for periodicities other than daily, enddate is the anchor date.

If the period is weekly and the enddate is a Thursday, every data point is a Thursday, or the nearest prior business day to Thursday. If the period is monthly and the enddate is the 20th of a month, every data point is the 20th of each month in the date range.

'calendar'

Anchor date specification for a calendar year.

'fiscal'

Anchor date specification for a fiscal year.

'none'

Do not specify the anchor date.

To specify returning data for particular days, see this table.

ValueDescription
'non_trading_weekdays'Return data for all weekdays.
'all_calendar_days'Return data for all calendar days.
'active_days_only'Return data for only active trading days.

To specify how to fill missing values, see this table.

ValueDescription
'previous_value'Fill missing values with previous values for dates without trading activity for the security.
'nil_value'Fill missing values with a NaN for dates without trading activity for the security.

Data Types: char | cell

Currency, specified as a character vector 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

Beginning date for the historical data, specified as a double scalar, double vector, double matrix, character vector, or cell array of character vectors. 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

End date for the historical data, specified as a double scalar, double vector, double matrix, character vector, or cell array of character vectors. 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

collapse all

Override fields, specified as the comma-separated pair consisting of 'overrideFields' and an n-by-2 cell array. The first column of the cell array is the override field and the second column is the override value.

Example: 'overrideFields',{'IVOL_DELTA_LEVEL','DELTA_LVL_10';'IVOL_DELTA_PUT_OR_CALL','IVOL_PUT';'IVOL_MATURITY','MATURITY_1STM'}

Data Types: cell

Historical normal pricing adjustment, specified as the comma-separated pair consisting of 'adjustmentNormal' and 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

  • 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

Historical abnormal pricing adjustment, specified as the comma-separated pair consisting of 'adjustmentAbnormal' and 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

  • 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

Historical split pricing or volume adjustment, specified as the comma-separated pair consisting of 'adjustmentSplit' and a Boolean to reflect:

  • Spin-Offs

  • Stock Splits/Consolidations

  • Stock Dividend/Bonus

  • 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

Historical pricing adjustment, specified as the comma-separated pair consisting of 'adjustmentFollowDPDF' and 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

collapse all

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.

Security list, returned as a cell array of character vectors 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

collapse all

Tips

  • For better performance, add the Bloomberg file blpapi3.jar to the MATLAB static Java® class path by modifying the file $MATLAB/toolbox/local/javaclasspath.txt. For details about the static Java class path, see Static Path.

  • You can check data and field availability by using the Bloomberg Excel® Add-In.

See Also

| | | |

Introduced in R2010a

Was this topic helpful?