Documentation

This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

timeseries

Intraday tick data for Bloomberg connection V3

Syntax

d = timeseries(c,s,date)
d = timeseries(c,s,date,interval,field)
d = timeseries(c,s,date,[],field,options,values)
d = timeseries(c,s,{startdate,enddate})
d = timeseries(c,s,{startdate,enddate},interval,field)
d = timeseries(c,s,{startdate,enddate},[],field)
d = timeseries(c,s,{startdate,enddate},[],field,options,values)
d = timeseries(c,s,{startdate:enddate,starttime,endtime},interval)
d = timeseries(c,s,{startdate:enddate,starttime,endtime},interval,field)
d = timeseries(c,s,{startdate:dayincrement:enddate,starttime,endtime},interval)
d = timeseries(c,s,{startdate:dayincrement:enddate,starttime,endtime},interval,field)

Description

example

d = timeseries(c,s,date) retrieves raw tick data using the connection object and a security for a specific date.

example

d = timeseries(c,s,date,interval,field) retrieves raw tick data that is aggregated into intervals for a specific field.

example

d = timeseries(c,s,date,[],field,options,values) retrieves raw tick data without an aggregation interval for a specific field with the specified options and corresponding values.

example

d = timeseries(c,s,{startdate,enddate}) retrieves raw tick data for a date range using a start date and an end date.

example

d = timeseries(c,s,{startdate,enddate},interval,field) retrieves raw tick data for a specific date range aggregated into intervals for a specific field.

example

d = timeseries(c,s,{startdate,enddate},[],field) retrieves raw tick data for a specific date range without an aggregation interval for a specific field.

example

d = timeseries(c,s,{startdate,enddate},[],field,options,values) retrieves raw tick data for a specific date range without an aggregation interval for a specific field with specified options and corresponding values.

example

d = timeseries(c,s,{startdate:enddate,starttime,endtime},interval) retrieves raw trade tick data for a specific time range for each day within a specific date range, aggregated into intervals.

example

d = timeseries(c,s,{startdate:enddate,starttime,endtime},interval,field) uses a specific field for tick data to return.

example

d = timeseries(c,s,{startdate:dayincrement:enddate,starttime,endtime},interval) retrieves raw trade tick data for a whole day increment within a specific date and time range, aggregated into intervals.

example

d = timeseries(c,s,{startdate:dayincrement:enddate,starttime,endtime},interval,field) uses a specific field for tick data to return.

Examples

collapse all

Create the Bloomberg® connection.

c = blp;

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

Retrieve the trade tick series using the IBM® security for today.

d = timeseries(c,'IBM US Equity',floor(now))
d = 

    'TRADE'    [735537.40]    [181.69]    [100.00]
    'TRADE'    [735537.40]    [181.69]    [100.00]
    'TRADE'    [735537.40]    [181.68]    [100.00]
    ...

The columns in d are:

  • Tick type

  • Numeric representation of the date and time

  • Tick value

  • Tick size

Here, the first row shows that 100 IBM shares sold for $181.69 today.

Close the Bloomberg connection.

close(c)

Create the Bloomberg connection.

c = blp;

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

Retrieve the trade tick series using the Microsoft® security with pricing source ETPX for today.

d = timeseries(c,'MSFT@ETPX US Equity',floor(now))
d = 

    'TRADE'    [735537.40]    [35.53]    [100.00]
    'TRADE'    [735537.40]    [35.55]    [200.00]
    'TRADE'    [735537.40]    [35.55]    [100.00]
    ...

The columns in d are:

  • Tick type

  • Numeric representation of the date and time

  • Tick value

  • Tick size

Here, the first row shows that 100 Microsoft shares are sold for $35.53 today.

Close the Bloomberg connection.

close(c)

Create the Bloomberg connection.

c = blp;

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

Retrieve the trade tick series using the IBM security aggregated into 5-minute intervals for today.

