Caplin Trader 4.7.1

Interface: module:caplin/trading/trademodel/InstrumentDataSubscriber

module:caplin/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).

Implementations:

Methods

subscribeTradeLeg(tradeLeg, instrumentName, fieldNames)

Registers a trade leg to receive data for a particular instrument.
Parameters:
Name Type Description
tradeLeg module:caplin/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.
Implementations:
  • module:caplin/trading/testing/InstrumentDataSubscriberStub#subscribeTradeLeg
  • module:caplin/trading/trademodel/SL4BInstrumentDataSubscriber#subscribeTradeLeg
  • module:caplin/trading/trademodel/StreamingInstrumentDataSubscriber#subscribeTradeLeg

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.

Implementations:
  • module:caplin/trading/testing/InstrumentDataSubscriberStub#unsubscribeTradeLeg
  • module:caplin/trading/trademodel/SL4BInstrumentDataSubscriber#unsubscribeTradeLeg
  • module:caplin/trading/trademodel/StreamingInstrumentDataSubscriber#unsubscribeTradeLeg