Skip to content

Support stop Order on Coinbase Exchange #1932

@dboyliao

Description

@dboyliao

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions