From what I have learned by researching in the Internet, there are several methods to make the order fill faster. Having a better network infrastructure to reduce latency, using a direct market broker, etc.
One effective way to make the order faster is to bid at a lower price. Now my question is how can I bid in QC with a lower price? is it enough to use a limit order with a lower price?
decimal price = bar.close;
price -= 0.01;
var buyTicket = LimitOrder(symbol, shares, price, tag: "Buy Limit at $" + price);
Thanks
Patrick Star
Sorry, I meant to say buying at a higher price and not lower price.
Alexandre Catarino
I tested three scenarios:
var price = Securities["SPY"].Price; LimitOrder("SPY", 100, price); // 12 secs to fill LimitOrder("SPY", 100, price - 0.01m); // 12 secs to fill LimitOrder("SPY", 100, price + 0.01m); // 2 secs to fill (next bar)
Since limit orders are filled at the price or better, when we placed an order at or below market price, it will wait until the price drops to fill the order.
If you use StopLimitOrder instead:
​var price = Securities["SPY"].Price; StopLimitOrder("SPY", 100, price, price + 0.05m); // 2 secs to fill StopLimitOrder("SPY", 100, price - 0.01m, price + 0.05m); // 2 secs to fill StopLimitOrder("SPY", 100, price + 0.01m, price + 0.05m); // 2 secs to fill
It will be filled within two seconds (next bar) in any scenario. If you increase the stop price (third argument), it will take longer to fill.
Michael Manus
It depends which stock or etf/etn you want to trade. I personally would use AskPrice and BidPrice. SPY in the example above is a high volume ETF. Its like you would trade Nvidia or Facebook with huge daily volume you have a higher probability to get your stocks. But if you trade some crazy stocks (high momentum) like DFFN, TOPS, AUPH, DRYS etc you could be too late. (i think)
Google "Bid-Ask Spread"
Securities["SPY"].AskPrice
Jared Broad
Michael Manus is right but my only addition / caveat is that we don't have equities quotes data so the Securities["SPY"].AskPrice will always be 0. For FX, options, futures we have quote data.
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.
Michael Manus
Oh ok i forgot that. my fault. hmm as your question is like "how to tune my car" someone could presume you want to drive fast...(get into stocks with high momentum very fast)........spy is maybe not the right track to practice,
so you have to check the daily volume and spread/bid for yourself and test with 1 second delay maybe
:)
Patrick Star
Alex,
Thanks a lot for testing these. A few questions:
1- in your examples, the resolution is set to Second? or Tick?
2- when you use Securities["SPY"].Price, is that the same as using the Close attribute on a TradeBar?
3- did you test these in back test? paper trade? or real account / real market?
Thanks again
Patrick Star
Hmm... this is weird. I did not see Michael's comments earlier. Only Jared's was there. I was even about to say to Jared that he may have posted the comment to the wrong thread :p
Anyway, thanks Michael. I wish we had quote data for equity as well but I understand it's just an overwhelming amount of data (and very expensive too) with rare usage for the users.
BTW I forgot to mention that submitting orders in lots makes the fulfillment faster too. In Alex's examples, he is using 100 shares that is an important factor for speed.
Alexandre Catarino - please don't forget to answer my above questions since it's not the last comment... :)
Alexandre Catarino
In my tests, I have used second resolution data in backtesting mode.
Yes, Secutiries["SPY"].Price and data["SPY"].Close have the same value.
In backtesting, the quantity is not an issue when you are using ImmediateFillModel, because it is not take into account.
Patrick Star
Thanks Alex. So in reality it might be different because as we discussed before, volume and ask/bid values matter too which ImmediateFill doesn't consider when filling an order.
One more question. When you use this format:
StopLimitOrder("SPY", 100, price - 0.01m, price + 0.05m); // 2 secs to fill
Does this open two tickets behind the scene? or it's something that Broker handles as a single ticket?
(sorry if it's a stupid question, it's because of my lack of knowledge)
Alexandre Catarino
It is not a stupid question at all. It is a single ticket.
Patrick Star
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!