'ignore_eqty_with_negative_ma_slope_period': 5, # Slope lookback filter = MA-MA[-slope_lookback] <= 0 # Ignoring all swarm members when the change of AvgSwarm equity is negative 'ignore_if_avg_swarm_negative_change': True, # Comment the line to turn off 'ignore_if_avg_swarm_negative_change_period': 14, # AvgSwarm change period }, 'rebalance_time_function': SwarmRebalance.every_monday, 'global_filter_function': SwarmFilter.swingpoint_threshold, 'global_filter_params': { 'up_factor': 10.0, 'down_factor': 10.0, 'period': 5, }, }, 'costs': { 'manager': CostsManagerEXOFixed, 'context': { 'costs_options': 3.0, 'costs_futures': 3.0, } } } swarm_manager = SwarmManager(STRATEGY_CONTEXT) swarm_manager.run_swarm() picked_swarm = swarm_manager.pick() picked_swarm
from strategies.strategy_swingpoint import StrategySwingPoint from strategies.strategy_macross_with_trail import StrategyMACrossTrail try: from .settings import * except SystemError: from settings import * if __name__ == '__main__': for f in os.listdir(sys.argv[1]): if 'strategy_' not in f: continue exo_name = os.path.join(sys.argv[1], f) print("Processing " + exo_name) for name, swarm_context in BATCH_CONTEXT.items(): print("Running swarm " + name) strategy_context = STRATEGY_CONTEXT_COMMON.copy() strategy_context.update(swarm_context) strategy_context['strategy']['exo_name'] = exo_name strategy_context['strategy']['suffix'] = name smgr = SwarmManager(strategy_context) smgr.run_swarm() smgr.pick() # Saving results to swarms directory smgr.save('./swarms/') print('Done')