Live Execution¶
- class src.boatwright.LiveExecution.LiveExecution(strategy, broker, allocated_frac=1, debug=False)¶
Execute a strategy in real time
- Parameters:
strategy (Strategy) – strategy
broker (Broker) – broker, can be either a backtest broker or live broker interface
allocated_frac (float) – value between 0 and 1 indicating the fraction of the total equity to allocate towards this strategy (default 1)
debug – boolean toggle to print debugging information to terminal
- notify_listeners(row)¶
puts a row of data in each listeners queue
- Parameters:
row (DataFrame) – one row of data with all signals calculated, and aum, base, quote values updated
- register_listener(listener)¶
register a listener to be updated with each row of data (only for asynchronous runs)
- async run()¶
launch live execution
- set_prerequisite_data(data)¶
seeds self.current_data and self.cumulative_data with the provided data, intended to be the most recent historical data
- Parameters:
data (DataFrame) – dataframe of most recent OHLCV data
- async step(bar)¶
actions on each bar of data recieved
- Parameters:
bar (DataFrame) – a new bar of the most recent OHLCV volume