Last active
December 15, 2020 02:30
-
-
Save davidzhaodz/27d8c24b11f7d13d83e1cdc80255307d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#collecting historical candlestick data | |
shrimpy_public_key ='...' | |
shrimpy_secret_key = '...' | |
client = shrimpy.ShrimpyApiClient(shrimpy_public_key, shrimpy_secret_key) | |
candles = client.get_candles( | |
'coinbasepro', # exchange | |
'BTC', # base_trading_symbol | |
'USD', # quote_trading_symbol | |
'1m' # interval | |
) | |
time = [] | |
open = [] | |
high = [] | |
low = [] | |
close = [] | |
vol =[] | |
#formatting the data to match the plotting library | |
for candle in candles: | |
time.append(candle['time']) | |
open.append(candle['open']) | |
high.append(candle['high']) | |
low.append(candle['low']) | |
close.append(candle['close']) | |
vol.append(candle['volume']) | |
#plotting the candlesticks | |
fig = go.Figure(data=[go.Candlestick(x=time, | |
open=open_data, high=high_data, | |
low=low_data, close=close_data)]) | |
fig.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment