Is it possible to retrieve the last granularity interval entry using a Coinbase Pro API web socket? For example on an hour graph (3600) to retrieve the hourly update via a web socket. I can do this using a normal REST call and I can get the ticker via a web socket but it's not exactly what I am looking for.
This is a working web socket example for a BTC-GBP and BTC-USD ticker.
from websocket import create_connection
import json, time
URL = "wss://ws-feed.pro.coinbase.com"
ws = create_connection(URL)
params = {"type": "subscribe", "product_ids": ["BTC-USD"],
"channels": ["heartbeat", {"name": "ticker", "product_ids": ["BTC-USD", "BTC-GBP"]}]}
while True:
ws.send(json.dumps(params))
result = ws.recv()
print(result)
time.sleep(1)
converted = json.loads(result)
To explain it another way, a web socket version of this:
https://api.pro.coinbase.com/products/BTC-GBP/candles?granularity=3600
Can it be done and if so how?