Hello,
I am not seeing StopPrice updated when stop orders are updated.
My algo is iterating through open orders (for order in Open_orders) then calling a function to recalculate and update the stops. I want to view the updated stop price based on the order but Get(orderField.StopPrice) returns the original stop.
I coded a work around to pass additional data between functions, but this is a sub-optimal solution since that data was not required by the function, but only there to get around not being able to get the correct stop price.
market_order = self.MarketOrder(security, 100)
stop_order_ticket = self.StopMarketOrder(security, -100, 10.00)
stop_price = stop_order_ticket.Get(OrderField.StopPrice)
# Update stop
update_stop = UpdateOrderFields()
update_stop.StopPrice = 20.00
updated_stop_order_ticket = stop_order_ticket.Update(update_stop) # Works: order updated with new stop
updated_stop_price = stop_order_ticket.Get(OrderField.StopPrice) # New stop price not returned
I find it confusing that creating an order and updating an order return different data types.
The documentation on this was not sufficiently clear to me. The docs pages described "how to" do certain things, but I would also request a separate reference laying out by function (in this case orders), which helpers / classes exist, and inputs, methods and results for these.
Thanks…M.
Fred Painchaud
Hi Bad Dog,
I can't help you with the updated stop order ticket not updating its stop price. I don't know if it is intended to work otherwise or it's a bug.
However, an order ticket and the fields to update an order ticket, at least to me, align well with two different structures / types / classes. The UpdateOrderFields is there simply to package all possible updatable fields on one structure and feed that to Update instead of having multiple calls for multiple fields. But updatable fields are not what makes the entire order ticket… so both are different.
Now for your docs describing what I believe is the API, that's what you want right?, there it is:
https://lean-api-docs.netlify.app/index.html
It's a trade secret however, so sssshhhhhhhh. (pun intended)
Fred
Bad Dog
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.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!