alpacahq / alpacahq/Alpaca-API

Ability to add stop / take profit to existing open position

オープン
#279 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
言語のデータがありません
スター
173
フォーク
17
PR マージ指標
30日以内にマージされた PR はありません

説明

**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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。