freqtrade / freqtrade

Free, open source crypto trading bot
https://www.freqtrade.io
GNU General Public License v3.0
28.65k stars 6.14k forks source link

Avoid fetching candles from exchange in consumer mode #9275

Closed toloko closed 1 year ago

toloko commented 1 year ago

Describe your environment

Your question

Is it possible to avoid downloading candles from the exchange when running in consumer mode? My use case is I want to run several bots on binance but my IP gets banned when fetching candles. I would like to have one bot acting as Producer, and then the rest of the bots as Consumers, receiving the candles from the Producer via websocket. The problem I have is the Consumer, even after receiving the analyzed dataframes from the Producer, still go and fetch candles.

Ask the question you have not been able to find an answer in the Documentation

stash86 commented 1 year ago

There is unofficial binance proxy that can be used for such use https://github.com/nightshift2k/binance-proxy

Using producer consumer just for ohlcv data is overkill.

toloko commented 1 year ago

Thanks @stash86 for the suggestion. I will consider using it.

However, I am still interested in the Producer/Consumer setup as some of the indicators are common across the different strategies I use. In some cases I reuse the entire set of indicators.

Additionally, I would also like to use KuCoin - not sure if there is an equivalent proxy for kucoin as the one you just shared for binance?

Thanks!

xmatthias commented 1 year ago

You can't. each consumer bot will fetch it's own set of candles. Producer/consumer mode is made to share heavy indicators across bots - not to replace fetching candles from the exchange.

If you want to run multiple bots against the same exchange, i'd recommend to scale horizontally, using multiple free servers instead (which will give you multiple IP's to work from.

I'd also caution you against using inofficial proxies. I'm not aware of any project in this regard that's still supported and receives updates, it's therfore unclear if they still work or won't (you can test this - but we'll not provide support for this) - or if they attempt to steal your exchange keys (yes, proxies get this kind of access to your communication).

in a mode you suggest (consumer mode doesn't fetch candles from the exchange), the consumer will be blind if the producer goes away (potentially risking 100% of the capital in trades), and would stop handling open trades. Therefore, it's not a mode we're implementing or supporting.