How to create a sell market order?

Could someone provide an example of sell market order? The order status shows “Internal error”.

URL: https://api.coinbase.com//api/v3/brokerage/orders/
My request body:

{
  "client_order_id": "test_order_id2",
  "product_id": "LINK-USD",
  "side": "SELL",
  "order_configuration": {
    "market_market_ioc": {
      "base_size": "2"
    }
  }
}

Order status:

{
  "order": {
    "completion_percentage": "100",
    "cancel_message": "Internal error",
    "reject_message": "",
    "size_inclusive_of_fees": true,
    "order_placement_source": "UNKNOWN_PLACEMENT_SOURCE",
    "fee": "",
    "size_in_quote": true,
    "total_value_after_fees": "3",
    "pending_cancel": false,
    "trigger_status": "INVALID_ORDER_TYPE",
    "number_of_fills": "2",
    "product_id": "LINK-USD",
    "order_type": "MARKET",
    "created_time": "2023-02-07T02:21:30.836930Z",
    "side": "BUY",
    "client_order_id": "test_order_id2",
    "average_filled_price": "6.8969999999999994",
    "total_fees": "0.0178926441351889",
    "settled": true,
    "filled_value": "2.9821073558648111",
    "reject_reason": "REJECT_REASON_UNSPECIFIED",
    "order_configuration": {
      "market_market_ioc": {
        "quote_size": "3"
      }
    },
    "time_in_force": "IMMEDIATE_OR_CANCEL",
    "product_type": "SPOT",
    "user_id": "37f4541f-56ad-5a3d-8cdd-731fb7eff7b7",
    "filled_size": "0.4323774620653634",
    "order_id": "cd4ac643-5843-4c3e-af54-3697da28d691",
    "status": "FILLED"
  }
}

Also the buy market order is not working consistently. With the same codes, sometimes it goes through, sometimes it doesn’t. Do u know why?

Hello @iamden! Welcome to the Coinbase Cloud Developer’s Forum! For the details regarding your concern, we will check on this for you with our team to see how we can best assist. We’ll get back to you once we have more information. Keep in touch!

1 Like

Hi @iamden ,
I doubt this is the issue but the URL you pasted has too many forward slashes.

I think the issue might be the client_order_id. I believe this has to be unique for each order. I can see in the order status it has the same client_order_id but the order_configuration has different values. So looks like you are trying to reuse the client_order_id. Have you tried creating a random guid to use?

Thank you. That is it. client_order_id needs to be unique for order request each time.