EthereumBacktestPairConfigurator#
API documentation for tradeexecutor.backtest.backtest_generic_router.EthereumBacktestPairConfigurator Python class in Trading Strategy framework.
- class EthereumBacktestPairConfigurator[source]#
Bases:
PairConfigurator
Set up routes for EVM trading pairs in backtesting.
See
tradeexecutor.ethereum.ethereum_protocol_adapter.EthereumPairConfigurator
for live trading implementation.All routes
Supported protocols
1delta
Uniswap v2 likes
Uniswap v3 likes
- __init__(strategy_universe, data_delay_tolerance=Timedelta('2 days 00:00:00'))#
Initialise pair configuration.
- Parameters:
strategy_universe (TradingStrategyUniverse) –
The initial strategy universe.
TODO: Currently only reserve currency, exchange and pair data is used. Candle data is discarded.
Methods
__init__
(strategy_universe[, ...])Initialise pair configuration.
create_config
(routing_id)Create a protocol configuraiton
get_config
(router)Get cached config for a specific protocol.
get_pricing
(pair)Get pricing model for a pair.
get_routing
(pair)Get routing model for a pair.
Create supported routing options based on the loaded trading universe.
get_valuation
(pair)Get valuation model for a pair.
match_router
(pair)Map a trading pair to a supported protocol.
Attributes
- get_supported_routers()[source]#
Create supported routing options based on the loaded trading universe.
- Returns:
List of protocols we can handle in this trading universe
- Return type:
Set[ProtocolRoutingId]
- create_config(routing_id)[source]#
Create a protocol configuraiton
Initialise pricing, valuation and router models for a particular protocol
Called only once per process life cycle, created models are cached
- Parameters:
routing_id (ProtocolRoutingId) – The protocol we are initialising
- match_router(pair)[source]#
Map a trading pair to a supported protocol.
- Parameters:
pair (TradingPairIdentifier) –
The trading pair.
For spot, return uniswap-v2 or uniswap-v3 routing id.
For leverage, return 1delta routing id.
- Raises:
UnroutableTrade – In the case we do not have exchange data loaded in the trading universe to route the pair.
- Return type:
ProtocolRoutingId