- Developed based on FutoOpenD and FutuOpenAPI
- Low-latency Trading Support (up to 1M level)
- Daily Stock Filtering and Email Notification
- Strategy Backtesting and Reporting
Important: Program still in Alpha Phase now.
FutuAlgo Release | Futu OpenAPI Specification |
---|---|
0.0.2-alpha.x | 4.0 |
[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
[Database]
Database_path = <Your SQLite Database File Path>
[TradePreference]
Lot_size_multiplier = <# of Stocks to Buy per Signal>
StockList = <Subscribed Stocks in List Format>
[Backtesting.Commission.HK]
Fixed_Charge = <Fixed Transaction Fee and Tax in HKD - 15.5>
Perc_Charge = <Percentage Transaction Fee in % - 0.1097>
[Email]
Port = <Server SMTP Setting>
Smtp_server = <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"]
IMPORTANT NOTE: The format may be changed in later commits. Please refer to this README if exception is raised.
Install using conda:
conda create --name <env> --file requirements.txt
For Windows/MacOS/CentOS/Ubuntu:
https://www.futunn.com/download/OpenAPI
Go to SQLite official website and follow the QuickStart instruction to install SQLite tools in the device.
Create a folder named 'database' in the root folder, and execute the SQLite DDL file stored in ./util/database_ddl.sql .
./
├── database
│ └── stock_data.sqlite
For Windows:
python main.py -u
For MacOS/Linux:
python3 main.py -u
Update all K_1M
and K_DAY
interval historical K-line data
python main.py -u / python main.py --update
IMPORTANT NOTE: This will not override existing historical data if the file exists.
If you want to refresh all data, use the following command instead (WITH CAUTION!)
python main.py -fu / python main.py --force_update
Store all data from CSV to SQLite Database
python main.py -d / python main.py --database
Execute High-Frequency Trading (HFT) with a Pre-defined Strategy
python main.py -s MACD_Cross / python main.py --strategy MACD_Cross
Execute Stock Filtering with Pre-defined Filtering Strategies
python main.py -f Volume_Threshold Price_Threshold / python main.py --filter Volume_Threshold Price_Threshold