alpacahq / alpacahq/Alpaca-API
orders in pending cancel state
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 173
- Forks
- 17
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Just today I accumulated two orders in `pending_cancel` state, that I neither can cancel nor do ANYTHING with, really.
```
GET https://paper-api.alpaca.markets/v2/orders/e4f99109a1414575a029a39a8ee2ea7f: body={"id":"e4f99109-a141-4575-a029-a39a8ee2ea7f","client_order_id":"94905de0-dc58-425e-8345-aaf869e3f7d2","created_at":"2020-03-23T13:50:53.230965Z","updated_at":"2020-03-23T18:07:35.842588Z","submitted_at":"2020-03-23T13:50:53.478662Z","filled_at":null,"expired_at":null,"canceled_at":null,"failed_at":null,"replaced_at":null,"replaced_by":null,"replaces":"b8639e43-64a9-428a-b829-4726a05acd6a","asset_id":"a87b8711-d78f-48e3-b8b9-3b88483f2057","symbol":"CGC","asset_class":"us_equity","qty":"83","filled_qty":"0","filled_avg_price":null,"order_class":"simple","order_type":"limit","type":"limit","side":"buy","time_in_force":"day","limit_price":"12.03","stop_price":null,"status":"pending_cancel","extended_hours":false,"legs":null}
```
Here is how it came to be:
```
PATCH https://paper-api.alpaca.markets/v2/orders/b8639e4364a9428ab8294726a05acd6a: status=200
PATCH https://paper-api.alpaca.markets/v2/orders/b8639e4364a9428ab8294726a05acd6a: body={"id":"e4f99109-a141-4575-a029-a39a8ee2ea7f","client_order_id":"94905de0-dc58-425e-8345-aaf869e3f7d2","created_at":"2020-03-23T13:50:53.230965Z","updated_at":"2020-03-23T13:50:53.504311386Z","submitted_at":"2020-03-23T13:50:53.478662499Z","filled_at":null,"expired_at":null,"canceled_at":null,"failed_at":null,"replaced_at":null,"replaced_by":null,"replaces":"b8639e43-64a9-428a-b829-4726a05acd6a","asset_id":"a87b8711-d78f-48e3-b8b9-3b88483f2057","symbol":"CGC","asset_class":"us_equity","qty":"83","filled_qty":"0","filled_avg_price":null,"order_class":"simple","order_type":"limit","type":"limit","side":"buy","time_in_force":"day","limit_price":"12.03","stop_price":null,"status":"new","extended_hours":false,"legs":null}
DELETE https://paper-api.alpaca.markets/v2/orders/e4f99109a1414575a029a39a8ee2ea7f}: status=204
trade_update: {"event":"order_cancel_rejected","order":{"asset_class":"us_equity","asset_id":"a87b8711-d78f-48e3-b8b9-3b88483f2057","canceled_at":null,"client_order_id":"94905de0-dc58-425e-8345-aaf869e3f7d2","created_at":"2020-03-23T13:50:53.230965Z","expired_at":null,"extended_hours":false,"failed_at":null,"filled_at":null,"filled_avg_price":null,"filled_qty":"0","id":"e4f99109-a141-4575-a029-a39a8ee2ea7f","legs":null,"limit_price":"12.03","order_class":"simple","order_type":"limit","qty":"83","replaced_at":null,"replaced_by":null,"replaces":"b8639e43-64a9-428a-b829-4726a05acd6a","side":"buy","status":"pending_cancel","stop_price":null,"submitted_at":"2020-03-23T13:50:53.478662Z","symbol":"CGC","time_in_force":"day","type":"limit","updated_at":"2020-03-23T13:50:54.065242Z"},"reason":"UNKNOWN_ORDER","timestamp":"2020-03-23T13:50:54.101543927Z"}}
```
So the order cancellation got rejected and since then the order is an "UNKNOWN ORDER". Every repeated cancellation since then is producing the same result.
1) Why is it stuck?
2) Why is order cancellation (`DELETE`) ALWAYS returning 204 (success; when clearly there was no success)? That's not specific to this issue but a general observation.
3) [Please don't](https://github.com/alpacahq/Alpaca-API/issues/97) close this issue tomorrow saying the order is cancelled now. It does not matter. It has to happen when the request came in and not when somebody tinkered with the backend or the market got closed in between.
4) Please fix your state machine to no longer report an UNKNOWN ORDER as active. It's either this or that. Tests, anybody?
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.