subscribe: Subscribe to streaming market data

View source: R/subscribe.R

subscribeR Documentation

Subscribe to streaming market data

Description

This function uses the Bloomberg API to stream live market data

Usage

subscribe(securities, fields, fun, options = NULL,
  identity = defaultAuthentication(), con = defaultConnection())

Arguments

securities

A character vector with security symbols in Bloomberg notation.

fields

A character vector with Bloomberg query fields.

fun

An R function to be called on the subscription data.

options

An optional named character vector with option values. Each field must have both a name (designating the option being set) as well as a value.

identity

An optional identity object as created by a blpAuthenticate call, and retrived via the internal function defaultAuthentication.

con

A connection object as created by a blpConnect call, and retrieved via the internal function defaultConnection.

Details

The subscribe function allows one to subscribe to streaming market quotes.

Full detials of the subscription string can be found in the header file blpapi_subscriptionlist.h.

Value

This function always returns NULL.

Author(s)

Whit Armstrong

References

https://bloomberg.github.io/blpapi-docs/cpp/3.8/

Examples

## Not run: 
  subscribe(securities=c("TYZ5 Comdty","/cusip/912810RE0@BGN"),
            fields=c("LAST_PRICE","BID","ASK"),
            fun=function(x) print(str(x$data)))

## End(Not run)

Rblpapi documentation built on Sept. 30, 2024, 5:08 p.m.