Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

401 every time #56

Closed
elmutt opened this issue Jun 9, 2024 · 1 comment
Closed

401 every time #56

elmutt opened this issue Jun 9, 2024 · 1 comment

Comments

@elmutt
Copy link

elmutt commented Jun 9, 2024

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])

Copy link

github-actions bot commented Jun 9, 2024

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).

@elmutt elmutt closed this as completed Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant