April 2019
Intermediate to advanced
426 pages
11h 13m
English
Add the following two methods as the getter and setter for the position event handler:
@property
def on_position_event(self):
"""
Listeners will receive:
symbol, is_long, units, unrealized_pnl, pnl
"""
return self.__position_event_handler
@on_position_event.setter
def on_position_event(self, event_handler):
self.__position_event_handler = event_handler
When a position update event is received from your broker, the inheriting child classes will notify the listeners through the on_position_event method invocation containing the symbol information, a flag indicating a long or short position, the number of units traded, the unrealized profit and loss, and the realized profit and loss.