QSTraderRunner#

tradeexecutor.strategy.qstrader.runner.QSTraderRunner class.

class QSTraderRunner[source]#

Bases: StrategyRunner

A live trading executor for QSTrade based algorithm.

Warning

This is legacy alpha code and will be deprecated.

__init__(*args, alpha_model, max_data_age=None, cash_buffer=0.05, **kwargs)[source]#
Parameters
  • alpha_model (AlphaModel) –

  • timed_task_context_manager

  • max_data_age (Optional[timedelta]) – Allow to unit test on old datasets

Methods

__init__(*args, alpha_model[, max_data_age, ...])

param alpha_model

check_position_triggers(clock, state, ...)

Check stop loss/take profit for positions.

on_clock(clock, executor_universe, ...)

Run one strategy cycle.

on_data_signal()

pretick_check(ts, universe)

Check the data looks more or less sane.

report_after_execution(clock, universe, ...)

report_after_sync_and_revaluation(clock, ...)

report_before_execution(clock, universe, ...)

report_strategy_thinking(clock, universe, ...)

Report alpha model status.

revalue_portfolio(ts, state, valuation_method)

Revalue portfolio based on the data.

setup_routing(universe)

Setups routing state for this cycle.

sync_portfolio(ts, universe, state, ...)

Adjust portfolio balances based on the external events.

tick(clock, universe, state, debug_details)

Perform the strategy main tick.

__init__(*args, alpha_model, max_data_age=None, cash_buffer=0.05, **kwargs)[source]#
Parameters
  • alpha_model (AlphaModel) –

  • timed_task_context_manager

  • max_data_age (Optional[timedelta]) – Allow to unit test on old datasets

report_strategy_thinking(clock, universe, state, trades, debug_details)[source]#

Report alpha model status.

Parameters
on_clock(clock, executor_universe, pricing_model, state, debug_details)[source]#

Run one strategy cycle.

  • Takes universe, pricing model and state as an input

  • Generates a list of new trades to change the current state

Parameters
Return type

List[TradeExecution]

pretick_check(ts, universe)[source]#

Check the data looks more or less sane.

Parameters