TradingStrategyUniverse#

tradeexecutor.strategy.trading_strategy_universe.TradingStrategyUniverse class.

class TradingStrategyUniverse[source]#

Bases: StrategyExecutionUniverse

A trading executor trading universe that using data from TradingStrategy.ai data feeds.

__init__(reserve_assets, universe=None, backtest_stop_loss_time_bucket=None, backtest_stop_loss_candles=None)#
Parameters
Return type

None

Methods

__init__(reserve_assets[, universe, ...])

create_limited_pair_universe(dataset, ...[, ...])

Filters down the dataset for couple trading pair.

create_single_pair_universe(dataset, ...)

Filters down the dataset for a single trading pair.

get_pair_by_address(address)

Get a trading pair data by a smart contract address.

validate()

Check that the created universe looks good.

Attributes

backtest_stop_loss_candles

backtest_stop_loss_time_bucket

universe

Trading universe datasets

universe: Optional[Universe] = None#

Trading universe datasets

validate()[source]#

Check that the created universe looks good.

Raises

TradingUniverseIssue – In the case of detected issues

static create_single_pair_universe(dataset, chain_id, exchange_slug, base_token, quote_token)[source]#

Filters down the dataset for a single trading pair.

This is ideal for strategies that only want to trade a single pair.

Parameters
  • reserve_currency – If set use this as a reserve currency, otherwise use quote_token.

  • dataset (Dataset) –

  • chain_id (ChainId) –

  • exchange_slug (str) –

  • base_token (str) –

  • quote_token (str) –

Return type

TradingStrategyUniverse

static create_limited_pair_universe(dataset, chain_id, exchange_slug, pairs, reserve_asset_pair_ticker=None)[source]#

Filters down the dataset for couple trading pair.

This is ideal for strategies that only want to trade few pairs, or a single pair using three-way trading on a single exchange.

The university reserve currency is set to the quote token of the first pair.

Parameters
  • pairs (Set[Tuple[str, str]]) – List of trading pairs as ticket tuples. E.g. [ (“WBNB, “BUSD”), (“Cake”, “WBNB”) ]

  • reserve_asset_pair_ticker (Optional[Tuple[str, str]]) – Choose the quote token of this trading pair as a reserve asset. This must be given if there are several pairs (Python set order is unstable).

  • dataset (Dataset) –

  • chain_id (ChainId) –

  • exchange_slug (str) –

Return type

TradingStrategyUniverse

get_pair_by_address(address)[source]#

Get a trading pair data by a smart contract address.

Parameters

address (str) –

Return type

Optional[TradingPairIdentifier]

__init__(reserve_assets, universe=None, backtest_stop_loss_time_bucket=None, backtest_stop_loss_candles=None)#
Parameters
Return type

None