translate_trading_pair#

API documentation for tradeexecutor.strategy.trading_strategy_universe.translate_trading_pair Python function.

translate_trading_pair(pair, cache=None)[source]#

Translate trading pair from client download to the trade executor.

Trading Strategy client uses compressed columnar data for pairs and tokens.

Translates a trading pair presentation from Trading Strategy client Pandas format to the trade executor format.

Trade executor work with multiple different strategies, not just Trading Strategy client based. For example, you could have a completely on-chain data based strategy. Thus, Trade Executor has its internal asset format.

This module contains functions to translate asset presentations between Trading Strategy client and Trade Executor.

This is called when a trade is made: this is the moment when trade executor data format must be made available.

Parameters:
  • cache (dict | None) –

    Cache of constructed objects.

    Pair internal id -> TradingPairIdentifier

    See tradingstrategy.state.identifier.AssetIdentifier for life cycle notes.

  • pair (DEXPair) –

Return type:

TradingPairIdentifier