Closed SpaceMonkeyForever closed 5 months ago
Did you try to implement that by your own. I'm trying but getting issues. See the attached screenshot. Any idea what might be wrong?
the passphrase is not your password, its used when creating the api key
the passphrase is not your password, its used when creating the api key
Man. I'm so stupid ;) I used the Coinbase API Key and not the Coinbase Pro API Key. Using the right API key, this approach posted in the image works well for me (consuming a L2 Book channel).
I made the exact same mistake recently. They make it confusing so don't blame yourself.
On Tue, Sep 19, 2023, 8:01 PM uweheldt @.***> wrote:
the passphrase is not your password, its used when creating the api key
Man. I'm so stupid ;) I used the Coinbase API Key and not the Coinbase Pro API Key. Using the right API key, this approach posted in the image works well for me (consuming a L2 Book channel).
— Reply to this email directly, view it on GitHub https://github.com/bmoscon/cryptofeed/issues/990#issuecomment-1726317953, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFONGISH4UKHQNU4LOPAP5DX3HTYFANCNFSM6AAAAAA3T4B3ZM . You are receiving this because you authored the thread.Message ID: @.***>
Where did you get this key from? I only see wallet api keys being available to me.
Coinbase Pro met its end. No way to create Coinbase Pro API keys anymore now.
@bmoscon Do you plan on updating the Coinbase client to use the new Coinbase API? Any chance you could enable API authentication using global variables, so it is easy to use? It is mandatory now, as reported in the original issue.
@twoletters unless I am mistaken what they call "cloud" or "exchange" now has the same API as Pro, its just a matter of changing the websocket URL
@uweheldt what did you end up using for "passphrase" - just an empty string?
I'm trying to replicate your solution above with this code but cannot get it work. Getting
{'type': 'error', 'message': 'Failed to subscribe', 'reason': 'level2, level3, and full channels now require authentication. https://docs.cloud.coinbase.com/exchange/docs/websocket-auth'}
errors.
Any pointers highly appreciated
import base64
import hashlib
import hmac
method = "GET"
request_path = "/users/self/verify"
key = ...
secret_key = ...
passphrase = ""
timestamp = str(int(time.time()))
message = timestamp + method + request_path
hmac_key = base64.b64decode(secret_key)
signature = hmac.new(hmac_key, message.encode(), hashlib.sha256)
signature_b64 = base64.b64encode(signature.digest())
ws.send(
json.dumps(
{
"type": "subscribe",
"product_ids": [
"BTC-USD",
],
"channels": ["level2"],
"signature": signature_b64.decode(),
"key": key,
"passphrase": passphrase,
"timestamp": timestamp
}
)
)
I am working on updating the Coinbase module to reflect the new authentication requirements. I am hoping to open a PR soon.
@thomasbs17 thank you!
FWIW, I found there's a non-authlevel2_batch
so all you have to do is
https://github.com/kzk2000/deephaven-clickhouse/blob/master/docker/cryptofeed/src/coinbase.py#L381
and avoid throwing errors here by adding and (price in self._l2_book[pair].book[side]):
here
https://github.com/kzk2000/deephaven-clickhouse/blob/master/docker/cryptofeed/src/coinbase.py#L189
My understanding is that the previous Coinbase PRO api key is no longer available to Retail customers (but still exists for Institutions), and there's a new Advanced Trading API for retail with details here: https://docs.cloud.coinbase.com/advanced-trade-api/docs/ws-auth -- however, those payloads look very different.
Anyway, curious to hear what you figure out.
Hi @kzk2000 , you can check out this PR (my cryptofeed fork). I have 90% of things ready and functional in there, I should be able to open a PR within this repo by end of week
@thomasbs17 this is very cool, I see you are switching everything to the wss://advanced-trade-ws.coinbase.com
which is the new Advanced Trading API. Thanks for doing this work! I had looked at it but then didn't have the time to go all in.
I see you also used this extra check to see we don't remove price levels that don't exist - nice! https://github.com/thomasbs17/cryptofeed/pull/1/files#diff-e8cf1e2e86d9c37da0539f64eff8c4fe971b718b1d73855632ebecf7288a98adR125-R128
I have opened the PR here: https://github.com/bmoscon/cryptofeed/pull/1005
Coinbase requires auth now:
https://docs.cloud.coinbase.com/exchange/docs/websocket-auth
Somewhat of a duplicate of https://github.com/bmoscon/cryptofeed/issues/937