EthereumPairConfigurator#

API documentation for tradeexecutor.ethereum.ethereum_protocol_adapters.EthereumPairConfigurator Python class in Trading Strategy framework.

class EthereumPairConfigurator[source]#

Bases: PairConfigurator

Set up routes for EVM trading pairs.

Supported protocols

  • 1delta

  • Uniswap v2 likes

  • Uniswap v3 likes

  • Aave v3

__init__(web3, strategy_universe)[source]#

Initialise pair configuration.

Parameters:
  • web3 (Web3) – Web3 connection to the active blockchain.

  • strategy_universe (TradingStrategyUniverse) –

    The initial strategy universe.

    TODO: Currently only reserve currency, exchange and pair data is used. Candle data is discarded.

Methods

__init__(web3, 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.

get_supported_routers()

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

__init__(web3, strategy_universe)[source]#

Initialise pair configuration.

Parameters:
  • web3 (Web3) – Web3 connection to the active blockchain.

  • strategy_universe (TradingStrategyUniverse) –

    The initial strategy universe.

    TODO: Currently only reserve currency, exchange and pair data is used. Candle data is discarded.

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

Return type:

ProtocolRoutingConfig

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