def get_SR_bars_for_rule(rulename, trading_rule_dict, pos_sizing_class): config = Config(dict(trading_rules=trading_rule_dict, Xfactor=get_x_for_rulename(rulename), percentage_vol_target=16.0)) data = csvFuturesSimData() config.forecast_weights = dict([(rulename, 1.0) for notUsed in [1]]) system = System([ Account(), Portfolios(), pos_sizing_class(), FuturesRawData(), ForecastCombine(), ForecastScaleCap(), Rules() ], data, config) system.set_logging_level("on") curve = get_curvestack_for_rule(system) return SR_error_bars_from_stacked(curve)
my_config.forecast_weight_estimate = dict(method="one_period") my_config.use_forecast_weight_estimates = True my_config.use_forecast_div_mult_estimates = True my_system = System([my_account, fcs, my_rules, combiner], data, my_config) # this is a bit slow, better to know what's going on my_system.set_logging_level("on") print(my_system.combForecast.get_forecast_weights("US10").tail(5)) print( my_system.combForecast.get_forecast_diversification_multiplier( "US10").tail(5)) # fixed: my_config.forecast_weights = dict(ewmac8=0.5, ewmac32=0.5) my_config.forecast_div_multiplier = 1.1 my_config.use_forecast_weight_estimates = False my_config.use_forecast_div_mult_estimates = False combiner = ForecastCombine() my_system = System([fcs, empty_rules, combiner], data, my_config) # no need for accounts if no estimation done my_system.combForecast.get_combined_forecast("EDOLLAR").tail(5) # size positions from systems.positionsizing import PositionSizing possizer = PositionSizing() my_config.percentage_vol_target = 25 my_config.notional_trading_capital = 500000
my_config.forecast_weight_estimate=dict(method="one_period") my_config.use_forecast_weight_estimates=True my_system = System([my_account, fcs, my_rules, combiner], data, my_config) ## this is a bit slow, better to know what's going on my_system.set_logging_level("on") print(my_system.combForecast.get_forecast_weights("EDOLLAR").tail(5)) print(my_system.combForecast.get_forecast_diversification_multiplier("EDOLLAR").tail(5)) ## fixed: my_config.forecast_weights = dict(ewmac8=0.5, ewmac32=0.5) my_config.forecast_div_multiplier = 1.1 my_config.use_forecast_weight_estimates=False combiner = ForecastCombine() my_system = System([fcs, empty_rules, combiner], data, my_config) my_system.combForecast.get_combined_forecast("EDOLLAR").tail(5) # size positions from systems.positionsizing import PositionSizing possizer = PositionSizing() my_config.percentage_vol_target = 25 my_config.notional_trading_capital = 500000 my_config.base_currency = "GBP"