alpacahq / alpacahq/Alpaca-API

GTC braker order

Đang mở
#283 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
173
Fork
17
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

**Describe the bug**
When plasing an order with stop loss and target, the inner time_in_force is ignored

**To Reproduce**
with this body in the request
body = {
"symbol": ticker,
"qty": str(qty),
"side": "buy",
"type": "market",
"time_in_force": "day",
"order_class": "bracket",
"take_profit": {
"limit_price": str(round(take_profit, 2)),
"time_in_force": "gtc"
},
"stop_loss": {
"stop_price": str(round(stop_loss, 2)),
"time_in_force": "gtc"
}
}

the take_profit and stop_loss are not respecting the time_in_force as gtc, so it is always setting them as "day"

**Expected behavior**
take_profit and stop_loss should be "gtc" while the main order should be "day"

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
the walk around for this is to first add the normal order and then post the bracket order, the problem is that if there is a delay in Alpaca I get penalized with " potential wash trade detected. use complex orders"
so I have to put timers and delays on the code which is not great.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.