Cuckdilla / trader

Crypto trading bot
Apache License 2.0
0 stars 0 forks source link

Make historical data downloadable and reusable #9

Open winterbro opened 2 years ago

winterbro commented 2 years ago

Every time we perform calculations we fetch historical data from the API. Downloading it can save us time when dealing with large quantities of data, such as when backtesting.

See attached file for examples.

ETH_USDT.zip

HailD commented 2 years ago

Every time we perform calculations we fetch historical data from the API.

Not really true. When the bot is started, we first pull historical data into a Pandas dataframe. The amount of data (or timeframe) is defined in the configuration file.

[trading]
token = ETHUSDT
interval = 1m
timeframe = 8 hours ago UTC
heikinashi = no

However, Binance has limitations on how many klines/candles can be returned from a single API request. That number is 1000. That means we can only fetch 16 hours worth of 1 minute candles from a single request. If we need more than that, we would need to build up a file like you are suggesting. We populate that file by requesting chunks of data from a start date, in intervals of 1000 candles until we reach the current time.

Will look into this in a separate branch as soon as I get time.