from systems.forecast_combine import ForecastCombine ## defaults combiner = ForecastCombine() my_system = System([fcs, my_rules, combiner], data, my_config) print(my_system.combForecast.get_forecast_weights("EDOLLAR").tail(5)) print(my_system.combForecast.get_forecast_diversification_multiplier("EDOLLAR").tail(5)) ## estimates: from systems.account import Account my_account = Account() combiner = ForecastCombine() 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)
from systems.forecast_combine import ForecastCombine # defaults combiner = ForecastCombine() my_system = System([fcs, my_rules, combiner], data, my_config) print(my_system.combForecast.get_forecast_weights("EDOLLAR").tail(5)) print( my_system.combForecast.get_forecast_diversification_multiplier( "EDOLLAR").tail(5)) # estimates: from systems.account import Account my_account = Account() combiner = ForecastCombine() 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)
from systems.account import Account from systems.forecast_combine import ForecastCombine from systems.forecast_scale_cap import ForecastScaleCap from systems.basesystem import System from sysdata.csvdata import csvFuturesData from systems.forecasting import Rules from systems.forecasting import TradingRule data = csvFuturesData() my_config = Config() ewmac_8 = TradingRule((ewmac, [], dict(Lfast=8, Lslow=32))) ewmac_32 = TradingRule(dict(function=ewmac, other_args=dict(Lfast=32, Lslow=128))) my_rules = Rules(dict(ewmac8=ewmac_8, ewmac32=ewmac_32)) my_config.trading_rules = dict(ewmac8=ewmac_8, ewmac32=ewmac_32) #my_config.instruments=[ "US20", "NASDAQ", "SP500"] my_config.instruments=[ "SP500"] my_config.forecast_weight_estimate=dict(method="bootstrap") my_config.forecast_weight_estimate['monte_runs']=50 my_config.use_forecast_weight_estimates=True my_system = System([Account(), ForecastScaleCap(), my_rules, ForecastCombine()], data, my_config) logging.debug(my_system.combForecast.get_forecast_weights("SP500").tail(5)) # DEBUG:root: ewmac32 ewmac8 # 2015-12-07 0.632792 0.367208 # 2015-12-08 0.632930 0.367070 # 2015-12-09 0.633066 0.366934 # 2015-12-10 0.633201 0.366799 # 2015-12-11 0.633335 0.366665