billpwchan / futu_algo Goto Github PK
View Code? Open in Web Editor NEWFutu Algorithmic Trading Solution (Python) 基於富途OpenAPI所開發量化交易程序
License: Apache License 2.0
Futu Algorithmic Trading Solution (Python) 基於富途OpenAPI所開發量化交易程序
License: Apache License 2.0
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
After receiving the data, use another thread with timeout to place buy/sell orders.
Describe alternatives you've considered
N/A
Additional context
N/A
Hi,
Would be nice to have a feature that sets up a cron job in Github Actions to process all stocks using a pre-defined strategy and send out the daily selected stocks to subscribers. The subscribers can simply include their name in a list or comment them in GitHub and you can setup a workflow to automatically update that list on a daily basis.
Let me know what's your thought! 😊
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
So currently, the strategy might lead to incorrect buy decisions for some stocks with tiny transaction volumes (e.g., a sudden large buy from funds will cause the technical indicators to suddenly satisfy the condition of the buy strategy). It is better to filter out these less healthy stocks in our stocks pool before starting the high-frequency trading
Describe alternatives you've considered
May be implemented before the trading starts or after the trading starts.
Additional context
Nah
Instead of subscribing to the data and rely on the data push from the Futu side, use multi-threads to retrieve the latest data from the Futu OpenD with no frequency limit.
Check out https://openapi.futunn.com/futu-api-doc/qa/quote.html for more details.
The implementation should take around 2 weeks to finish. It's a major one, should be tested thoroughly before merging to the Master
Add support for using Seaborn / Matplotlib to plot the trading result.
Do you have plans to support US options?
Thank you
Describe the bug
FileNotFoundError: [Errno 2] No such file or directory: 'D:\Users\admin\Documents\Python\futu_algo-master\data\Stock_Pool\ListOfSecurities.csv'
Hi there, is it possible for the project to run on Mac OS or Linux system? Or any plan for this?
Instead of creating an instance for each stock code, re-use strategies instance for stocks that are configured to use the same strategy.
Is your feature request related to a problem? Please describe.
Nah
Describe the solution you'd like
Update HFT Stock Pool based on a separate stock selector (using primarily Yahoo Finance data).
Describe alternatives you've considered
Support other data sources such as Google Finance or other paid subscribed data source.
Additional context
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
Currently, the script only works if the user buys Lv2 data subscription card with 318HKD / Month. However, if the IP address is from Mainland China, FuTu automatically grant Lv1 data subscription without extra cost. However, we don't have Orderbook and some other features comparing with Lv2.
Need to update the solution and another configuration field in Config.ini to indicate which data subscription plan is used.
Describe alternatives you've considered
No
Additional context
No
Use 1M interval stock data to quickly calculate other time interval-based stock data on demand.
Potential useful resources https://stackoverflow.com/questions/62373692/how-do-you-convert-1-minute-open-high-low-close-data-to-another-timeframefx-5
Is your feature request related to a problem? Please describe.
N/A
Describe the solution you'd like
It would be better if futu_algo can support Options Trading Strategies such as bull call spread in addition to the existing spot trading
Describe alternatives you've considered
Interactive Brokers might have a more mature solution for US market, but for HK stock market, it would be easier to just develop a simple options trading engine from scratch.
When converting 1M stock data to any time interval greater than 60M, it creates discrepancy between the generated file & actual file due to the non-trading hours.
For instance, for 1H interval, the suggested key timestamps are
Need to update the logic to support this types of conversion using 1M-based stock data.
Can't download futuOpenD via https://www.futunn.com/download/OpenAPI right now.
ADX & RSI Strategy based on the following specification
ADXdays=Optimize("ADXdays",10,5,25,5);
ADXlimit=Optimize("ADXlimit",25,10,50,5);
RSI_threshold = Optimize("RSILimit",20,5,100,5);
Buy= RSI(2) < RSI_threshold AND ADX(ADXdays)>ADXlimit ;
buyPrice=Close;
Sell= C>Ref(H,-1);
Hello
Great project you've got here! I believe Futu provides support for paper trading, Does this support paper trading though?
StockQuote Handler Base will push a message to subscriber everytime the price is changed.
RTData Handler Base will push a message every 1 minute.
To use strategies like MACD crossover, it is better to use RTDat than StockQuote which is less sensitive in real-time.
Feature request
User login to our website and pay. We add them to the list for sending email and SMS.
In Testing, each buy/sell decision is logged twice for an unknown reason.
It seems some stock's data aren't correct when I downloaded them. For instance, for stock HK.01997, the 1M data I downloaded isn't consistent with the one I observed in the Futu client. Gotta use data validator to ensure all data are correct before backtesting.
Describe the bug
When execute the main_backend.py file,it return:
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: no commands supplied
the setup.py --help does not work
what is the cmds, may i have the example of the parameters
if possible, we can use Chinese to communicate
Create a data validator to ensure all downloaded data are correct. Use futu openAPI to retrieve trading days and trading day type, then validate the number of entry
Hi there. I'm trying to run the main_backend.py
but I keep getting an error:
ERROR — Cannot subscribe to K-Line: No right to subscribe 00001
I have a subscription quota of 300 according to OpenD and subscription status query also shows 300:
INFO — Query Subscription Quota: {'total_used': 0, 'remain': 300, 'own_used': 0, 'sub_list': {}}
Does anyone know why this might be the case?
Any advice appreciated. Thanks.
For each stock, use a different strategy defined in a mapping file. This is based on the observation that no single strategy can be suitable for all different types of stocks. This mapping file should be built based on backtesting results.
Feel free to leave your thoughts!! Any name suggestion is welcomed
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Describe the solution you'd like
A clear and concise description of what you want to happen.
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
I am a beginner in quantitative trading, could you offer some more detailed tutorial for reference?
Is your feature request related to a problem? Please describe.
No
Describe the solution you'd like
When we have a buy/sell signal, send an Email / SMS/ WhatsApp Message to clients
Describe alternatives you've considered
Nah
Additional context
Nah
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
python main_backend.py -b MACD_Cross
Traceback (most recent call last):
File "/Users/lilili/git/shuque/stock/futu_algo/main_backend.py", line 249, in
main()
File "/Users/lilili/git/shuque/stock/futu_algo/main_backend.py", line 243, in main
init_backtesting(args.backtesting)
File "/Users/lilili/git/shuque/stock/futu_algo/main_backend.py", line 114, in init_backtesting
stock_list = YahooFinanceInterface.get_top_30_hsi_constituents()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/lilili/git/shuque/stock/futu_algo/engines/data_engine.py", line 404, in get_top_30_hsi_constituents
payload = pd.read_html(r.text)[0]
^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/lib/python3.12/site-packages/pandas/io/html.py", line 1240, in read_html
return _parse(
^^^^^^^
File "/opt/miniconda3/lib/python3.12/site-packages/pandas/io/html.py", line 1003, in _parse
raise retained
File "/opt/miniconda3/lib/python3.12/site-packages/pandas/io/html.py", line 983, in _parse
tables = p.parse_tables()
^^^^^^^^^^^^^^^^
File "/opt/miniconda3/lib/python3.12/site-packages/pandas/io/html.py", line 249, in parse_tables
tables = self._parse_tables(self._build_doc(), self.match, self.attrs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/lib/python3.12/site-packages/pandas/io/html.py", line 598, in _parse_tables
raise ValueError("No tables found")
ValueError: No tables found
Additional context
Add any other context about the problem here.
deployment futu_algo step by step , but when execute , exception occured. how to fix? thanks
(base) /home/xiaoming/anaconda3/bin/python3 main.py
Please rename stock_strategy_map_template.yml to stock_strategy_map.yml and update it.
Traceback (most recent call last):
File "/home/xiaoming/develop/futu_algo/main.py", line 31, in
from engines import *
File "/home/xiaoming/develop/futu_algo/engines/init.py", line 22, in
from .order_engine import *
File "/home/xiaoming/develop/futu_algo/engines/order_engine.py", line 21, in
from futu import ModifyOrderOp, OpenHKTradeContext, OpenQuoteContext, OrderStatus, OrderType, RET_OK,
ImportError: cannot import name 'ModifyOrderOp' from 'futu' (/home/xiaoming/anaconda3/lib/python3.9/site-packages/futu/init.py)
Will it support US Market
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.