alpacahq / alpacahq/Alpaca-API

GTC braker order

Aperta
#283 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Nessun dato sulla lingua
Stelle
173
Fork
17
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.