April 2019
Intermediate to advanced
426 pages
11h 13m
English
An instance of the MarketData class is used throughout the system to store and retrieve prices referenced by various components. Essentially, it is a container for storing the last available tick data. Additional get helper functions are included to provide easy reference to the required information:
class MarketData(object): """ Stores the most recent tick data for all symbols """ def __init__(self): self.recent_ticks = dict() # indexed by symbol def add_tick_data(self, tick_data): self.recent_ticks[tick_data.symbol] = tick_data def get_open_price(self, symbol): return self.get_tick_data(symbol).open_price def get_close_price(self, symbol): return self.get_tick_data(symbol).close_price def get_tick_data(self, ...
Read now
Unlock full access