format_signals#

API documentation for tradeexecutor.strategy.alpha_model.format_signals Python function.

format_signals(alpha_model, signal_type='chosen', column_mode='spot', sort_key='Signal')[source]#

Debug helper used to develop the strategy.

Print the signal state to the logging output.

Example:

from tradeexecutor.strategy.alpha_model import format_signals

alpha_model = state.visualisation.discardable_data["alpha_model"]

print("Chossen signals")
df = format_signals(alpha_model)
display(df)

print("All signals")
df = format_signals(alpha_model, signal_type="all")
display(df)
Parameters:
  • signal_type (Literal['chosen', 'raw']) – Show raw signals or only signals that survived filtering.

  • column_mode (Literal['spot', 'leveraged']) – What columns include in the resulting table

  • alpha_model (AlphaModel) –

Returns:

DataFrame containing a table for signals on this cycle

Return type:

DataFrame