user-docs icon indicating copy to clipboard operation
user-docs copied to clipboard

Error with return from canceling an order already filled

Open lvca opened this issue 3 years ago • 0 comments

Hi guys,

If I execute this:

curl -X DELETE "https://api.alpaca.markets/v2/orders/XXXXXXXXXXXXXX" -H "Authorization: Bearer YYYYYYYY"

I got HTTP 204 (OK) even if the order was already filled.

  • Trying 35.221.23.121...
  • Connected to api.alpaca.markets (35.221.23.121) port 443 (#0)
  • found 148 certificates in /etc/ssl/certs/ca-certificates.crt
  • found 596 certificates in /etc/ssl/certs
  • ALPN, offering http/1.1
  • SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
  • server certificate verification OK
  • server certificate status verification SKIPPED
  • common name: api.alpaca.markets (matched)
  • server certificate expiration date OK
  • server certificate activation date OK
  • certificate public key: RSA
  • certificate version: #3
  • subject: CN=api.alpaca.markets
  • start date: Mon, 05 Jul 2021 13:02:07 GMT
  • expire date: Sun, 03 Oct 2021 13:02:06 GMT
  • issuer: C=US,O=Let's Encrypt,CN=R3
  • compression: NULL
  • ALPN, server accepted to use http/1.1

DELETE /v2/orders/XXXXXXXXXXXXXX HTTP/1.1 Host: api.alpaca.markets User-Agent: curl/7.47.0 Accept: / Authorization: Bearer YYYYYYYY

< HTTP/1.1 204 No Content < Server: nginx < Date: Wed, 18 Aug 2021 05:41:05 GMT < Content-Type: application/json; charset=UTF-8 < Connection: keep-alive < Access-Control-Allow-Credentials: true < Access-Control-Allow-Origin: * < Vary: Origin < Strict-Transport-Security: max-age=31536000; includeSubDomains <

  • Connection #0 to host api.alpaca.markets left intact

If you see the docs under https://alpaca.markets/docs/api-documentation/api-v2/orders/:

Cancel an order
DELETE/v2/orders/{order_id}
Attempts to cancel an open order. If the order is no longer cancelable (example: status="filled"), the server will respond with status 422, and reject the request. Upon acceptance of the cancel request, it returns status 204.

So I was expecting a 422 or anything different from 204 because the order has been filled.

lvca avatar Aug 23 '21 18:08 lvca