Hi,
I need to know if an Order has been "Submitted" or "Filled". This isn't working:
First attempt)
if( ticket.Status.ToString() == OrderStatus.Submitted.ToString() )
Second attempt)
if( ticket.Status.ToString() == "Submitted" )
Thanks !
QUANTCONNECT COMMUNITY
Hi,
I need to know if an Order has been "Submitted" or "Filled". This isn't working:
First attempt)
if( ticket.Status.ToString() == OrderStatus.Submitted.ToString() )
Second attempt)
if( ticket.Status.ToString() == "Submitted" )
Thanks !
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.
Raimon Paniagua Salvatella
if I try this:
if ( ticket.Status == OrderStatus.Filled )
Jared Broad
HI Raimon! Please share your algorithm for us to be able to help further. If you're not able to share please see this forum thread for examples of how to use the order event system.
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.
Raimon Paniagua Salvatella
Write comment here.
Guanting Liu
First, to compare strings, avoid using string1 == string2, instead use string1.Equals(string2), whose result is more guaranteed. This is true for many programming languages, you can google it for more detail.Second, in your specificase, you should probable do this:ticket.Status == OrderStatus.SubmittedPlease try it! ;)
Raimon Paniagua Salvatella
Thanks Guanting Liu for the comment.
But I have tryied this two ways and aren't working. If you look at my backtest code you can see this.
Really don't know what's the problem with:
ticket.Status == OrderStatus.Submitted
Thanks again!
Jared Broad
Its failing because you don't have 2 orders, so the if (openOrders.count == 2) isn't returning true.
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.
Raimon Paniagua Salvatella
So gratefull for the assistance,
but:
(openOrders.Count == 2)
is returning true as you can see in this backtest ->
Jared Broad
are never being called
Feel free to share a simpler algorithm proof if you think there's a bug.
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.
Raimon Paniagua Salvatella
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!