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

Support stop Order on Coinbase Exchange #1932

Open
dboyliao opened this issue Mar 13, 2025 · 1 comment
Open

Support stop Order on Coinbase Exchange #1932

dboyliao opened this issue Mar 13, 2025 · 1 comment

Comments

@dboyliao
Copy link
Collaborator

dboyliao commented Mar 13, 2025

https://docs.cdp.coinbase.com/exchange/reference/exchangerestapi_postorders#stop-orders

Action Items:

  • New enum value for types.OrderType
  • Implement submitting stop order
  • Update the event handling logic for the stream struct to take stop order life cycle into account.

The payload to create a stop order is not as describe in the doc.
By setting type to "stop", the API will give error response with status code 400:

{"message": "Invalid order_type stop"}

Instead, you have to submit the payload as follows to create a stop order:

{
    "price": "3000",
    "product_id": "ETH-USD",
    "size": "0.001",
    "side": "sell",
    "type": "limit",
    "stop": "entry",
    "stop_price": "2500"
}

That is, the required fields in the payload for a stop order are:

  1. type as "limit"
  2. Add required stop field ("entry" or "loss")
  3. Add required stop_price field

The life cycle for a stop order is just like normal limit order, with an extra activate event at the beginning when it is submitted:

Image

@dboyliao
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant