本程序使用AKShare接口,从东方财富获取数据。
本程序实现了若干种选股策略,大家可以自行选择其中的一到多种策略组合使用,参见work_flow.py,也可以实现自己的策略。
各策略中的end_date
参数主要用于回测。
-
Mac OS X
$ brew install ta-lib
-
Windows
下载 ta-lib-0.4.0-msvc.zip,解压到
C:\ta-lib
-
Linux
$ untar and cd $ ./configure --prefix=/usr $ make $ sudo make install
pip install -r requirements.txt
cp config.yaml.example config.yaml
$ python main.py
运行结果查看日志文件sequoia.log
服务器端运行需要改为定时任务,共有两种方式:
-
使用Python schedule定时任务
- 将config.yaml中的
cron
配置改为true
,push
.enable
改为true
- 将config.yaml中的
-
使用crontab定时任务
- 保持config.yaml中的
cron
配置为false,push
.enable
为true
- 安装crontab
crontab -e
添加如下内容(服务器端安装了miniconda3):
SHELL=/bin/bash PATH=/usr/bin:/bin:/home/ubuntu/miniconda3/bin/ # m h dom mon dow command 0 3 * * 1-5 source /home/ubuntu/miniconda3/bin/activate python3.10; python3 /home/ubuntu/Sequoia/main.py >> /home/ubuntu/Sequoia/sequoia.log; source /home/ubuntu/miniconda3/bin/deactivate
- 保持config.yaml中的
使用WxPusher实现了微信推送,用户需要自行获取wxpusher_token和wxpusher_uid,并配置到config.yaml
中去。
修改config.yaml中end_date
为指定日期,格式为'YYYY-MM-DD'
,如:
end = '2019-06-17'