coinbase / coinbase-advanced-py

The Advanced API Python SDK is a Python package that makes it easy to interact with the Coinbase Advanced API. The SDK handles authentication, HTTP connections, and provides helpful methods for interacting with the API.
https://docs.cdp.coinbase.com/advanced-trade/docs/welcome/
Apache License 2.0
109 stars 29 forks source link

Issue when sending limit orders #49

Closed bluusun closed 5 months ago

bluusun commented 5 months ago

order = client.limit_order_ioc(client_order_id="clientOrderId",product_id='LTC-USD',limit_price='82.9',base_size='1',side='BUY')

This was/is well over limit price (about one dollar) but can't see any execution in Coinbase account.

Market orders work just fine for me.

bluusun commented 5 months ago

{ "success": true, "failure_reason": "UNKNOWN_FAILURE_REASON", "order_id": "vvvv-4ef9-9587-fc71dee4f912", "success_response": { "order_id": "vvvd2a-4ef9-9587-fc71dee4f912", "product_id": "LTC-USD", "side": "BUY", "client_order_id": "clientOrderId" }, "order_configuration": { "sor_limit_ioc": { "base_size": "1", "limit_price": "82.9" } } }

bluusun commented 5 months ago

Also how can I sell (market or limit) 1 LTC for instance? Could not find that in documentation :(

bluusun commented 5 months ago

order = client.market_order_sell(client_order_id="clientOrderId",product_id='LTC-USD',base_size='0.01')

print(dumps(order, indent=2)) { "success": true, "failure_reason": "UNKNOWN_FAILURE_REASON", "order_id": "vd2a-4ef9-9587-fc71dev", "success_response": { "order_id": "vvvd2a-4ef9-9587-fc7v12", "product_id": "LTC-USD", "side": "SELL", "client_order_id": "clientOrderId" }, "order_configuration": { "market_market_ioc": { "base_size": "0.01" } } }

xiaofeihuang-cb commented 5 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).

bluusun commented 5 months ago

Figured it out!

1) client_order_id needs to be a unique string or nothing happens 2) engine spits out "success": true, "failure_reason": "UNKNOWN_FAILURE_REASON",

if it accepts order and/or executes order. Really confusing!