From e58674e8c4608e3855f62ae18fd32bff82f597a5 Mon Sep 17 00:00:00 2001 From: Charmve Date: Sat, 11 May 2024 14:20:44 +0800 Subject: [PATCH] [doc] Add development docs --- .github/workflows/ci-release.yml | 66 +++++++++--------------------- .github/workflows/qbot-release.yml | 7 ++++ .vscode/settings.json | 4 +- CONTRIBUTING.md | 25 +++++++++++ DEVELOPMENT.md | 36 ++++++++++++++++ README.md | 6 ++- investool/README.md | 2 +- monitoring.py | 11 +++-- 8 files changed, 100 insertions(+), 57 deletions(-) create mode 100644 CONTRIBUTING.md create mode 100644 DEVELOPMENT.md diff --git a/.github/workflows/ci-release.yml b/.github/workflows/ci-release.yml index 2ef4d1b..30fa2e1 100644 --- a/.github/workflows/ci-release.yml +++ b/.github/workflows/ci-release.yml @@ -1,20 +1,25 @@ -name: ci-release +name: Qbot-Build-Release on: push: - branches: [main] - paths-ignore: - - "**.md" - - "**.spec.js" + branches: [ master ] + paths-ignore: + - '**/README.md' + - '**/*.yml' - ".idea" - ".vscode" - ".dockerignore" - "Dockerfile" - ".gitignore" - - ".github/**" - "!.github/workflows/qbot-release.yml" tags: - v* + pull_request: + branches: [ master ] + +# env: +# tag_name: v1.0.0 +# release_name: qbot-$tag_name jobs: release: @@ -39,11 +44,6 @@ jobs: draft: true prerelease: true tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - body: | - Changes in this Release - - First Change - - Second Change env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -71,15 +71,10 @@ jobs: path: node_modules key: ${{runner.OS}}-npm-caches-${{ hashFiles('package-lock.json') }} - - name: Setup Go + - name: Set up Go uses: actions/setup-go@v2 with: go-version: 1.18 - - - name: Setup Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - name: Install Dependencies run: | @@ -89,20 +84,17 @@ jobs: cd $GITHUB_WORKSPACE/pyfunds/fund-strategies npm install + - name: Build Release Files run: | pyinstaller -F -w --clean --add-data gui/bkt_result/bkt_result.html:gui/bkt_result/bkt_result.html --add-data gui/imgs/wechat.png:gui/imgs/wechat.png main.py -n qbot --icon=./gui/imgs/logo.ico cd $GITHUB_WORKSPACE/pyfunds/fund-strategies npm run build + cd $GITHUB_WORKSPACE/investool CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-X github.com/axiaoxin-com/investool/version.Version=`TZ=Asia/Shanghai date +'%y%m%d%H%M'`" -o investool_app_mac - if [[ "$(uname)" == "Darwin" ]]; then - sed -i '' 's/env = "localhost"/env = "prod"/' config.toml - else - sed -i "s/env = \"localhost\"/env = \"prod\"/g" config.toml - fi - tar czvf investool_app_mac.tar.gz investool_app_mac config.toml + sed -i "s/env = \"localhost\"/env = \"prod\"/g" config.toml && tar czvf investool_app_mac.tar.gz investool_app_mac config.toml env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -113,13 +105,13 @@ jobs: mv $GITHUB_WORKSPACE/pyfunds/fund-strategies/dist/* package/fund-strategies mv $GITHUB_WORKSPACE/investool/* package/investool mv ./dist/* package/ - tar -zcvf qbot_release_${{ matrix.os }}_v1.tar.gz ./package + tar -zcvf qbot_release_mac_v1.tar.gz ./package - name: Upload Artifact uses: actions/upload-artifact@v3 with: - name: release_on_${{ matrix.os }} - path: qbot_release_${{ matrix.os }}_v1.tar.gz + name: release_on_${{ matrix. os }} + path: qbot_release_mac_v1.tar.gz retention-days: 7 - name: Create Release @@ -140,24 +132,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: qbot_release_${{ matrix.os }}_v1.tar.gz - asset_name: qbot_release_${{ matrix.os }}_v1.tar.gz + asset_path: qbot_release_mac_v1.tar.gz + asset_name: qbot_release_mac_v1.tar.gz asset_content_type: application/gzip - deploy: - environment: - name: fund-strategy-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Setup Pages - uses: actions/configure-pages@v3 - - name: Upload artifact - uses: actions/upload-pages-artifact@v1 - with: - # Upload entire repository - path: 'pyfunds/fund-strategies/dist' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 \ No newline at end of file diff --git a/.github/workflows/qbot-release.yml b/.github/workflows/qbot-release.yml index cfd1b7c..c6ba8bc 100644 --- a/.github/workflows/qbot-release.yml +++ b/.github/workflows/qbot-release.yml @@ -32,6 +32,13 @@ jobs: uses: actions/setup-node@v2 with: node-version: 14 + + - name: Cache Node Dependencies + id: cache + uses: actions/cache@v1 + with: + path: node_modules + key: ${{runner.OS}}-npm-caches-${{ hashFiles('package-lock.json') }} - name: Install Dependencies run: | diff --git a/.vscode/settings.json b/.vscode/settings.json index 3859038..328970a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -25,7 +25,7 @@ "[python]": { "editor.formatOnSave": true, "editor.codeActionsOnSave": { - "source.organizeImports": true + "source.organizeImports": "explicit" } }, "[typescript]": { @@ -55,7 +55,7 @@ "prettier.printWidth": 120, "prettier.singleQuote": true, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true + "source.fixAll.eslint": "explicit" }, "python.languageServer": "Default", "python.linting.pylintEnabled": false, diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..fce472f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,25 @@ +# 欢迎一切帮助Qbot发展的贡献,可以是代码、也可以是产品设计,也可是转发推荐 + + +## 对于开发者 + +我们欢迎相关软件开发同学加入,针对issues、todo和任何建设性的代码提交。 + +开发相关文档: +- 开发前,发现开发需求,[Qbot设计文档](DEVELOPMENT.md); +- 开发中,针对issues区、TODO项或其他feature进程开发; + - 良好的代码风格,``./scripts/format.sh --git`` + - 要是提交了对应的单元测试,会更感谢! +- 开发后,充分的测试,回归测试、单元测试、功能测试。提交MR + + +## 对于产品设计 + +同类产品对比分析 + + +## 对于运营推广 + +微信用户群运营,多平台广宣 + + diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..77f3c6a --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,36 @@ +# 分层设计、事件驱动 + +## 分层设计 + +[数据层](qbot/data/):数据获取抽象封装 + +[策略层](qbot/strategy/):多因子、动量、机器学习、强化学习、深度学习策略 + +[Engine层](qbot/engine/):回测引擎、模拟交易、实盘交易 + +[接口层](qbot/engine/trading/):交易接口封装,包含多平台的模拟和实盘交易 + +[通知层](qbot/notify/):系统监控服务、消息通知(系统弹窗、邮件、飞书、微信、钉钉、企业微信等) + +[分析层](qbot/analyser/):原始数据清洗、股票[指标](qbot/engine/indicator/)、[算子库](qbot/engine/algo/)、评测结果分析 + +[扩展层](qbot/extension/):其他功能插件服务,如[QInvestool](backend/investool/)、[fund-strategies 基金分析工具](backend/fund-strategies/)、[股票基金管家](frontend/web-extension)等 + +> [!NOTE] (Charmve): +> 接口层和Engine层会考虑重新调整。 + +## 前后端分离 + +1. 前端主要是客户端显示和分析评测工具web网页 + +2. 后端插件服务:主要是股票、基金分析工具作为后台引入qbot客户端 +- [fund-strategies 基金分析工具](backend/fund-strategies/) - 基金分析、基金评测、4433基金选择、策略评测 +- [QInvestool](backend/investool/) - 基金、股票评测,选股,因子挖掘 +- 浏览器插件:[股票基金管家](frontend/web-extension) + +## 开发语言 + +整个Qbot开发语言主要是Python,基于wxPython gui框架搭建而成。另外,后台插件服务QInvestool采用go语言开发、fund-strategies 基金分析工具和股票基金管家浏览器插件采用JavaScript开发. + +- WXPython 开发手册 https://wizardforcel.gitbooks.io/wxpy-in-action/content/6.html +- \ No newline at end of file diff --git a/README.md b/README.md index c17158d..251e4e9 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,8 @@ pip install -r requirements.txt python main.py #if run on Mac, please use 'pythonw main.py' ``` +> 基于wxPython 开发的上位机GUI, 需要安装 wxPython python 依赖包, ``pip instal wxPython``, 详细参考: https://realpython.com/python-gui-with-wxpython/ +

demo @@ -174,7 +176,7 @@ export BLOSC_DIR=/opt/homebrew/opt/c-blosc ### Installation -[Install Guide](./docs/01-新手指引/Install_guide.md) | [Online documents](https://ufund-me.github.io/Qbot/#/) +[Install Guide](./docs/01-新手指引/Install_guide.md) | [Online documents](https://ufund-me.github.io/Qbot/#/) | [开发文档](DEVELOPMENT.md) ``` ____________________________________ @@ -514,7 +516,7 @@ A股回测 KDJ+MACD 策略: ## Contributing -We appreciate all contributions to improve Qbot. Please refer to [CONTRIBUTING.md](.github/CONTRIBUTING.md) for the contributing guideline. +We appreciate all contributions to improve Qbot. Please refer to [CONTRIBUTING.md](CONTRIBUTING.md) for the contributing guideline. ## 🍮 Community - Github discussions 💬 or issues 💭 diff --git a/investool/README.md b/investool/README.md index 29bc3c7..00e1d3e 100644 --- a/investool/README.md +++ b/investool/README.md @@ -338,7 +338,7 @@ OPTIONS: ./investool webserver ``` -可通过 `---config` 指定配置文件,默认读取当前目录下的 `./config.toml` +可通过 `--config` 指定配置文件,默认读取当前目录下的 `./config.toml` 随着时间的推移,从中报发布结束开始,满足默认筛选条件的公司会越来越多,筛选并检测的耗时也会逐渐增加,服务部署时反向代理的超时时间需调大。 diff --git a/monitoring.py b/monitoring.py index 6145d10..0a5d1a2 100644 --- a/monitoring.py +++ b/monitoring.py @@ -2,12 +2,11 @@ # 1000元实盘练习程序 # 服务器端监控程序 - import numpy as np import pandas as pd # import akshare as ak import efinance as ef -import run +# import run import kline import backtest from utils.send_email import send_email @@ -20,7 +19,7 @@ # 检测k线有无method所定义的形态 -@run.change_dir +# @run.change_dir def test(codes, method): # print("检测k线形态") results = {} @@ -69,7 +68,7 @@ def getPosition(codes): # 获取股票60分钟线数据 -@run.change_dir +# @run.change_dir def getRecentData(codes, refresh = False, savePath = "./data2/"): if refresh == True: for code in codes: @@ -81,7 +80,7 @@ def getRecentData(codes, refresh = False, savePath = "./data2/"): # 出现卖出形态,向指定邮箱发送警告邮件 -@run.change_dir +# @run.change_dir def report(date, name, code): # print("测试", code) filename = "./data2/" + code[2:] + ".csv" @@ -103,7 +102,7 @@ def report(date, name, code): # 进行一次检测 -@run.change_dir +# @run.change_dir def task(codes): getRecentData(codes = codes, refresh = True, savePath = "./data2/") getPosition(codes)