ricequant / rqalpha

A extendable, replaceable Python algorithmic backtest && trading framework supporting multiple securities
http://rqalpha.io
Other
5.39k stars 1.62k forks source link

Notebook下重复运行策略 #164

Closed zzeric closed 7 years ago

zzeric commented 7 years ago

Notebook下运行策略,第一次运行是正常的,后面第n次运行,会有n个线程重复运行策略

1. RQAlpha的版本

2.27

2. Python的版本

3.6

3. 是Windows/Linux/MacOS or others?

windows

4. 您出现问题对应的源码/或者能复现问题的简易代码 以及对应的配置

%load_ext rqalpha
%%rqalpha -s 20160101 -e 20170505 -sc 100000 -st stock -p -bm 000001.XSHG

def init(context):
    scheduler.run_monthly(pick_stocks,tradingday = 1,time_rule = market_open(0,1))

def pick_stocks(context,bar_dict):
    print("pick_stocks")

5. 您出现的错误堆栈日志信息

这是第2次运行时的日志输出 2016-01-04 15:00:00 INFO pick_stocks 2016-01-04 15:00:00 INFO pick_stocks 2016-02-01 15:00:00 INFO pick_stocks 2016-02-01 15:00:00 INFO pick_stocks 2016-03-01 15:00:00 INFO pick_stocks 2016-03-01 15:00:00 INFO pick_stocks

cedricporter commented 7 years ago

这个是 log handlers 注册多次的问题,develop分支 已经修复了,下次发布 master 会解决