Skip to content
Robot de trading
Docs d'OctoBot script
Télécharger les données historiques

Télécharger les données historiques de trading

La traduction française de cette page est en cours.

In order to run a backtest, OctoBot script requires historical trading data, which is at least candles history.

Télécharger de nouvelles données

When using OctoBot script, historical data can be fetched using: await obs.get_data(symbol, time frame)


  • symbol: the trading symbol to fetch data from. It can also be a list of symbols
  • time frame: the time frame to fetch (1h, 4h, 1d, etc). It can also be a list of time frames

Optional arguments:

  • start_timestamp: the unix timestamp to start fetching data from. Use this converter if you are unsure what you should use.
  • exchange: the exchange to fetch data from. Default is “binance”
  • exchange_type: the exchange trading type to fetch data from. Default is “spot”, “future” is also possible on supported exchanges
data = await obs.get_data("BTC/USDT", "1d", start_timestamp=1505606400)

Réutiliser les données précédemment téléchargées

Calling data = await obs.get_data will save the downloaded data into the backtesting/data local folder. If you want to speedup subsequent calls, you can provide the data_file optional argument to read data from this file instead of downloading historical data. This also makes it possible to run a script while being offline.

You can get the name of the downloaded backtesting file by accessing data.data_files[0]

data = await obs.get_data("BTC/USDT", "1d", start_timestamp=1505606400)
# print the name of the downloaded data file
datafile = ""
# will not download historical data as a local data_file is provided
data = await obs.get_data("BTC/USDT", "1d", start_timestamp=1505606400, data_file=datafile)