Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhang Wei authored and Charmve committed May 18, 2023
1 parent 174ab24 commit 9f76317
Show file tree
Hide file tree
Showing 178 changed files with 167,872 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Byte-compiled / optimized / DLL files
__pycache__/

*/__pycache__
engine/__pycache__
engine/datafeed/__pycache__

*.py[cod]
*$py.class

**.DS_Store

45 changes: 45 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
load("@rules_python//python:defs.bzl", "py_binary", "py_test")
load("@third_party//:requirements.bzl", "requirement")

# TODO(https://github.com/bazelbuild/bazel-bench/issues/36): Make these work for python3.
py_binary(
name = "qbot",
srcs = ["qbot_main.py"],
deps = [
"//utils",
requirement("wxPython"),
requirement("pandas"),
requirement("matplotlib"),
requirement("backtrader"),
requirement("backtrader_plotting"),
requirement("scipy"),
requirement("statsmodels"),
requirement("quantstats"),
requirement("requests"), # 这是yahoofinance需要
requirement("loguru"), # 简化logger的使用
requirement("binance-connector"),
requirement("numba"), # pandas 多序列rolling需要
requirement("pykalman"),
requirement("tables"),
requirement("scikit-learn"),
requirement("empyrical"),
requirement("stable-baselines3"),
requirement("jupyter"),
requirement("gym[all]"),
requirement("pyglet"),
requirement("tensorboard"),
requirement("tensortrade"),
requirement("yfinance"),
requirement("pandas_datareader"),
],
)

py_test(
name = "qbot_test",
srcs = ["qbot_test.py"],
deps = [
":qbot",
"//testutils",
requirement("mock"),
],
)
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,85 @@
# iQuant

[UFund-Me](https://github.com/UFund-Me),专注将前沿人工智能技术(机器学习、深度学习、强化学习、遗传算法、图计算、知识图谱等)应用于金融量化投资。

金融投资领域是高度信息密集型,而且信息相对结构化,照理讲是最适合机器计算的领域。可是,当前投资仍然处于“刀耕火种”的年代,有人忙于调研,读报表;有人忙于盯盘,画线条。

alphago master登顶围棋之巅都过去五年之久了,算法、算力日新月异的发展,不应该是当前这个样子。

尽管金融数据低“信噪比”,也不要指望打造一台永动机。

但请相信一句话就是:
```
No man is better than a machine, but no machine is better than a man with a machine!
```

让机器辅助我们投资,将无往而不利。

按照个人积极参与主动决策的程度,把投资分成三个层次:
- 全天候大类资产配置。
被动管理,很少参与。在坐好资产后长期持续,只做一些被动再平衡的操作;
- 战术资产配置。
关注宏观层面大的周期,在周期偏好的资产上持有更多的仓位。
- 择时
积极判断市场方向,期望做到“低买高卖”。

这三个层次,从上到下,越来越不确定,越来越难,风险也越来越高。当然如果做好,收益也是越来越大。

建议普通人都从第一层次做起,比较容易做到从理财往投资过渡。

但是很遗憾,大部分人一上手就是冲着第三层次来的,“追涨杀跌”却常常做错方向,最终成为韭菜。

![图片](./images/mainwindow.png)
### 项目说明

传统的量化投资,使用技术指标比如均值,MACD,RSI,KDJ等以及它们的线性变种来产生信号。
有几个缺点:

- 一则这是线性的,

- 二是参数全凭经验,没有调优的过程,

- 三是规则是静态的,无法根据市场变化自主进化。

我们的目标,是把前沿人工智能技术,包括机器学习,深度学习,深度强化学习,知识图谱,时间序列分析等技术应用于金融大数据挖掘,
更好的赋能量化投资。

金融数据的低信噪比,让这件事情变更很难,

难,才有意思。

### “积木式”回测引擎
```
algo_list_rolling = [
SelectFix(instruments=['sh000300', 'sh000905', 'sz399006']),
SelectBySignal(signal_buy='to_buy', signal_sell='to_sell'),
SelectTopK(K=1,col='五日动量'),
WeightEqually()
]
```
### 开发环境与安装部署

python3.7~3.10

直接git或者下载源码包,安装相关依赖,然后运行``qbot_main.py``即可。

```
git clone https://github.com/Charmve/iQuant
cd iQuant
pip install -r requirements.txt
python qbot_main.py
```

### 联系我们

微信:Yida_Zhang2

持续分享前沿**人工智能技术如何赋能金融投资**,并找到一帮志同道合的朋友!

34 changes: 34 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_python",
sha256 = "c03246c11efd49266e8e41e12931090b613e12a59e6f55ba2efd29a7cb8b4258",
strip_prefix = "rules_python-0.11.0",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.11.0.tar.gz",
)

load("@rules_python//python:pip.bzl", "pip_install")
load("@rules_python//python:repositories.bzl", "python_register_toolchains")

# Use a hermetic Python interpreter so that builds are reproducible
# irrespective of the Python version available on the host machine.
python_register_toolchains(
name = "python3_9",
python_version = "3.9",
)

load("@rules_python//python:pip.bzl", pip3_install="pip_install")

pip3_install(
name = "py_deps",
requirements = "//:requirements.txt",
)

load("@python3_9//:defs.bzl", "interpreter")

# Translate requirements.txt into a @third_party external repository.
pip_install(
name = "third_party",
python_interpreter_target = interpreter,
requirements = "//third_party:requirements.txt",
)
Empty file added data/BUILD
Empty file.
Empty file added data/bkt_result/BUILD
Empty file.
55 changes: 55 additions & 0 deletions data/bkt_result/bkt_result.html

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions data/bkt_result/main.html

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions data/bkt_result/main2.html

Large diffs are not rendered by default.

Loading

0 comments on commit 9f76317

Please sign in to comment.