Hi all,
I am testing an algorithm in the paper trading environment (real time data) using a subset of cryptocurrencies and I noticed my algorithm was not shooting orders as I expected. Upon further inspection, it seems like my sanequote function returns False for seconds bar.
Here are my crypto subscriptions in initialize:
btceur = self.add_crypto('BTCEUR',resolution=Resolution.SECOND, market=Market.Kraken)
etheur = self.add_crypto('ETHEUR',resolution=Resolution.SECOND, market=Market.Kraken)
xrpeur = self.add_crypto('XRPEUR',resolution=Resolution.SECOND, market=Market.Kraken)
def sanequote(self, bar:QuoteBar) -> bool:
return bar.ask.close > bar.bid.close and bar.LastAskSize > 0 and bar.LastBidSize > 0
The reason is that the ask.close prices are lower than bid.close prices, which seems clearly a bug. Here's a snippet of my algo logs with some examples (all of them are in tz=GMT)
2024-12-17 22:11:39 : QuoteBar is not sane for symbol=BTCEUR => Bid=101970.4@0.05745518 Ask=101200.3@0.26849388, End_Time=2024-12-17 22:11:39
2024-12-17 22:11:39 : QuoteBar is not sane for symbol=ETHEUR => Bid=3805.1@0.00201 Ask=3744.91@41.22146905, End_Time=2024-12-17 22:11:38
2024-12-17 22:12:36 : QuoteBar is not sane for symbol=XRPEUR => Bid=2.56042@2008.20052144 Ask=2.47031@964.35701186, End_Time=2024-12-17 22:12:36
I am using QuantConnect data in my paper trading, albeit the symbols are registered in Kraken exchange. Have any of you encountered this? Have any of you tried using directy Kraken data? Have you encountered the same issues?
Regards,
Axel
Mia Alissi
To address the issue Axel is facing with the
sanequote
function returningFalse
due toask.close
being lower thanbid.close
, let's consider the following steps and insights:Understanding the
QuoteBar
Properties:QuoteBar
class in QuantConnect provides bid and ask prices throughbid
andask
properties, which are of typeData.Market.Bar
. These properties include OHLC (Open, High, Low, Close) values for the bid and ask prices.sanequote
function checks ifbar.ask.close > bar.bid.close
, which is a standard check to ensure that the ask price is higher than the bid price, as expected in a normal market condition.Potential Causes for Inverted Prices:
Steps to Diagnose and Resolve:
QuoteBar
data to verify if the issue is with the data itself or with how it is being processed.By following these steps, Axel can better understand the source of the issue and work towards a resolution. If the problem is persistent and seems to be a data feed issue, contacting QuantConnect support would be a prudent step.
Sources: Data Preparation - QuantConnect.com, Equity Model - QuantConnect.com, US Equities - QuantConnect.com, Handling Data - QuantConnect.com
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.
Caleb Eldredge
I'm interested in this question as well. Been having trouble with Quotebar
Axel Borasino
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!