I am trying a paper trade of an algo, but its trading some thinly traded stocks. Executions are way off the back test because bid and ask are moving without the stock trading.
QUANTCONNECT COMMUNITY
I am trying a paper trade of an algo, but its trading some thinly traded stocks. Executions are way off the back test because bid and ask are moving without the stock trading.
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.
Guanting Liu
I had been curious to ask the same quetion. From my understanding though,bid/ask data is not available for backtesting, which seem to be common for possibly all backtest or algotrading platform. But this seem to be reasonable - just image how much more data would need to be saved for not only every tick, but also every bid/ask change. I guess in reality, the tightest bid/ask pair should change much more frequently than stock tick.So if bid/ask is not available for backtest, then it would probably not be valuable in livetrading, because any algorithm that has to do with bid/ask in certain degree cannot be validated first via backtesting. As a result, I guess nowadays there is typically no support for getting realtime bid/ask quotes in most algotrading engine. But anyway I still think being able to get realtime bid/ask quotes is cool.Now that accurate bid/ask quote is not available to your algorithm both during backtest and in live trading, there is something you can do to solve your problem. That includes tuning the slippage model, which is an available feature for this purpose on most backtesting engines and platforms, including QuantConnect and lean, to provide approximation on the actual execution price vs the close price you get in your algorithm, based on your specific security type and its liquidity. That also includes using limit order, with an estimation of bid/ask quotes as within certain percentage of the close price, as the limit price.Just my personal thoughts. Not the official answer. :)
Guanting Liu
To wrap it up, here is at leat what you can do (or what I will do if I were in your case):
1. Customize your slippage model to provide better al
2. Think of the bid/ask quotes to be within a certain price or percentage delta from the latest tick price at that moment.
Guanting Liu
provide better approximation on actual execution price, so that you have more realistic backtest results.
Winston
Hi, I am new to QC and would like to ask the same question: is there a way to get the bid-ask spread during live trading? From Guanting's replies above, I understand it's not possible in backtesting or even papertrading, but what about live trading (I'm using IB)?
William Patterson
I've used data.Ask and data.Bid for spread checks in a forex algorithm, perhaps those?
Jared Broad
In backtesting whether quote data (Bid/Ask) is available depends on the data you're requesting. We provide as much quote data as possible (futures, options, forex, cfd) but do not provide equity quotes at this time.
In live trading its easier to do but has limited use as its not standardized with backtesting. Once we add backtesting-quote-equity support we'll add it in live.
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.
Winston
Thanks William/Jared, seems like we'll have to wait a bit more.
Jared Broad
As Guanting Liu mentions you can also effectively model spread with price and volume 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.
Cary Cocke
I just need bid/ask spread, OHLCV, and a time/date stamp.
Jack Simonson
Hi Cary,
We're working on implementing equities quote data right now and hope to have it finished soon. You can follow the progress of this by subscribing to the GitHub issue.
Kanat Mergenbayev
Hi is it possible to trade options on at least mid price (ask - bid)/2 + bid? As i understand market orders if sell executes on bid buy on ask. How cen i get current bid ask prices for options?
Rahul Chowdhury
Hey Kanat,
For a given OptionsContract you can access its ask/bid using
ask = contract.AskPrice bid = contract.BidPrice
To fill an order at a specific price, you can use a limit order.
mid = (ask+bid)/2 self.LimitOrder(contract.Symbol, 1, mid)
Â
Ed Jassin
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!