alpacahq / alpacahq/Alpaca-API

Ability to add stop / take profit to existing open position

Đang mở
#279 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ả

**Is your feature request related to a problem? Please describe.**
Often with existing open positions, I want to add a stop AND a take profit. I have the ability to place a stop OR take profit order, but I can't add both (except on initial order creation).

In addition, if either the stop or TP get cancelled, you can't recreate the order, it errors : 'Order failed: insufficient qty available for order'. For example, If I have a stock with day long position, has a TP and stop. Both the TP and stop are canceled at EOD. I can not recreate BOTH the TP and the stop, I can only create one or the other.

**Describe the solution you'd like**
Please add the ability to add a stop AND a TP order to an existing open position. So we have the same behavior as when we create the initial buy order. (As Described here https://docs.alpaca.markets/reference/postorder)

I can foresee the potential for order conflict. Perhaps the correct way to structure it is either:
- Add the ability to update via the positions endpoint, which allows for adding a take profit/stop price (This feels more intuitive to me)
- on the orders endpoint, add the position ID for stop/TP orders

**Describe alternatives you've considered**
The only work around I have at the moment, is to re-create a stop order, then code to manage the sell at the TP level.

**Additional context**
A couple GUI examples of the final results
https://drive.google.com/drive/folders/16cVYoAm1p3bPpWkXjWse1GgeYLOzNduA

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.