TradeDecider#

API documentation for tradeexecutor.strategy.pandas_trader.trade_decision.TradeDecider Python class in Trading Strategy framework.

class TradeDecider[source]#

Bases: Protocol

A callable that decides on new trades for every cycle.

This class provides callable type hinting. Called for each cycle and returns new trades to be executed.

Can be given inline or is a function called decide_trades in a strategy module.

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

__call__(*, timestamp, universe, state, pricing_model, cycle_debug_data)[source]#
Parameters:
  • ignore – See https://www.python.org/dev/peps/pep-3102/

  • timestamp (Timestamp) – The current cycle timestamp. This is the timestamp of the last candle opening time.

  • universe (Universe) – The current trading universe. All pairs, exchanges, etc.

  • state (State) – The current state of the trade execution. All open positions, past trades.

  • pricing_model (PricingModel) – Pricing model can tell the buy/sell price of the particular asset at a particular moment.

  • cycle_debug_data (Dict) – Random debug and diagnostics information about the current execution cycle as Python dictionary.

Returns:

New trades to be executed on this cycle. These must be added as the part of the state, usually using tradeexecutor.strategy.pandas_trader.PositionManager.

Return type:

List[TradeExecution]

__init__(*args, **kwargs)#