TT CORE SDK
0.1
TT CORE SDK documentation
|
The TT Core SDK offers two types of market data subscriptions:
To create a market data subscription, you call the CreatePriceSubscription() function. The signature for this function is as follows.
where:
instr
variable is a reference to an instance of the Instrument class. It must be valid reference to an instrument that was returned from the DownloadInstrument() function.filter
variable is a reference to an instance of the Filter class. This class allows users to define the list of market data fields for which notifications should be sent. The list of market data fields that can be included in the filter are located in the prices.hpp header file.listener
variable is a reference to an instance of a class that must be derived from the PriceEventListener class described below.The following code snippet demonstrates how to subscribe for market data for a given instrument.
After the price subscription starts, the TT Core SDK retrieves a snapshot of the market data for the instrument and invokes the price update event handler method you registered with the subscription. It then subsequently invokes the event handler whenever there is an update to the market data. To create a listener you must inherit from the PriceEventListener class.
To receive Time & Sales updates, you must add the PRICE_FILTER_TIME_SALES flag to the filter you supply to the CreatePriceSubscription() method.
The definition of the PriceSnap struct can be found in the prices.hpp header file, and includes:
Public Attribute | Description |
---|---|
asks | Ask side depth. Returns a depth_snap struct, which is defined in the prices.hpp file. |
bids | Bid side depth. Returns a depth_snap struct, which is defined in the prices.hpp file. |
close_price | Price at the session close. |
conflation_no | Price conflation count. |
exchange_time_ns | Time that the exchange received the order that resulted in this market data update (in nanoseconds). Populated only when provided by the exchange. |
exchange_transaction_time_ns | Time that the exchange received the order that resulted in this market data update (in nanoseconds). Populated only when provided by the exchange. |
high_price | High price. |
last_trade_price | Last traded price. |
last_trade_quantity | Last traded quantity. |
low_price | Low price. |
market_state | Market state. Returns a market_state enum, which is defined in the enums.hpp file. |
mdrc_recv_time | Time that the price update was received from the TT Price Server. |
open_price | Price at the session open. |
settlement_price | Settlement Price |
volume | Total contract volume. |
Note that all prices are returned in decimal (Points) format and will return NAN when a price is unavailable.
The definition of the TimeSale struct can be found in the prices.hpp header file, and includes:
Public Attribute | Description |
---|---|
epoch_transact_time_micro | Transaction time since epoch (in microseconds) |
exchange_transact_time_ns | Time that the exchange received the order that resulted in this market data update (in nanoseconds). |
is_implied | Whether the trade is implied. |
is_leg | Whether the trade is a leg trade. |
is_otc | Trade is exchange supported OTC trade. |
last_trade_price | Last Traded Price. |
last_trade_quantity | Last traded quantity. |
qualifier | Trade Qualifier. Returns a trade_qualifier struct, which is defined in the enums.hpp file. |
status | Trade Status. Returns a trade_status struct, which is defined in the enums.hpp file. |
type | Trade type. Returns a trade_type struct, which is defined in the enums.hpp file. |
Note that all prices are returned in decimal (Points) format and will return NAN when a price is unavailable.
The PriceSubscription object returned from CreatePriceSubscription() provides the interface to manage the price subscription, including methods to pause, resume, and cancel. The Filter for the subscription can also be queried and updated.
Member Functions | Description |
---|---|
AddFilter() | Appends to existing filter The Filter bitset is defined in the prices.hpp file. |
Cancel() | Cancels the price subscription. |
GetFilter() | Manages the filters for this price subscription. The Filter bitset is defined in the prices.hpp file. |
Id() | Unique PriceSubscription ID. |
IsValid() | Check if the subscription is valid. |
Pause() | Stop delivering subscription updates to the listener. |
Resume() | Resume delivering subscription updates to the listener. |
SetFilter() | Overwrites filter. The Filter bitset is defined in the prices.hpp file. |