I'm new to Python and API and am trying to start with some basics like making a list/plot of old BTC prices. I imported the Coinbase Wallet Client and used client.get_historic_prices()
, which gave me a list of the price at midnight UTC for 365 days.
How can I adjust the parameters to get different date ranges and data resolution, for example each minute for two years? Is there a way to search the historic values of buy, sell, and spot separately?
from coinbase.wallet.client import Client
hist_price = client.get_historic_prices()
xx=[]
yy=[]
for ii in range(365):
xx.append(ii*-1) # x coordinate being "days ago"
yy.append(float(hist_price['prices'][ii]['price']))
Returns (this is just from a print statement of print(hist_price['prices'][0:3]
). So it's midnight once a day.
prices
length = 365
{
"price": "974.39",
"time": "2017-02-01T00:00:00Z"
}
{
"price": "944.29",
"time": "2017-01-31T00:00:00Z"
}
{
"price": "920.47",
"time": "2017-01-30T00:00:00Z"
}