Note Market data subscriptions are throttled at 750 per second and applications are limited to making no more than 15,000 market data subscriptions.
To create a price subscription and start receiving updates, you:
-
Create a class that is derived from
ttsdk::IPriceEventHandler and defines your
event handler. You must provide implementations for:
-
virtual void OnPriceUpdate(const uint64_t subId, const
InstrumentPtr& instrument, const PriceSnap&
snap) = 0;
- Callback delivering price updates
-
virtual void OnError(const uint64_t subId, const
InstrumentPtr& instrument, const SubscriptionError
code, const char* error) = 0;
- Callback fired when an error occurs fulfilling a price subscription request
-
virtual void OnDisconnect(const uint64_t subId, const
InstrumentPtr& instrument, const PriceEventType
type) = 0;
- Callback fired when an disconnection event happens
-
virtual void OnUnsubscribed(const uint64_t subId) = 0;
- Callback fired when the unsubscribe request is complete and it is safe to destroy the handler object
-
virtual void OnPriceUpdate(const uint64_t subId, const
InstrumentPtr& instrument, const PriceSnap&
snap) = 0;
-
Call the SubscribePrices() function passing your event
handler instance variable.
-
The SubscribePrices() function allows you to specify
whether to wish to optionally receive:
- market depth
- exchange calculated and disseminated implied prices
- TT calculated and disseminated implied prices
- TT’s simulation price stream
-
The SubscribePrices() function allows you to specify
whether to wish to optionally receive:
The following code snippet demonstrates an example of this process.
class PriceObserver : public ttsdk::IPriceEventHandler
{
public:
PriceObserver() {}
virtual void OnPriceUpdate(const uint64_t subId,
const ttsdk::InstrumentPtr& instrument, const ttsdk::PriceSnap& snap)
{
std::cout GetAlias() GetAlias()