[关闭]
@Channelchan 2018-01-06T15:22:19.000000Z 字数 584 阅读 125116

3. 运行功能

更新bundle数据

进入cmd

rqalpha update_bundle

  1. ## 导入api,初始化与执行引擎。
  2. import rqalpha
  3. from rqalpha.api import *
  4. # context作为全局变量做传递
  5. def init(context):
  6. context.message = 'hello'
  7. #用来写开始的时候做什么
  8. def handle_bar(context, bar_dict):
  9. print (context.message)
  10. #用来写每次循环要作什么
  1. ## config设置
  2. config = {
  3. "base": {
  4. "start_date": "2017-04-21",
  5. "end_date": "2017-05-01",
  6. "accounts": {'stock':1000000},
  7. "stock_starting_cash": 1000000,
  8. "benchmark": "000300.XSHG",
  9. },
  10. "extra": {
  11. "log_level": "error",
  12. },
  13. "mod": {
  14. "sys_analyser": {
  15. "enabled": False,
  16. "plot": False
  17. }
  18. }
  19. }
  20. # 您可以指定您要传递的参数
  21. rqalpha.run_func(init=init, handle_bar=handle_bar, config=config)
hello
hello
hello
hello
hello
hello

{}
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注