<div align="center">
<img alt="FutuAlgo Logo" src="https://raw.githubusercontent.com/billpwchan/futu_algo/master/images/logo.png" width="400px" />
**billpwchan/futu-algo API Reference Documentation**
<a href="https://www.buymeacoffee.com/billpwchan98" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/9bd8017de7e94474aa5254c5061f17d6)](https://app.codacy.com/gh/billpwchan/futu_algo?utm_source=github.com&utm_medium=referral&utm_content=billpwchan/futu_algo&utm_campaign=Badge_Grade_Settings)
[![Issues](https://img.shields.io/github/issues/billpwchan/futu_algo?style=for-the-badge)](https://github.com/billpwchan/futu_algo/issues)
[![License](https://img.shields.io/github/license/billpwchan/futu_algo?style=for-the-badge)](https://github.com/billpwchan/futu_algo/blob/master/LICENSE)
[![LastCommit](https://img.shields.io/github/last-commit/billpwchan/futu_algo?style=for-the-badge)](https://github.com/billpwchan/futu_algo/blob/master/LICENSE)
[![CommitActivity](https://img.shields.io/github/commit-activity/y/billpwchan/futu_algo?style=for-the-badge)](https://github.com/billpwchan/futu_algo/commits/master)
[![WorkflowStatus](https://img.shields.io/github/workflow/status/billpwchan/futu_algo/CodeQL?style=for-the-badge)](https://github.com/billpwchan/futu_algo/commits/master)
[![RepoSize](https://img.shields.io/github/repo-size/billpwchan/futu_algo?style=for-the-badge)](https://github.com/billpwchan/futu_algo)
[![Languages](https://img.shields.io/github/languages/top/billpwchan/futu_algo?style=for-the-badge)](https://github.com/billpwchan/futu_algo)
</div>
## Highlights
- **Supported Platforms and Markets**
Futu_algo is a algorithmic trading solution developed based on FutuOpenD and FutuOpenAPI. Fully support FutuNiuNiu and
FutuMooMoo users in Hong Kong stock market. *(More market support is coming soon)*
- **Historical K-Line Data**
Allow users to automatically downloading historical data for your interested stocks into CSV and storing to SQLite
database for backtesting. *(up to 1M level for max. 2 years, or 1D level for max. 10 years)*
- **Backtesting Trading Strategies (BETA)**
Backtest your own trading strategies on historical data with a summarized reports and visualizations using Pyfolio.
For more demanding users, feel free to other commercial solutions such as Amibroker for backtesting.
- **Algorithmic Trading**
Real-time low-latency trading features that allows applying your own basket of trading strategies on your stock pool.
User can specify the trading strategy to be used for each stock based on their preference.
***EXAMPLE: 0.01s/STOCK TO DECIDE BUY/SELL ORDER WITH A 3-TECHNICAL INDICATORS STRATEGY (MACD, KDJ AND CLOSE PRICE)***
- **Advanced Stock Screener**
Screens high-quality stocks using your own stock screening strategies, and notify your friends using the email
subscription feature. **Feel free to subscribe by submitting this Google Form! https://forms.gle/C9y4kyYUArKmFzu86**
- **Trading Strategy Editor**
Write your own trading strategy following a simple template (buy, sell, calculate technical indicators). Common
strategies such as MACD and KDJ-based trading rules are provided as guidelines.
- **GUI Support (Upcoming)**
Easy-to-use GUI for users to adjust their configurations, trading, downloading data and filtering stocks within one
application. No longer need to type any command for trading!
## Version Guidance
| FutuAlgo Release | Futu OpenAPI Specification |
|:-----------------|:---------------------------|
| 1.0 | 6.1 |
## Deployment
### Pre-Requisite: Configuration File (Config.ini)
```ini
[FutuOpenD.Config]
Host = <OpenD Host>
Port = <OpenD Port>
WebSocketPort = <OpenD WebSocketPort>
WebSocketKey = <OpenD WebSocketKey>
TrdEnv = <SIMULATE or REAL>
[FutuOpenD.Credential]
Username = <Futu Login Username>
Password_md5 = <Futu Login Password Md5 Value>
[FutuOpenD.DataFormat]
HistoryDataFormat = ["code","time_key","open","close","high","low","pe_ratio","turnover_rate","volume","turnover","change_rate","last_close"]
SubscribedDataFormat = None
[TradePreference]
LotSizeMultiplier = <# of Stocks to Buy per Signal>
MaxPercPerAsset = <Maximum % of Capital Allocated per Asset>
StockList = <Subscribed Stocks in List Format>
[Backtesting.Commission.HK]
FixedCharge = <Fixed Transaction Fee and Tax in HKD - 15.5>
PercCharge = <Percentage Transaction Fee in % - 0.1097>
[Email]
Port = <Server SMTP Setting>
SmtpServer = <Server SMTP Setting>
Sender = <Sender Email Address - account1@example.com>
Login = <Sender Email Address - account1@example.com>
Password = <Sender Email Password>
SubscriptionList = ["account1@example.com", "account2@example.com"]
[TuShare.Credential]
token = 2134342ABC2D03780772038A7816
```
**IMPORTANT NOTE:** The format may be changed in later commits. Please refer to this README if exception is raised.
### 1. Install Dependencies
Install using [conda](https://docs.conda.io/en/latest/):
```bash
conda env create -f environment.yml
```
To export current environment, use the following command
```bash
conda env export > environment.yml
```
To update current environment with the latest dependencies, use the following command
```bash
conda env update --name futu_trade --file environment.yml --prune
```
For GitHub Actions - with pip dependencies, use the following command
```bash
pip list --format=freeze > requirements.txt
```
### 2. Install FutuOpenD
For **Windows/MacOS/CentOS/Ubuntu**:
https://www.futunn.com/download/OpenAPI
Please do make sure that you have at least a LV1 subscription level on your interested quotes. For details, please refer
to https://openapi.futunn.com/futu-api-doc/qa/quote.html
**MAKE SURE YOU LOGIN TO FUTU OPEND FIRST BEFORE STARTING FUTU_ALGO!**
### 4. Download Data (e.g. 1M Data for max. 2 Years)
For **Windows**:
python main_backend.py --force_update
For **MacOS/Linux**:
python3 main_backend.py --force_update
### 4. Enjoy :smile:
## Command-line Interface Usages
### Historical Data Download & Processing
Update all `K_1M` and `K_DAY` interval historical K-line data
python main_backend.py -u / python main_backend.py --update
**IMPORTANT NOTE:** This will not override existing historical data if the file exists. It will automatically detect
the latest stock data you have downloaded in the folder and resume from there.
If you want to refresh all data, use the following command instead (WITH CAUTION!)
python main_backend.py -fu / python main_backend.py --force_update
### Algorithmic Trading
Execute Algorithmic Trading with a Pre-defined Strategy (By default use **1M data**)
python main_backend.py -s MACD_Cross / python main_backend.py --strategy MACD_Cross
If you would like to use another time interval based date (e.g., Day data), use the following command
python main_backend.py -s MACD_Cross --time_interval K_DAY
If you do not have a pre-defined stock list in `config.ini`, then you can just trade the Top 30 HSI stocks
python main_backend.py -s MACD_Cross --include_hsi --time_interval K_DAY
**IMPORTANT NOTE:** The supported time intervals are: K_1M, K_30M, K_5M, K_15M, K_30M, K_60M, K_DAY, K_WEEK, K_MON,
K_YEAR.
### Stock Filtering and Email Subscription
Execute Stock Filtering with Pre-defined Filtering Strategies with Email Title "MACD_Cross_Technique" in HK and
China (Shanghai and Shenzhen) Stock Market
python main_backend.py -f Volume_Threshold Price_Threshold -en MACD_Cross_Technique -m HK CHINA
## GUI Usages
Start the GUI with `main.py` (**NOT FINISHED YET**)
python main.py
## Future Plans
- [ ] [NEED A GREAT NAME FOR THIS ALGO TRADE!!](https://github.com/billpwchan/futu_algo/issues/23)
- [x] [Custom Backtesting Time Interval]()
- [x] [Dynamic Instantiation](https://github.com/billpwchan
没有合适的资源?快使用搜索试试~ 我知道了~
富途量化程序-python
共1932个文件
svg:1584个
png:262个
py:39个
需积分: 0 0 下载量 68 浏览量
2024-05-22
11:00:01
上传
评论
收藏 5.92MB ZIP 举报
温馨提示
富途量化程序-python
资源推荐
资源详情
资源评论
收起资源包目录
富途量化程序-python (1932个子文件)
ListOfSecurities.csv 1.65MB
.gitignore 3KB
icon.ico 210KB
config_template.ini 877B
pytest.ini 95B
LICENSE 11KB
README.md 10KB
CODE_OF_CONDUCT.md 5KB
bug_report.md 834B
useful_commands.md 719B
feature_request.md 595B
stock_basic_info.parquet 1.41MB
stock_owner_plate.parquet 43KB
stock_plate_list.parquet 32KB
HK.00700_2021_1D.parquet 28KB
HK.09988_2021_1D.parquet 24KB
HK.00700_2022-04-13_1M.parquet 20KB
HK.00700_2022-04-12_1M.parquet 20KB
HK.09988_2022-04-12_1M.parquet 19KB
HK.00700_2022-04-11_1M.parquet 19KB
HK.09988_2022-04-11_1M.parquet 18KB
HK.09988_2022-04-13_1M.parquet 18KB
HK.00700_2022_1W.parquet 13KB
HK.09988_2022-04-11_3M.parquet 12KB
HK.09988_2022_1W.parquet 12KB
HK.09988_2022-04-11_5M.parquet 11KB
HK.09988_2022-04-11_15M.parquet 9KB
HK.09988_2022-04-11_30M.parquet 9KB
HK.09988_2022-04-11_60M.parquet 8KB
logo.png 105KB
PyDracula_vertical.png 29KB
LI-Logo.png 25KB
PyDracula_horizontal.png 10KB
FutuBull.png 8KB
GitHub-Mark-Light-120px-plus.png 4KB
PyDracula.png 3KB
cil-movie.png 2KB
cil-fingerprint.png 2KB
cil-size-grip.png 2KB
cil-airplane-mode-off.png 2KB
cil-volume-high.png 2KB
cil-low-vision.png 2KB
cil-layers.png 2KB
cil-mood-very-bad.png 2KB
cil-gamepad.png 2KB
cil-truck.png 2KB
cil-at.png 2KB
cil-people.png 2KB
cil-alarm.png 2KB
cil-mug-tea.png 2KB
cil-wifi-signal-4.png 2KB
cil-face-dead.png 2KB
cil-share-boxed.png 2KB
cil-arrow-circle-top.png 2KB
cil-print.png 2KB
cil-x-circle.png 2KB
cil-settings.png 2KB
cil-arrow-circle-bottom.png 2KB
cil-arrow-circle-right.png 2KB
cil-mood-very-good.png 2KB
cil-envelope-open.png 2KB
cil-mood-bad.png 2KB
cil-smile.png 2KB
cil-arrow-circle-left.png 2KB
cil-envelope-letter.png 2KB
cil-history.png 2KB
cil-check-circle.png 2KB
cil-speedometer.png 2KB
cil-image-plus.png 2KB
cil-mood-good.png 2KB
cil-frown.png 2KB
cil-meh.png 2KB
cil-chevron-circle-down-alt.png 2KB
cil-chevron-double-down.png 2KB
cil-rss.png 2KB
cil-voice-over-record.png 2KB
cil-chevron-circle-left-alt.png 2KB
cil-camera-roll.png 2KB
cil-chevron-circle-up-alt.png 2KB
cil-wifi-signal-off.png 2KB
cil-chat-bubble.png 2KB
cil-paint-bucket.png 2KB
cil-3d.png 2KB
cil-chevron-circle-right-alt.png 2KB
cil-clock.png 2KB
cil-task.png 2KB
cil-equalizer.png 2KB
cil-image1.png 2KB
cil-airplane-mode.png 2KB
cil-fire.png 2KB
cil-av-timer.png 2KB
cil-chevron-double-right.png 2KB
cil-chart-pie.png 2KB
cil-loop-1.png 2KB
cil-4k.png 2KB
cil-house.png 2KB
cil-cloud-upload.png 2KB
cil-dog.png 2KB
cil-library-add.png 2KB
cil-zoom-in.png 2KB
共 1932 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
Dmxy778
- 粉丝: 0
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功