alpacahq / alpacahq/Alpaca-API

Buy Limit order misinterpreted as Sell order

Open
#271 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
173
Forks
17
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
This morning I placed two market orders to buy two call contracts per order (POST on /v2/orders). The orders did not go through, both yielding status 403 “code”:40310000,“message”:“insufficient underlying qty available for covered call (required: 200, available: 0)”

It seems as though these orders were processed as sell orders instead of buy orders. The code was working properly before and I did not change it. I switched to paper trading and the issue was resolved. I switched back to live trading and the code worked properly again. With no changes made to the code.

What happened? It may have been a fluke but this is absolutely unacceptable. I lost out on money today because the API was not working properly. How do I make sure this never happens ever again?

**To Reproduce**
I was not able to reproduce the error (as I described above)

**Expected behavior**
A limit order is placed to BUY the contracts (not sell)

**Output**
Error entering position: failed to place order (status 403): {"available_qty":"0","code":40310000,"message":"insufficient underlying qty available for covered call (required: 200, available: 0)","required_qty":"200","symbol":"CLSK250110C00012000","underlying_asset_id":"8f33ee14-9d35-490c-b33f-6fbb2d163c13"}

Error entering position: failed to place order (status 403): {"available_qty":"0","code":40310000,"message":"insufficient underlying qty available for covered call (required: 200, available: 0)","required_qty":"200","symbol":"SBUX250110C00096000","underlying_asset_id":"0a7deac5-2d75-4e54-9f66-51c1c6fad55b"}

**Desktop:**
- OS: arch linux

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.