{"id":15033578,"url":"https://github.com/sngyai/sequoia","last_synced_at":"2025-04-11T06:24:43.032Z","repository":{"id":38359425,"uuid":"141734943","full_name":"sngyai/Sequoia","owner":"sngyai","description":"A股自动选股程序，实现了海龟交易法则、缠中说禅牛市买点，以及其他若干种技术形态","archived":false,"fork":false,"pushed_at":"2024-08-14T09:52:48.000Z","size":22095,"stargazers_count":2620,"open_issues_count":15,"forks_count":655,"subscribers_count":74,"default_branch":"master","last_synced_at":"2025-04-03T20:08:01.838Z","etag":null,"topics":["a-shares","akshare","dataframe","pandas","python","ta-lib","turtle-trade","tushare"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sngyai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-20T16:33:48.000Z","updated_at":"2025-04-03T12:07:05.000Z","dependencies_parsed_at":"2022-08-14T11:50:09.245Z","dependency_job_id":"f2ee7bc1-3ce9-44c2-a02c-58e65290b7fe","html_url":"https://github.com/sngyai/Sequoia","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sngyai%2FSequoia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sngyai%2FSequoia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sngyai%2FSequoia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sngyai%2FSequoia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sngyai","download_url":"https://codeload.github.com/sngyai/Sequoia/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248353046,"owners_count":21089546,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a-shares","akshare","dataframe","pandas","python","ta-lib","turtle-trade","tushare"],"created_at":"2024-09-24T20:21:49.109Z","updated_at":"2025-04-11T06:24:42.996Z","avatar_url":"https://github.com/sngyai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Sequoia选股系统\n### 简介\n本程序使用[AKShare接口](https://github.com/akfamily/akshare)，从东方财富获取数据。\n\n本程序实现了若干种选股策略，大家可以自行选择其中的一到多种策略组合使用，参见[work_flow.py](https://github.com/sngyai/Sequoia/blob/master/work_flow.py#L28-L38)，也可以实现自己的策略。\n\n各策略中的`end_date`参数主要用于回测。\n\n## 准备工作:\n###  环境\u0026依赖管理\n推荐使用 Miniconda来进行 Python 环境管理 [Miniconda — conda documentation](https://docs.conda.io/en/latest/miniconda.html)\n\n安装 conda 后，切换到项目专属环境进行配置，例如：\n```\nconda create -n sequoia39 python=3.9\nconda activate sequoia39\n```\n\n ### 根据不同的平台安装TA-Lib程序\n\n* Mac OS X  (x86_64)\n\n    ```  \n    $ brew install ta-lib    \n    # conda 环境下 可直接执行\n    $ conda install -c conda-forge ta-lib\n    ``` \n\n* Mac OS X (arm64)\n\n    需要特殊说明的是\n    M1 芯片的 Mac OS 很多库和依赖都需要基于 arm64 来构建。\n    所以，这里首先需要确认安装的 homebrew 是 arm 版本，如果之前安装的 homebrew 是 x86 版本，推荐重装 homebrew。\n  1. 删除老版本 homebrew （如果之前安装的是 x86版本 homebrew，重装前需要删除）\n    ```\n      sudo rm -rf /usr/local/.git\n      rm -rf ~/Library/Caches/Homebrew\n      rm -rf /usr/local/Homebrew \n    ```\n\n  2. 安装/重装 arm64 版本 homebrew\n    ```\n    /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"\n    ```\n\n   3. homebrew 初始化\n    ```\n    vim ~/.zshrc\n    \n    # 加入到系统环境变量\n    export PATH=/opt/homebrew/bin:$PATH\n    \n    source ~/.zshrc\n    # 确认版本信息\n    brew config \n    ```\n  4. 过程中遇到问题的参考解决办法\n  - [macos - zsh problem: compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew - Stack Overflow](https://stackoverflow.com/questions/65747286/zsh-problem-compinit503-no-such-file-or-directory-usr-local-share-zsh-site)\n  - [The required file \"libmini_racer.dylib\" can't be found in mac M1 · Issue #143 · sqreen/PyMiniRacer](https://github.com/sqreen/PyMiniRacer/issues/143)\n  - [Installing python tables on mac with m1 chip - Stack Overflow](https://stackoverflow.com/questions/65839750/installing-python-tables-on-mac-with-m1-chip)\n\n  5. 经过以上步骤后，可以开始继续安装 `ta-lib` 了。 参考\n  - [TA-Lib · PyPI](https://pypi.org/project/TA-Lib/)\n  - [说说 talib(ta-lib) 这个技术指标库，各系统怎么最轻松安装 ta-lib - 知乎](https://zhuanlan.zhihu.com/p/546720500)\n\n  以下是完整的操作命令示例：\n\n    ```\n    # 操作示例\n    # 1. 创建专属 python 环境\n    conda create -n sequoia39 python=3.9\n    conda activate sequoia39\n    \n    # 2. 安装 ta-lib 库\n    arch -arm64 brew install ta-lib\n    export TA_INCLUDE_PATH=\"$(brew --prefix ta-lib)/include\"\n    export TA_LIBRARY_PATH=\"$(brew --prefix ta-lib)/lib\"\n    python3.9 -m pip install --no-cache-dir ta-lib\n    \n    # 3. 验证是否安装成功\n    python -c \"import talib; print(talib.__version__)\"\n    ```\n\n* Windows\n\n    下载 [ta-lib-0.4.0-msvc.zip](http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-msvc.zip)，解压到 ``C:\\ta-lib``\n\n\n\n* Linux\n\n    下载 [ta-lib-0.4.0-src.tar.gz](http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz) :\n    ```\n    $ untar and cd\n    $ ./configure --prefix=/usr\n    $ make\n    $ sudo make install\n    ```\n ### 推荐使用Python3.8以上以及pip3\n ### Python 依赖:\n ```\n pip install -r requirements.txt \n ```\n ### 更新akshare数据接口\n 本项目已切换至akshare数据接口，该项目更新频率较高，使用前建议检查接口更新\n``` \npip install akshare --upgrade\n```\n ### 生成配置文件\n\n```\ncp config.yaml.example config.yaml\n```\n## 运行\n### 本地运行\n```\n$ python main.py\n```\n运行结果查看 logs 目录下生成的日志文件 格式为 `logs/sequoia-$YEAR-$MONTH-$DAY-$HOUR-$MINUTE-$SECOND.log`\n如：`logs/sequoia-2023-03-03-20-47-56.log`\n\n### 服务器端运行\n#### 定时任务\n服务器端运行需要改为定时任务，共有两种方式：\n1. 使用Python schedule定时任务\n   * 将[config.yaml](config.yaml.example)中的`cron`配置改为`true`，`push`.`enable`改为`true`\n\n2. 使用crontab定时任务\n   * 保持[config.yaml](config.yaml.example)中的`cron`配置为***false***，`push`.`enable`为`true`\n   * [安装crontab](https://www.digitalocean.com/community/tutorials/how-to-use-cron-to-automate-tasks-ubuntu-1804)\n   * `crontab -e` 添加如下内容(服务器端安装了miniconda3)：\n   ```bash\n    SHELL=/bin/bash\n    PATH=/usr/bin:/bin:/home/ubuntu/miniconda3/bin/\n    # m h  dom mon dow   command\n    0 3 * * 1-5 source /home/ubuntu/miniconda3/bin/activate python3.10; python3 /home/ubuntu/Sequoia/main.py \u003e\u003e /home/ubuntu/Sequoia/sequoia.log; source /home/ubuntu/miniconda3/bin/deactivate\n   ```\n#### 微信推送\n使用[WxPusher](https://wxpusher.zjiecode.com/docs/#/)实现了微信推送，用户需要自行获取[wxpusher_token](https://wxpusher.zjiecode.com/docs/#/?id=%e8%8e%b7%e5%8f%96apptoken)和[wxpusher_uid](https://wxpusher.zjiecode.com/docs/#/?id=%e8%8e%b7%e5%8f%96uid)，并配置到`config.yaml`中去。\n\n\n## 如何回测\n修改[config.yaml](config.yaml.example)中`end_date`为指定日期，格式为`'YYYY-MM-DD'`，如：\n```\nend = '2019-06-17'\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsngyai%2Fsequoia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsngyai%2Fsequoia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsngyai%2Fsequoia/lists"}