All Projects → billpwchan → futu_algo

billpwchan / futu_algo

Licence: Apache-2.0 license
Futu Algorithmic Trading Solution (Python) 基於富途OpenAPI所開發量化交易程序

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to futu algo

Turingtrader
The Open-Source Backtesting Engine/ Market Simulator by Bertram Solutions.
Stars: ✭ 132 (-7.69%)
Mutual labels:  finance, trading, trading-bot, trading-platform, trading-strategies
Quantdom
Python-based framework for backtesting trading strategies & analyzing financial markets [GUI ]
Stars: ✭ 449 (+213.99%)
Mutual labels:  finance, trading, fintech, trading-platform, trading-strategies
Lean
Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
Stars: ✭ 5,675 (+3868.53%)
Mutual labels:  finance, trading, trading-bot, trading-platform, trading-strategies
AutoTrader
A Python-based development platform for automated trading systems - from backtesting to optimisation to livetrading.
Stars: ✭ 227 (+58.74%)
Mutual labels:  finance, trading, trading-bot, trading-platform, trading-strategies
roq-samples
How to use the Roq C++20 API for Live Cryptocurrency Algorithmic and High-Frequency Trading as well as for Back-Testing and Historical Simulation
Stars: ✭ 119 (-16.78%)
Mutual labels:  trading, trading-bot, trading-platform, trading-strategies, high-frequency-trading
Tradingview Alert Binance Trader
This trading bot listens to the TradingView alert emails on your inbox and executes trades on Binance based on the parameters set on the TD alerts.
Stars: ✭ 100 (-30.07%)
Mutual labels:  trading, trading-bot, trading-platform, trading-strategies
Quant
Codera Quant is a Java framework for algorithmic trading strategies development, execution and backtesting via Interactive Brokers TWS API or other brokers API
Stars: ✭ 104 (-27.27%)
Mutual labels:  trading, trading-bot, trading-platform, trading-strategies
Socktrader
🚀 Websocket based trading bot for 💰cryptocurrencies 📈
Stars: ✭ 152 (+6.29%)
Mutual labels:  trading, trading-bot, trading-platform, trading-strategies
quick trade
convenient script for trading with python.
Stars: ✭ 63 (-55.94%)
Mutual labels:  trading, trading-bot, trading-platform, trading-strategies
Krypto Trading Bot
Self-hosted crypto trading bot (automated high frequency market making) written in C++
Stars: ✭ 2,589 (+1710.49%)
Mutual labels:  trading, trading-bot, trading-platform, trading-strategies
trading sim
📈📆 Backtest trading strategies concurrently using historical chart data from various financial exchanges.
Stars: ✭ 21 (-85.31%)
Mutual labels:  finance, trading, trading-bot, trading-strategies
Gekko Strategies
Strategies to Gekko trading bot with backtests results and some useful tools.
Stars: ✭ 1,022 (+614.69%)
Mutual labels:  trading, trading-bot, trading-platform, trading-strategies
Tradinggym
Trading and Backtesting environment for training reinforcement learning agent or simple rule base algo.
Stars: ✭ 813 (+468.53%)
Mutual labels:  trading, trading-bot, trading-platform, trading-strategies
Roq Api
API for algorithmic and high-frequency trading
Stars: ✭ 132 (-7.69%)
Mutual labels:  trading, trading-bot, trading-platform, trading-strategies
Kelp
Kelp is a free and open-source trading bot for the Stellar DEX and 100+ centralized exchanges
Stars: ✭ 580 (+305.59%)
Mutual labels:  trading, trading-bot, trading-platform, trading-strategies
Stocksharp
Algorithmic trading and quantitative trading open source platform to develop trading robots (stock markets, forex, crypto, bitcoins, and options).
Stars: ✭ 4,601 (+3117.48%)
Mutual labels:  finance, trading, trading-platform, trading-strategies
tradingview-alert-binance-trader
This trading bot listens to the TradingView alert emails on your inbox and executes trades on Binance based on the parameters set on the TD alerts.
Stars: ✭ 153 (+6.99%)
Mutual labels:  trading, trading-bot, trading-platform, trading-strategies
Zvt
modular quant framework.
Stars: ✭ 1,801 (+1159.44%)
Mutual labels:  trading-bot, fintech, trading-platform, trading-strategies
Machine Learning And Ai In Trading
Applying Machine Learning and AI Algorithms applied to Trading for better performance and low Std.
Stars: ✭ 258 (+80.42%)
Mutual labels:  finance, trading, trading-bot, trading-strategies
Tradingstrategies
Algorithmic trading strategies
Stars: ✭ 120 (-16.08%)
Mutual labels:  finance, trading, trading-platform, trading-strategies
FutuAlgo Logo

billpwchan/futu-algo API Reference Documentation

Codacy Badge

Issues License LastCommit CommitActivity WorkflowStatus RepoSize Languages

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.

  • 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)

[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 - [email protected]>
Login = <Sender Email Address - [email protected]>
Password = <Sender Email Password>
SubscriptionList = ["[email protected]", "[email protected]"]

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:

conda env create -f environment.yml

To export current environment, use the following command

conda env export > environment.yml

To update current environment with the latest dependencies, use the following command

conda env update --name futu_trade --file environment.yml --prune

For GitHub Actions - with pip dependencies, use the following command

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 😄

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"

python main_backend.py -f Volume_Threshold Price_Threshold -en MACD_Cross_Technique

GUI Usages

Start the GUI with main.py (NOT FINISHED YET)

python main.py

Future Plans


Contributor

Bill Chan -- Main Developer

Disclaimer

Futures, stocks and options trading involves substantial risk of loss and is not suitable for every investor. The valuation of futures, stocks and options may fluctuate, and, as a result, clients may lose more than their original investment. The impact of seasonal and geopolitical events is already factored into market prices. The highly leveraged nature of futures trading means that small market movements will have a great impact on your trading account and this can work against you, leading to large losses or can work for you, leading to large gains.

If the market moves against you, you may sustain a total loss greater than the amount you deposited into your account. You are responsible for all the risks and financial resources you use and for the chosen trading system. You should not engage in trading unless you fully understand the nature of the transactions you are entering into and the extent of your exposure to loss. If you do not fully understand these risks you must seek independent advice from your financial advisor.

All trading strategies are used at your own risk.

Any content in this repository should not be relied upon as advice or construed as providing recommendations of any kind. It is your responsibility to confirm and decide which trades to make. Trade only with risk capital; that is, trade with money that, if lost, will not adversely impact your lifestyle and your ability to meet your financial obligations. Past results are no indication of future performance. In no event should the content of this correspondence be construed as an express or implied promise or guarantee.

This repository and its author are not responsible for any losses incurred as a result of using any of our trading strategies. Loss-limiting strategies such as stop loss orders may not be effective because market conditions or technological issues may make it impossible to execute such orders. Likewise, strategies using combinations of options and/or futures positions such as “spread” or “straddle” trades may be just as risky as simple long and short positions. Information provided in this correspondence is intended solely for informational purposes and is obtained from sources believed to be reliable. Information is in no way guaranteed. No guarantee of any kind is implied or possible where projections of future conditions are attempted.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].