BacktestExecutionModel#

tradeexecutor.backtest.backtest_execution.BacktestExecutionModel class.

class BacktestExecutionModel[source]#

Bases: ExecutionModel

Simulate trades against historical data.

__init__(wallet, max_slippage, lp_fees=0.003)[source]#
Parameters

Methods

__init__(wallet, max_slippage[, lp_fees])

execute_trades(ts, state, trades, ...[, ...])

Execute the trades on a simulated environment.

get_routing_state_details()

Get needed details to establish a routing state.

initialize()

Set up the wallet

is_live_trading()

preflight_check()

Check that we can start the trade executor

simulate_trade(ts, state, trade)

__init__(wallet, max_slippage, lp_fees=0.003)[source]#
Parameters
preflight_check()[source]#

Check that we can start the trade executor

Raise

AssertionError if something is a miss

initialize()[source]#

Set up the wallet

execute_trades(ts, state, trades, routing_model, routing_state, check_balances=False)[source]#

Execute the trades on a simulated environment.

Calculates price impact based on historical data and fills the expected historical trade output.

Parameters
get_routing_state_details()[source]#

Get needed details to establish a routing state.

TODO: API Unfinished

Return type

dict