d = timeseries(c,'IBM US Equity',floor(now),5,'Trade')
d =

  Columns 1 through 7

   735537.40        181.69        181.99        180.10        181.84     252322.00        861.00
   735537.40        181.90        181.97        181.57        181.65      78570.00        535.00
   735537.40        181.73        182.18        181.58        182.07     124898.00        817.00
     ...

  Column 8

   45815588.00
   14282076.00
   22710954.00
   ...

The columns in d contain the following:

  • Numeric representation of date and time

  • Open price

  • High price

  • Low price

  • Closing price

  • Volume of ticks

  • Number of ticks

  • Total tick value in the bar

Here, the first row of data shows prices and tick data for the current date. The next row shows tick data for 5 minutes later.

Close the Bloomberg connection.

close(c)

Create the Bloomberg connection.

c = blp;

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

Retrieve the trade tick series using the 'F US Equity' security without specifying the aggregation parameter for today. Also, return the condition codes.

d = timeseries(c,'F US Equity',floor(now),[],'Trade',...
               'includeConditionCodes','true')
d =

    'TRADE'    [735556.57]    [17.12]    [   100.00]    'R6,IS'  
    'TRADE'    [735556.57]    [17.12]    [   100.00]    ''       
    'TRADE'    [735556.57]    [17.12]    [   500.00]    ''       
    ...

The columns in d contain the following:

  • Tick type

  • Numeric representation of the date and time

  • Tick value

  • Tick size

  • Condition codes

Here, the first row shows that 100 'F US Equity' security shares sold for $17.12 today.

Close the Bloomberg connection.

close(c)

Create the Bloomberg connection.

c = blp;

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

Retrieve the tick series for the 'F US Equity' security for the last business day from the beginning of the day to noon.

d = timeseries(c,'F US Equity',{floor(now-4),floor(now-3.5)})
d =

    'TRADE'    [735552.67]    [17.09]    [   200.00]
    'TRADE'    [735552.67]    [17.09]    [   100.00]
    'TRADE'    [735552.67]    [17.09]    [   100.00]
   ...

The columns in d are:

  • Tick type

  • Numeric representation of the date and time

  • Tick value

  • Tick size

Here, the first row shows that 200 'F US Equity' security shares were sold for $17.09 on the last business day.

Close the Bloomberg connection.

close(c)

Create the Bloomberg connection.

c = blp;

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

Retrieve the trade tick series for the past 50 days for the IBM security aggregated into 5-minute intervals.

d = timeseries(c,'IBM US Equity',{floor(now)-50,floor(now)},5,'Trade')
ans =

  Columns 1 through 7

   735487.40        187.20        187.60        187.02        187.08     207683.00        560.00
   735487.40        187.03        187.13        186.65        186.78      46990.00        349.00
   735487.40        186.78        186.78        186.40        186.47      51589.00        399.00
     ...

Column 8

   38902968.00
    8779374.00
    9626896.00
   ...

The columns in d contain the following:

  • Numeric representation of date and time

  • Open price

  • High price

  • Low price

  • Closing price

  • Volume of ticks

  • Number of ticks

  • Total tick value in the bar

The first row of data shows prices and tick data for the current date. The next row shows tick data for 5 minutes later.

Close the Bloomberg connection.

close(c)

Create the Bloomberg connection.

c = blp;

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

Return the Bid, Ask, and trade tick series for the security 'F US Equity' for yesterday with a time interval at noon, without specifying the aggregation parameter.

d = timeseries(c,'F US Equity',{floor(now-1)+.5,floor(now-1)+.51},...
               [],{'Bid','Ask','Trade'})
d = 

    'TRADE'    [735550.50]    [16.71]    [100.00]
    'ASK'      [735550.50]    [16.71]    [312.00]
    'BID'      [735550.50]    [16.70]    [177.00]
    ...

The columns in d are:

  • Tick type

  • Numeric representation of the date and time

  • Tick value

  • Tick size

Here, the first row shows that 100 'F US Equity' security shares sold for $16.71 yesterday.

Close the Bloomberg connection.

close(c)

Create the Bloomberg connection.

c = blp;

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

Return the trade tick series for the security 'F US Equity' for yesterday with a time interval at noon, without specifying the aggregation parameter. Also, return the condition codes, exchange codes, and broker codes.

d = timeseries(c,'F US Equity',{floor(now-1)+.5,floor(now-1)+.51},...
               [],'Trade',{'includeConditionCodes',...
               'includeExchangeCodes','includeBrokerCodes'},...
               {'true','true','true'})
d = 

    'TRADE'    [735550.50]    [16.71]    [100.00]    'T'     'D'
    'TRADE'    [735550.50]    [16.70]    [400.00]    'IS'    'B'
    'TRADE'    [735550.50]    [16.70]    [100.00]    'IS'    'B'
    ...

The columns in d contain the following:

  • Tick type

  • Numeric representation of the date and time

  • Tick value

  • Tick size

  • Exchange condition codes

  • Exchange codes

Broker codes are available for Canadian, Finnish, Mexican, Philippine, and Swedish equities only. In this case, the broker buy code appears in the seventh column and the broker sell code appears in the eighth column.

Here, the first row shows that 100 'F US Equity' security shares sold for $16.71 yesterday.

Close the Bloomberg connection.

close(c)

Use Bloomberg® to retrieve raw trade tick data by specifying a time range for each day in a specific date range. Specify the time interval for the tick data.

Create the Bloomberg® connection.

c = blp;

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

Retrieve the trade tick series for the 'F US Equity' security for the last two days. Use the time range from the beginning of the trading day through noon. Retrieve tick data aggregated into 5-minute intervals. d is a numeric matrix.

s = 'F US Equity';
startdate = datetime('today')-1;
enddate = datetime('today');
starttime = "09:30:00";
endtime = "12:00:00";
interval = 5;

d = timeseries(c,s,{startdate:enddate,starttime,endtime},interval);

Set the display output for currency.

format bank

Display the first three ticks.

d(1:3,:)
ans =

  Columns 1 through 5

     736832.40         10.88         10.94         10.88         10.92
     736832.40         10.93         10.95         10.89         10.90
     736832.40         10.91         10.91         10.87         10.87

  Columns 6 through 8

    1793265.00       1033.00   19555178.00
    1040314.00       1257.00   11350726.00
     868673.00       1053.00    9452869.00

The columns in d are:

  • Numeric representation of date and time

  • Open price

  • High price

  • Low price

  • Closing price

  • Volume of ticks

  • Number of ticks

  • Total tick value in the bar

The first row shows tick data at the start time of the time range. The next row shows tick data for 5 minutes later.

Determine the maximum high price for the last two days.

highprices = d(:,3);
m = max(highprices)
m =

         10.95

Close the Bloomberg® connection.

close(c)

Use Bloomberg® to retrieve raw tick data by specifying a time range for each day in a specific date range. Specify the time interval and the field for the type of tick data to return. Here, specify the bid tick data.

Create the Bloomberg® connection.

c = blp;

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

Retrieve the tick series for the 'F US Equity' security for the last two days. Use the time range from the beginning of the trading day through noon. Retrieve tick data aggregated into 5-minute intervals. Specify retrieving the bid tick series. d is a numeric matrix.

s = 'F US Equity';
startdate = datetime('today')-1;
enddate = datetime('today');
starttime = "09:30:00";
endtime = "12:00:00";
interval = 5;
field = 'BID';

d = timeseries(c,s,{startdate:enddate,starttime,endtime},interval,field);

Set the display output for currency.

format bank

Display the first three ticks.

d(1:3,:)
ans =

  Columns 1 through 5

     736832.40         10.88         10.93         10.87         10.92
     736832.40         10.92         10.94         10.89         10.90
     736832.40         10.90         10.90         10.87         10.87

  Columns 6 through 8

     985943.00       1557.00   10749858.00
     922264.00       1627.00   10058669.00
    1160625.00       1557.00   12623513.00

The columns in d are:

  • Numeric representation of date and time

  • Open price

  • High price

  • Low price

  • Closing price

  • Volume of ticks

  • Number of ticks

  • Total tick value in the bar

The first row shows tick data at the start time of the time range. The next row shows tick data for 5 minutes later.

Determine the maximum high price for the last two days.

highprices = d(:,3);
m = max(highprices)
m =

         10.94

Close the Bloomberg® connection.

close(c)

Use Bloomberg® to retrieve raw trade tick data by specifying a time range for each day in a specific date range. Specify a day increment for the date range and the time interval for the tick data.

Create the Bloomberg® connection.

c = blp;

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

Retrieve the trade tick series for the 'IBM US Equity' security for the last two months. Set the day increment to 5 days. Use the time range from the beginning of the trading day through noon. Retrieve tick data aggregated into 5-minute intervals. d is a numeric matrix.

s = 'IBM US Equity';
startdate = datetime('today')-60;
enddate = datetime('today');
dayincrement = 5;
starttime = "09:30:00";
endtime = "12:00:00";
interval = 5;

d = timeseries(c,s,{startdate:dayincrement:enddate,starttime,endtime}, ...
    interval);

Set the display output for currency.

format bank

Display the first three ticks.

d(1:3,:)
ans =

  Columns 1 through 5

     736778.40        175.12        175.50        174.84        174.89
     736778.40        175.04        175.50        174.60        174.63
     736778.40        174.71        175.11        174.70        175.11

  Columns 6 through 8

      55214.00        112.00    9668770.00
      46196.00        210.00    8082152.00
       7219.00         60.00    1262491.75

The columns in d are:

  • Numeric representation of date and time

  • Open price

  • High price

  • Low price

  • Closing price

  • Volume of ticks

  • Number of ticks

  • Total tick value in the bar

The first row shows tick data at the start time of the time range. The next row shows tick data for 5 minutes later.

After the tick data for the first day in the date range, d contains tick data for a trading day that is 5 days later.

Close the Bloomberg® connection.

close(c)

Use Bloomberg® to retrieve raw tick data by specifying a time range for each day in a specific date range. Specify a day increment for the date range, the time interval for the tick data, and the field for the type of tick data to return. Here, specify the bid tick data.

Create the Bloomberg® connection.

c = blp;

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

Retrieve the trade tick series for the 'F US Equity' security for the last two months. Set the day increment to 5 days. Use the time range from the beginning of the trading day through noon. Retrieve tick data aggregated into 5-minute intervals. Specify the bid tick series. d is a numeric matrix.

s = 'F US Equity';
startdate = datetime('today')-60;
enddate = datetime('today');
dayincrement = 5;
starttime = "09:30:00";
endtime = "12:00:00";
interval = 5;
field = 'BID';

d = timeseries(c,s,{startdate:dayincrement:enddate,starttime,endtime}, ...
    interval,field);

Set the display output for currency.

format bank

Display the first three ticks.

d(1:3,:)
ans =

  Columns 1 through 5

     736778.40         11.65         11.69         11.63         11.66
     736778.40         11.66         11.66         11.61         11.62
     736778.40         11.62         11.66         11.62         11.66

  Columns 6 through 8

     534982.00       4340.00    6238291.00
     446733.00       2126.00    5194871.50
     526934.00       1603.00    6127932.00

The columns in d are:

  • Numeric representation of date and time

  • Open price

  • High price

  • Low price

  • Closing price

  • Volume of ticks

  • Number of ticks

  • Total tick value in the bar

The first row shows tick data at the start time of the time range. The next row shows tick data for 5 minutes later.

After the tick data for the first day in the date range, d contains tick data for a trading day that is 5 days later.

Close the Bloomberg® connection.

close(c)

Input Arguments

collapse all

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

Security, specified as a character vector or string scalar for a single Bloomberg security.

Data Types: char | string

Date, specified as a numeric scalar, character vector, string scalar, or datetime array. date specifies the date for the returned tick data based on the entire day from midnight until 11:59:59 p.m.

Example: floor(now)

Data Types: double | char | string | datetime

Time interval, specified as a numeric scalar to denote the number of minutes between ticks for the returned tick data.

Data Types: double

Bloomberg field, specified as one of these values that define the tick data to return.

