Caplin Trader 5.1.0

Interface: module:ct-trading/trademodel/InstrumentDataSubscriber

module:ct-trading/trademodel/InstrumentDataSubscriber

InstrumentDataSubscriber instances are responsible for receiving asynchronous instrument data streams from some publisher (the server) and forwarding them to a trade leg that is connected with that instrument. The InstrumentDataSubscriber interface exists to decouple the details of the data transfer protocol away from the trade model. An InstrumentDataSubscriber only provides data for a single instrument, to a single trade leg (at any one time).

Methods

subscribeTradeLeg(tradeLeg, instrumentName, fieldNames)

Registers a trade leg to receive data for a particular instrument.

Parameters:
Name Type Description
tradeLeg module:ct-trading/trademodel/TradeLeg

The trade leg that will receive the data.

instrumentName String

The name of the financial instrument for which the leg requires data.

fieldNames Array

The list of fields for which the leg requires data.

unsubscribeTradeLeg()

Deallocates any resources used by the subscriber.

Correctly implementing this method is important, since if users are not un-subscribed for instruments they are no longer viewing, then serious performance problems are likely to occur.