RoutingModel#
tradeexecutor.strategy.routing.RoutingModel class.
- class RoutingModel[source]#
Bases:
ABC
Trade roouting model base class.
Nothing done here - check the subclasses.
- __init__()#
Methods
__init__
()create_routing_state
(universe, execution_details)Create a new routing state for this cycle.
setup_trades
(state, trades[, check_balances])Setup the trades decided by a strategy.
- abstract create_routing_state(universe, execution_details)[source]#
Create a new routing state for this cycle.
- Parameters
execution_details (object) – A dict of whatever connects live execution to routing.
universe (StrategyExecutionUniverse) –
- Return type
- abstract setup_trades(state, trades, check_balances=False)[source]#
Setup the trades decided by a strategy.
Decides the best way, or a way, to execute a trade
Sets up blockchain transactions needed for trades, like approves
Trade instances are mutated in-place
- Parameters
check_balances – Check that the wallet has enough reserves to perform the trades before executing them. Because we are selling before buying. sometimes we do no know this until the sell tx has been completed.
state (RoutingState) –
trades (List[TradeExecution]) –
- Raises
CannotExecuteTrade – If a trade cannot be executed, e.g. due to an unsupported pair or an exchange,