April 2019
Intermediate to advanced
426 pages
11h 13m
English
The Strategy class given in the following code is the base class for all other strategy implementations, and is written as:
from abc import abstractmethodclass Strategy: def __init__(self, send_order_event_handler): self.send_order_event_handler = send_order_event_handler @abstractmethod def on_tick_event(self, market_data): raise NotImplementedError('Method is required!') @abstractmethod def on_position_event(self, positions): raise NotImplementedError('Method is required!') def send_market_order(self, symbol, qty, is_buy, timestamp): if self.send_order_event_handler: order = Order( timestamp, symbol, qty, is_buy, is_market_order=True, price=0, ) self.send_order_event_handler(order)
The on_tick_event() ...
Read now
Unlock full access