starquant是基于掘金量化系统进行开发的量化交易框架,支持本地部署,支持断点回测,
支持自定义交易策略,选股数据及交易数据本地存贮及本地自定义统计。
-
支持的系统版本:Windows 10
-
支持的Python版本: python 3.8 及以上版本
-
掘金客户端:v3.16
-
掘金API版本:3.0.159 (pip install gm==3.0.159)
-
Mysql: v5.0.96
- 必要库安装:
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/
-
修改配置文件
配置文件路径:\starquant\quant\config.ini
[TOKEN]
##掘金token
gmtoken = xxxxxx
[ACCOUNT]
##绑定帐号的交易策略id
strategy_id= 71878222-a222-222-2222-5811220c517b
##绑定帐号的交易策略id
backtest_strategy_id= 71878222-a222-222-2222-5811220c517b
##指定连接数据库信息
[DATABASE]
tradedb = mysql+mysqlconnector://root:111111@localhost:3306/starquant
##掘金客户端安装路径
[GOLDMINER]
path =D:\Goldminer3\Hongshu Goldminer3\goldminer3.exe
- 数据库创建
-
创建名称为starquantdb的空mysql数据库
-
运行脚本数据库表:
mysql -uroot -p111111 stockdb < /iqunat/data/iquantdb.sql
-
修改setting表中,帐号ID字段值为你掘金创建的模拟交易帐号ID
-
交易标的股票代码设置:
修改代码文件 starquant\quant\quantengine.py 可添加交易标的股票代码
-
回测入口
运行
python starquant\quant\startengine_bt.py
- 实盘交易入口
运行
python starquant\quant\startengine_live.py