InitialRiskStatsFactory

class qf_lib.backtesting.fast_alpha_model_tester.initial_risk_stats.InitialRiskStatsFactory(max_accepted_dd: float, target_return: float)[source]

Bases: object

Methods:

make_stats(initial_risks, scenarios_list)

Creates a pandas.DataFrame showing how many strategies failed (reached certain draw down level) and how many of them succeeded (that is: reached the target return and not failed on the way).

make_stats(initial_risks: Sequence[float], scenarios_list: Sequence[QFDataFrame]) QFDataFrame[source]

Creates a pandas.DataFrame showing how many strategies failed (reached certain draw down level) and how many of them succeeded (that is: reached the target return and not failed on the way).

Parameters:
  • initial_risks (Sequence[float]) – list of initial_risk parameters where initial_risk is a float number

  • scenarios_list (Sequence[pandas.DataFrame]) – list with scenarios (QFDataFrame) where each DataFrame corresponds to one initial_risk value Each DataFrame has columns corresponding to different scenarios and its indexed by Trades’ ordinal number. Its values are returns of Trades.

Returns:

DataFrame indexed with initial_risk values and with columns FAILED (fraction of scenarios that failed) and SUCCEEDED (fraction of scenarios that met the objective and didn’t fail on the way)

Return type:

pandas.DataFrame