Piet_Pompies
Active Member
- Joined
- Aug 5, 2022
- Messages
- 37
- Reaction score
- 21
I recently signed up for a Binance account and finally figured out how to use the API to download current, hourly data. I will now use this to attempt some predictive modelling and share my progress.
I will be using R with xgBoost and the TTR package in R.
I will use a cryptocurrency that has at leat 6 months worth of hourly data. As a start I will use Bitcoin (any suggestions welcome).
I use the "https://pypi.org/project/python-binance/" modules on Linux (Ubuntu 20.04) to get data from Binance.
To get hourly Open, High, Low, Close, Volume data you need the following:
In a folder create the follwing 2 files:
1) config.py
with the following 2 lines
2) Download_Binance_Data.py:
Change to the folder and run"
python Download_Binance_Data.py
UPDATES ON PROGRESS:
I will be using R with xgBoost and the TTR package in R.
I will use a cryptocurrency that has at leat 6 months worth of hourly data. As a start I will use Bitcoin (any suggestions welcome).
I use the "https://pypi.org/project/python-binance/" modules on Linux (Ubuntu 20.04) to get data from Binance.
To get hourly Open, High, Low, Close, Volume data you need the following:
In a folder create the follwing 2 files:
1) config.py
with the following 2 lines
API_KEY = 'YOUR API'
API_SECRET = 'YOUR SECRET API'
2) Download_Binance_Data.py:
import config, csv
from binance.client import Client
client = Client(config.API_KEY, config.API_SECRET)
csvfile = open('FULL_LOCATION_OF_DOWNLOADED_FILE', 'w', newline='')
candlestick_writer = csv.writer(csvfile, delimiter=',')
candlesticks = client.get_historical_klines("BTCUSDT", Client.KLINE_INTERVAL_1HOUR, "20 Jan, 2022")
for candlestick in candlesticks:
candlestick[0] = candlestick[0] / 1000
candlestick_writer.writerow(candlestick)
csvfile.close()
Change to the folder and run"
python Download_Binance_Data.py
UPDATES ON PROGRESS:
| DATE | AMOUNT IN (USDT) | AMOUNT OUT (USDT) | PROFIT/LOSS |
| 17 Aug-18 AUG (SOL) | 50 | 48.985 | -1.015 |
| 19 Aug - 19 Aug (AAVE) | 50 | 47.516 | -2.4833 |
| 19 Aug - 19 Aug (SOL) | 50 | 50.593 | +0.593 |
Last edited:



