alpacahq / alpacahq/alpaca-backtrader-api
stop_limit inconsistency with backtrader (stop_price = pricelimit vs. stop_price = price)
- Lenguaje dominante
- Python
- Estrellas
- 702
- Forks
- 160
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Hi there, I think there is an inconsistency between the implementation of backtrader `StopLimit` order and the alpaca-backtrader-api implemntation of Stop-Limits.
According to backtrader (https://www.backtrader.com/docu/order-creation-execution/order-creation-execution/#stoplimit):
- parameter `price` is the trigger price
- paremeter `plimit` is the limit price
For instance:
`order = self.buy(exectype=Order.StopLimit,
price=self.data.close[0] * 1.02,
plimit=self.data.close[0] * 1.07)
`
But according to line 707 from here: https://github.com/alpacahq/alpaca-backtrader-api/blob/master/alpaca_backtrader_api/alpacastore.py:
`if order.exectype in [bt.Order.StopLimit, bt.Order.Stop]:
okwargs['stop_price'] = order.created.pricelimit`
In other words, the limit price I give to backtrader is used as a trigger price in alpaca.
Please let me know if I missed something. Thanks.
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.