Closed elmutt closed 2 months ago
Thank you for reporting! If this is an SDK specific issue, we will look into it and get back to you soon. If this is an API related request, report it in our Advanced API Discord instead (use this invite link if it's your first time accessing the Discord).
I am following the example from the coinbase advanced trade getting started guide verbatim and no matter what I do I get a 401 error. I have tried recreating the api keys, toggling them on / off, nothing works. Super frustrating and it is not possible to talk to someone about this issue at coinbase support
Here is the example code Im following:
from coinbase.rest import RESTClient from json import dumps import math
api_key = "organizations/{org_id}/apiKeys/{key_id}" api_secret = "-----BEGIN EC PRIVATE KEY-----\nYOUR PRIVATE KEY\n-----END EC PRIVATE KEY-----\n"
client = RESTClient(api_key=api_key, api_secret=api_secret)
product = client.get_product("BTC-USD") btc_usd_price = float(product["price"]) adjusted_btc_usd_price = str(math.floor(btc_usd_price - (btc_usd_price * 0.05)))
limit_order = client.limit_order_gtc_buy( client_order_id="00000002", product_id="BTC-USD", base_size="0.0002", limit_price=adjusted_btc_usd_price )
limit_order_id = limit_order["order_id"]
client.cancel_orders(order_ids=[limit_order_id])