Method: IGMarkets::Streaming::MarketSubscriptionManager#on_data

Defined in:
lib/ig_markets/streaming/market_subscription_manager.rb

#on_data(&callback) ⇒ Object

Adds the passed block to the list of callbacks that will be run when a market that is subscribed to receives new data. The block will be called on a worker thread and so the code that is run by the block must be thread-safe. The arguments passed to the block are ‘|data, merged_data|`, and both arguments will be instances of IGMarkets::Streaming::MarketUpdate.

Parameters:

  • callback (Proc)

    The callback that is to be run.



33
34
35
# File 'lib/ig_markets/streaming/market_subscription_manager.rb', line 33

def on_data(&callback)
  @on_data_callbacks << callback
end