Skip to content

Commit

Permalink
[doc] Add development docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Charmve committed May 11, 2024
1 parent 6906a82 commit e58674e
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 57 deletions.
66 changes: 20 additions & 46 deletions .github/workflows/ci-release.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 }}

Expand Down Expand Up @@ -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: |
Expand All @@ -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 }}

Expand All @@ -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
Expand All @@ -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
7 changes: 7 additions & 0 deletions .github/workflows/qbot-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"[python]": {
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
"source.organizeImports": "explicit"
}
},
"[typescript]": {
Expand Down Expand Up @@ -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,
Expand Down
25 changes: 25 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 欢迎一切帮助Qbot发展的贡献,可以是代码、也可以是产品设计,也可是转发推荐


## 对于开发者

我们欢迎相关软件开发同学加入,针对issues、todo和任何建设性的代码提交。

开发相关文档:
- 开发前,发现开发需求,[Qbot设计文档](DEVELOPMENT.md)
- 开发中,针对issues区、TODO项或其他feature进程开发;
- 良好的代码风格,``./scripts/format.sh --git``
- 要是提交了对应的单元测试,会更感谢!
- 开发后,充分的测试,回归测试、单元测试、功能测试。提交MR


## 对于产品设计

同类产品对比分析


## 对于运营推广

微信用户群运营,多平台广宣


36 changes: 36 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -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
-
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
<p id="demo">
<!-- <img width="" alt="demo" src="https://user-images.githubusercontent.com/29084184/221901048-bb1615fe-674f-40e8-b1e7-ba5db30a82a6.png"> -->
<img width="" alt="demo" src="https://user-images.githubusercontent.com/29084184/223608757-5808e23c-86e4-4b1b-8b03-e04c8f368f5c.gif">
Expand Down Expand Up @@ -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)

```
____________________________________
Expand Down Expand Up @@ -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 <a href="https://github.com/UFund-Me/Qbot/discussions" target="_blank">discussions 💬</a> or <a href="https://github.com/UFund-Me/Qbot/issues" target="_blank">issues 💭</a>
Expand Down
2 changes: 1 addition & 1 deletion investool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ OPTIONS:
./investool webserver
```

可通过 `---config` 指定配置文件,默认读取当前目录下的 `./config.toml`
可通过 `--config` 指定配置文件,默认读取当前目录下的 `./config.toml`

随着时间的推移,从中报发布结束开始,满足默认筛选条件的公司会越来越多,筛选并检测的耗时也会逐渐增加,服务部署时反向代理的超时时间需调大。

Expand Down
11 changes: 5 additions & 6 deletions monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,7 +19,7 @@


# 检测k线有无method所定义的形态
@run.change_dir
# @run.change_dir
def test(codes, method):
# print("检测k线形态")
results = {}
Expand Down Expand Up @@ -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:
Expand All @@ -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"
Expand All @@ -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)
Expand Down

0 comments on commit e58674e

Please sign in to comment.