For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Minute Crypto Data via API
-
Dear Backtraders,
I am trying to download crypto trading data (preferrably Binance). I know that you can donwload day klines via YahooFinanceData. However, I did not find any api access to minute data. Can somebody help me out?
Cheers,
Leo -
Get you api key and secret from your binance account
Here's what I use for binance.import config, csv from binance.client import Client client = Client(config.API_KEY, config.API_SECRET) # prices = client.get_all_tickers() # for price in prices: # print(prices) ''' GUIDELINES To change the timeframe to 1minute data, replace "1HOUR" with to "1MINUTE". ''' csvfile = open("data/1HOUR/ZILBTC_Start_311220_1HOUR.csv", "w", newline="") candlestick_writer = csv.writercsvfile,delimiter=',') candlesticks = client.get_historical_klines("ZILBTC", Client.KLINE_INTERVAL_1HOUR,"01 Jan 2017","31 Dec 2020") for candlestick in candlesticks: candlestick[0] = candlestick[0] / 1000 candlestick_writer.writerow(candlestick) csvfile.close()
-
That helped. Thank you so much!