Back

Python example on order types, limitorder

            # submit a limit order to buy 10 shares at .1% below the bar's close
            close = self.Securities[self.spy.Value].Close
            newTicket = self.LimitOrder(self.spy, 10, close * d.Decimal(.999))
            self.__openLimitOrders.append(newTicket)

            # submit another limit order to sell 10 shares at .1% above the bar's close
            newTicket = self.LimitOrder(self.spy, 10, close * d.Decimal(1.001))
            self.__openLimitOrders.append(newTicket)


In your example on github there should be a - before the quantity in the sell example. It is missing right now.

Update Backtest








Hi David, thanks for point it out. It has now been corrected.

https://github.com/QuantConnect/Lean/pull/1505/commits/b94e62f796fa7e1b23b40ebf54fee677e5b6401a
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed