timeseries

Intraday tick data for Bloomberg connection V3

Syntax

  • d = timeseries(c,s,date) example
  • d = timeseries(c,s,date,interval,field) example
  • d = timeseries(c,s,date,[],field,options,values) example
  • d = timeseries(c,s,{startdate,enddate}) example
  • d = timeseries(c,s,{startdate,enddate},interval,field) example
  • d = timeseries(c,s,{startdate,enddate},[],field) example
  • d = timeseries(c,s,{startdate,enddate},[],field,options,values) example

Description

example

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

example

d = timeseries(c,s,date,interval,field) retrieves raw tick data d for the security s and a specific date date aggregated into intervals of interval for field field.

example

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

example

d = timeseries(c,s,{startdate,enddate}) retrieves raw tick data d for security s where startdate is the starting date and enddate is the ending date of the date range.

example

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

example

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

example

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

Examples

expand all

Retrieve Time-Series Tick Data for a Specific Date

Create the Bloomberg® connection.

c = blp;

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

Retrieve today's trade tick series for the IBM® security.

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]
    ...

d contains the tick type in the first column, the numeric representation of the date and time in the second column, the tick value in the third column, and the tick size in the fourth column. Here, the first row shows that 100 IBM shares sold for $181.69 today.

Close the Bloomberg connection.

close(c)

Retrieve Time-Series Tick Data for a Specific Date Using a Security with a Pricing Source

Create the Bloomberg connection.

c = blp;

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

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

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]
    ...

d contains the tick type in the first column, the numeric representation of the date and time in the second column, the tick value in the third column, and the tick size in the fourth column. Here, the first row shows that 100 Microsoft shares are sold for $35.53 today.

Close the Bloomberg connection.

close(c)

Retrieve Time-Series Tick Data for a Specific Date Using a Time Interval with a Specific Field

Create the Bloomberg connection.

c = blp;

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

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

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 that on today's date the open price is $181.69, the high price is $181.99, the low price is $180.10, the closing price is $181.84, the volume is 252,322, the number of ticks is 861, and the total tick value in the bar is $45,815,588. The next row shows tick data for 5 minutes later.

Close the Bloomberg connection.

close(c)

Retrieve Time-Series Tick Data for a Specific Date with a Specific Field and an Option and Value

Create the Bloomberg connection.

c = blp;

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

Retrieve today's trade tick series for the 'F US Equity' security without specifying the aggregation parameter. Additionally, 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)

Retrieve Time-Series Tick Data Using a Date Range

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 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]
   ...

d contains the tick type in the first column, the numeric representation of the date and time in the second column, the tick value in the third column, and the tick size in the fourth column. 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)

Retrieve Time-Series Tick Data Using a Date Range with an Interval and a Specific Field

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 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 that on today's date the open price is $187.20, the high price is $187.60, the low price is $187.02, the closing price is $187.08, the volume of ticks is 207,683, the number of ticks is 560, and the total tick value in the bar is $38,902,968. The next row shows tick data for 5 minutes later.

Close the Bloomberg connection.

close(c)

Retrieve Time-Series Tick Data Using a Date Range with Numerous Fields

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 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]
    ...

d contains the tick type in the first column, the numeric representation of the date and time in the second column, the tick value in the third column, and the tick size in the fourth column. Here, the first row shows that 100 'F US Equity' security shares sold for $16.71 yesterday.

Close the Bloomberg connection.

close(c)

Retrieve Time-Series Tick Data Using a Date Range with Options and Values

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 trade tick series for the security 'F US Equity' for yesterday with a time interval at noon, without specifying the aggregation parameter. Additionally, 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. If the equity is one of the former, then the broker buy code would be in the seventh column and the broker sell code would be 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)

Input Arguments

expand all

c — Bloomberg connectionconnection object

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

s — Securitystring

Security, specified as a string for a single Bloomberg security.

Data Types: char

date — Datescalar | string

Date, specified as a scalar or string to denote the specific date for the returned tick data.

Example: floor(now)

Data Types: double | char

interval — Time intervalscalar

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

Data Types: double

field — Bloomberg fieldstring

Bloomberg field, specified as a string that defines the tick data to return. Valid values are:

  • 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'

Data Types: char

options — Bloomberg API optionscell array

Bloomberg API options, specified as a cell array of strings. The valid strings are 'includeConditionCodes', 'includeExchangeCodes', and 'includeBrokerCodes'.

Data Types: cell

values — Bloomberg API valuescell array

Bloomberg API values, specified as a cell array of strings. The valid values are true and false.

Data Types: cell

startdate — Start datescalar | string

Start date, specified as a scalar or string to denote the start date of the date range for the returned tick data.

Example: floor(now-1)

Data Types: double | char

enddate — End datescalar | string

End date, specified as a scalar or string to denote the end date of the date range for the returned tick data.

Example: floor(now)

Data Types: double | char

Output Arguments

expand all

d — Bloomberg tick datacell array | matrix

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.

More About

expand 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 The Static Path.

  • 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.

See Also

| | | |

Was this topic helpful?