alpacahq / alpacahq/Alpaca-API

GTC braker order

Abierto
#283 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Sin datos de lenguaje
Estrellas
173
Forks
17
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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

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.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.