Request TypeValid Bloomberg Field Values

IntradayBarRequest with time interval specified

'TRADE'
'BID'
'ASK'
'BID_BEST'
'ASK_BEST'

IntradayTickRequest with no time interval specified

'TRADE'
'BID'
'ASK'
'BID_BEST'
'ASK_BEST'
'SETTLE'

Bloomberg API options, specified as one of these values.

ValueDescription

'includeConditionCodes'

Exchange condition codes associated with the event

'includeExchangeCodes'

Exchange code where tick originated

'includeBrokerCodes'

Broker code

'includeRpsCodes'

Reporting party side

'includeNonPlottableEvents'

After-hours data

To specify more than one Bloomberg API option, use a cell array of these values.

Specify the corresponding Bloomberg API value for each API option. The number of options must match the number of values.

For example, to specify one Bloomberg API option, enter:

d = timeseries(c,'F US Equity',floor(now),[],'Trade',...
               'includeConditionCodes','true');

To specify two Bloomberg API options, enter:

d = timeseries(c,'F US Equity',floor(now),[],'Trade',...
               {'includeConditionCodes','includeExchangeCodes'},...
               {'true','true'});

For details about the options, see the Bloomberg API Developer’s Guide.

Data Types: char | cell

Bloomberg API values, specified as 'true' or 'false'. Each value corresponds to the specified Bloomberg API option. To specify more than one Bloomberg API value, use a cell array. The number of values must match the number of options.

For example, to specify one Bloomberg API option, enter:

d = timeseries(c,'F US Equity',floor(now),[],'Trade',...
               'includeConditionCodes','true');

To specify two Bloomberg API options, enter:

d = timeseries(c,'F US Equity',floor(now),[],'Trade',...
               {'includeConditionCodes','includeExchangeCodes'},...
               {'true','true'});

Data Types: char | cell

Start date, specified as a numeric scalar, character vector, string scalar, or datetime array. This date specifies the beginning of the date range for the returned tick data. If no ticks are present in the date range, then returned tick data is empty.

Example: floor(now-1)

Data Types: double | char | string | datetime

End date, specified as a numeric scalar, character vector, string scalar, or datetime array. This date specifies the end of the date range for the returned tick data. If no ticks are present in the date range, then returned tick data is empty.

Example: floor(now)

Data Types: double | char | string | datetime

Start time, specified as a character vector, string scalar, or datetime array. This time specifies the start time of the time range for the returned tick data.

Example: '09:30:00'

Data Types: char | string | datetime

End time, specified as a character vector, string scalar, or datetime array. This time specifies the end time of the time range for the returned tick data.

Example: '16:30:00'

Data Types: char | string | datetime

Day increment, specified as a numeric scalar. This number specifies the whole day increment for a specific date range. For example, if the day increment is 7, then the returned data contains ticks for every 7th day starting from the first day within the date range.

Data Types: double

Output Arguments

collapse all

Bloomberg tick data, returned as a cell array for requests without a specified time interval or a matrix for requests with a specified time interval.

Note

The Bloomberg API returns the tick time with precision in seconds.

Limitations

When the data request is too large, timeseries displays this error message:

Timeout error:
Error using blp/timeseries>processResponseEvent (line 338) REQUEST FAILED: responseError = {

source = bbdbl7

code = -2

category = TIMEOUT

message = Timed out getting data from store [nid:327]

subcategory = INTERNAL_ERROR

}

To fix this error, shorten the length of the date range by modifying the input arguments startdate and enddate.

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 (MATLAB).

  • You cannot retrieve Bloomberg intraday tick data for a date more than 140 days ago.

  • The Bloomberg API Developer’s Guide states that 'TRADE' corresponds to LAST_PRICE for IntradayTickRequest and IntradayBarRequest.

  • Bloomberg V3 intraday tick data supports additional name-value pairs. For details on these pairs, see the Bloomberg API Developer’s Guide by typing WAPI and clicking the <GO> button on the Bloomberg terminal.

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

Introduced in R2010a

Was this topic helpful?