SQuant是使用scala语言编写的量化开发工具箱,提供开箱即用的A股股票数据和外汇数据(docker镜像),以及高效的回测框架与交易模块。方便Java/Scala爱好者进行量化投资研究。 QQ群:281599099,微信公众号:Python量化交易实战。对,我已经转python了。。。
squant主要分成数据服务、回测引擎、交易模块三部分,下面就各个部分实现的主要功能做简要介绍:
数据模块包括数据的采集、清洗,全量和增量更新,以及提供数据访问接口。数据分类包括股票和外汇数据,具体数据类别如下:
注意:数据更新支持全量更新好增量更新,具体操作方式请参考 快速上手
通过继承策略类 com.squant.cheetah.strategy.Strategy 并实现 handle() 函数来开发策略
abstract class Strategy(context: Context, broker: Broker) extends LazyLogging with Broker {
def init()
def handle()
常用策略示例请参考examples目录
TODO
sudo mkdir /data
sudo docker pull registry.cn-hangzhou.aliyuncs.com/eryk/squant:1.1
sudo docker run --name squant -v /data:/data -d registry.cn-hangzhou.aliyuncs.com/eryk/squant:1.1
注意:数据更新任务配置文件点这里
sudo docker exec -t -i **CONTAINER_ID** /bin/bash
cd /home/squant/
java -cp squant-assembly-1.1.jar:conf com.squant.cheetah.Main
squant 1.x
Usage: squant [source|test|run] [options]
-h, --help display this help and exit
Command: source [options]
init or download data source
-t, --type <value> set datasource to be downloaded,
support:
all: all kind of datasource,
basic: stock list with basic info,
category: stock category data,
daily: stock day bar,
finance: Financial Statements,
minute: stock minute bar,include 5/15/30/60 minutes,
moneyflow: stock money flow data,
tick: stock tick data
--init <value> if true,init data from source, default:false
--start <value> format:yyyyMMdd, set download start time
--stop <value> format:yyyyMMdd, set download stop time
--clear <value> if true,clean data dir before download, default:true
Command: test
Command: run
例如:
java -cp squant-assembly-1.1.jar:conf com.squant.cheetah.Main source -t basic --init true
java -cp squant-assembly-1.1.jar:conf com.squant.cheetah.Main source -t daily -init true