alpacahq / alpacahq/Alpaca-API
Ability to add stop / take profit to existing open position
- Lenguaje dominante
- Sin datos de lenguaje
- Estrellas
- 173
- Forks
- 17
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
**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
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.