本文整理汇总了Python中simulation.Simulation.simulate_all_stocks方法的典型用法代码示例。如果您正苦于以下问题:Python Simulation.simulate_all_stocks方法的具体用法?Python Simulation.simulate_all_stocks怎么用?Python Simulation.simulate_all_stocks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulation.Simulation
的用法示例。
在下文中一共展示了Simulation.simulate_all_stocks方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DataToStock
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import simulate_all_stocks [as 别名]
from estrangement_entry import EstrangementEntry
from estrangement_exit import EstrangementExit
from stop_out_exit import StopOutExit
from average_true_range_stop import AverageTrueRangeStop
from moving_average_direction_filter import MovingAverageDirectionFilter
from recorder import Recorder
from simulation import Simulation
data_dir = os.getcwd()+'/../data/'
dbname = 'daily_stock_data.db'
data = DataToStock(data_dir, dbname)
estrangement_system = TradingSystem({'entries':EstrangementEntry({'span':20, 'rate':5}),
'exits':[StopOutExit(), EstrangementExit({'span':20, 'rate':3.5})], # stop_out_exitは最後につける(損切りの手仕舞いだから)
'stops':AverageTrueRangeStop({'span':20}),
'filters':MovingAverageDirectionFilter({'span':30})
})
recorder = Recorder()
recorder.record_dir = 'result/estrangement/test_simulation'
simulation = \
Simulation({'trading_system':estrangement_system,
'data_loader': data,
'recorder':recorder})
recorder.create_record_folder()
#simulation.simulate_a_stock(8604) # code.csv
simulation.simulate_all_stocks(os.getcwd()+'/../data/test_stock.csv') # _stats_for_each_stock.csv