Skip to content

gaelthas/Sequoia

 
 

Repository files navigation

Sequoia选股系统

简介

本程序使用AKShare接口,从东方财富获取数据。

本程序实现了若干种选股策略,大家可以自行选择其中的一到多种策略组合使用,参见work_flow.py,也可以实现自己的策略。

各策略中的end_date参数主要用于回测。

准备工作:

环境&依赖管理

推荐使用 Miniconda来进行 Python 环境管理 Miniconda — conda documentation

安装 conda 后,切换到项目专属环境进行配置,例如:

conda create -n sequoia39 python=3.9
conda activate sequoia39

根据不同的平台安装TA-Lib程序

推荐使用Python3.8以上以及pip3

Python 依赖:

pip install -r requirements.txt 

更新akshare数据接口

本项目已切换至akshare数据接口,该项目更新频率较高,使用前建议检查接口更新

pip install akshare --upgrade

生成配置文件

cp config.yaml.example config.yaml

运行

本地运行

$ python main.py

运行结果查看 logs 目录下生成的日志文件 格式为 logs/sequoia-$YEAR-$MONTH-$DAY-$HOUR-$MINUTE-$SECOND.log 如:logs/sequoia-2023-03-03-20-47-56.log

服务器端运行

定时任务

服务器端运行需要改为定时任务,共有两种方式:

  1. 使用Python schedule定时任务

    • config.yaml中的cron配置改为truepush.enable改为true
  2. 使用crontab定时任务

    • 保持config.yaml中的cron配置为falsepush.enabletrue
    • 安装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

微信推送

使用WxPusher实现了微信推送,用户需要自行获取wxpusher_tokenwxpusher_uid,并配置到config.yaml中去。

如何回测

修改config.yamlend_date为指定日期,格式为'YYYY-MM-DD',如:

end = '2019-06-17'

About

A股自动选股程序,实现了海龟交易法则、缠中说禅牛市买点,以及其他若干种技术形态

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%