nautechsystems / nautilus_trader

A high-performance algorithmic trading platform and event-driven backtester
https://nautilustrader.io
GNU Lesser General Public License v3.0
2.21k stars 506 forks source link

Binance HTTP request too often - then blocked #780

Closed jandykwan closed 1 year ago

jandykwan commented 2 years ago

Bug Report

using the binance live, when start the tradingnode, too much rest request at the same time sent. the result is my ip is banned by binance. checking the source code. the problem as following: file: /home/jandy/Documents/opensource/nautilus_trader/nautilus_trader/adapters/binance/spot/execution.py

for symbol in active_symbols:
                response = await self._http_account.get_orders(
                    symbol=symbol,
                    start_time=secs_to_millis(start.timestamp()) if start is not None else None,
                    end_time=secs_to_millis(end.timestamp()) if end is not None else None,
                )

i have a lot of coins, different symbol. the above line sent a lof of rest request to binance. so my ip is banned. so i think the binancehttpclient should have a request limit. thanks.

cjdsellers commented 2 years ago

Thanks for the report jandykwan

One limitation with the Binance API is they require you to pass the market param for every different asset that needs to be reconciled, which can end up being many requests. Indeed some sort of rate limiting would solve this, there's currently an open issue and will be attended based on bandwidth https://github.com/nautechsystems/nautilus_trader/issues/547.

cjdsellers commented 1 year ago

Closing this issue for now, as we finally have basic rate limiting for Binance.

Discussions and developments can be tracked here.