Python-掘金量化level2数据驱动事件示例 可转债数据获取、交易示例 常见的策略结构主要包括3类,如下图所示。 用户可以根据策略需求选择相应的策略结构,具体可以参考经典策略。 以下代码的内容是:在每个交易日的14:50:00 市价买入200股浦发银行股票: 1. # coding=utf-8 2. from __future__ import print_function, absolute_import 3 gm.api import * 4. 5. 定时任务示例 快速开始 - 5 - 本文档使用 掘金量化 构建 6. def init(context): 7. # 每天14:50 定时执行algo任务, 8. # algo执行定时任务函数,只能传context参数 9. # date_rule执行频率,目前暂时支持1d、1w、1m,其中1w、1m仅用于回测,实时模式1d以上的频率,需要在 注意多个定时任务设置同一个时间点,前面的定时任务会被后面的覆盖 11. schedule(schedule_func=algo, date_rule='1d', time_rule='14:50:00') 12. 13. 14. 15. def algo(context): 16. # 以市价购买200股浦发银行股票, price在市价类型不生效 17.1 魔豆 | 142 页 | 2.44 MB | 3 年前3
MATLAB-掘金量化strategy_set.backtest_start_time = '2018-08-01 10:40:00'; 6. strategy_set.backtest_end_time = '2018-08-10 10:50:00'; % 默认最近一 个月 7. strategy_set.backtest_initial_cash = 1000000; strategy_set.backtest_start_time = '2018-08-01 10:40:00'; 6. strategy_set.backtest_end_time = '2018-08-10 10:50:00'; % 默认最近一 个月 7. strategy_set.backtest_initial_cash = 1000000; 实时行情服务连接断开 1300 初始化回测失败,可能是终端未启动或无法连接到终端 1301 回测时间区间错误 1302 回测读取缓存数据错误 1303 回测写入缓存数据错误 错误码 - 50 - 本文档使用 掘金量化 构建1 魔豆 | 50 页 | 1.33 MB | 3 年前3
共 2 条
- 1










