BacktestRoutingState#

tradeexecutor.backtest.backtest_routing.BacktestRoutingState class.

class BacktestRoutingState[source]#

Bases: RoutingState

__init__(pair_universe, wallet)[source]#
Parameters

Methods

__init__(pair_universe, wallet)

check_has_enough_tokens(token, amount)

Check we have enough buy side tokens to do a trade.

create_trade(target_pair, reserve_asset, ...)

Prepare the actual swap.

is_route_approved(router_address)

mark_router_approved(token_address, ...)

Attributes

__init__(pair_universe, wallet)[source]#
Parameters
check_has_enough_tokens(token, amount)[source]#

Check we have enough buy side tokens to do a trade.

Parameters
create_trade(target_pair, reserve_asset, reserve_amount, max_slippage, check_balances)[source]#

Prepare the actual swap.

Parameters
  • check_balances (False) – Check on-chain balances that the account has enough tokens and raise exception if not.

  • target_pair (TradingPairIdentifier) –

  • reserve_asset (AssetIdentifier) –

  • reserve_amount (Decimal) –

  • max_slippage (float) –