post_process_trade_decision#

API documentation for tradeexecutor.strategy.runner.post_process_trade_decision Python function.

post_process_trade_decision(state, execution_context, trades, max_price_impact=None)[source]#

Set any extra flags and do extra checks on trades.

  • Called before trades are send to the execution

  • Mainly to deal with the fact that if trades close a final position on lending

Parameters:
  • max_price_impact (float | None) –

    What is the allowed maximum price impact of a single trade.

    Trades must have their trade.price_structure data filled to detect.

  • state (State) –

  • execution_context (ExecutionContext) –

  • trades (List[TradeExecution]) –

Raises:

PriceImpactToleranceExceeded – If any of the trades is detected to have too much price impact.