alpacahq / alpacahq/Alpaca-API

GTC braker order

Ouverte
#283 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Aucune donnée de langage
Étoiles
173
Forks
17
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.