diff --git a/QuantConnect.BybitBrokerage.Tests/BybitBrokerageTests.Stream.cs b/QuantConnect.BybitBrokerage.Tests/BybitBrokerageTests.Stream.cs index 7a7c2dc..79a2d63 100644 --- a/QuantConnect.BybitBrokerage.Tests/BybitBrokerageTests.Stream.cs +++ b/QuantConnect.BybitBrokerage.Tests/BybitBrokerageTests.Stream.cs @@ -33,6 +33,7 @@ private static TestCaseData[] TestParameters return new[] { // valid parameters, for example + new TestCaseData(MCUSDT, Resolution.Second, false), new TestCaseData(BTCUSDT, Resolution.Tick, false), new TestCaseData(BTCUSDT, Resolution.Minute, false), new TestCaseData(BTCUSDT, Resolution.Second, false), diff --git a/QuantConnect.BybitBrokerage.Tests/BybitBrokerageTests.cs b/QuantConnect.BybitBrokerage.Tests/BybitBrokerageTests.cs index 343fe89..6bf5e59 100644 --- a/QuantConnect.BybitBrokerage.Tests/BybitBrokerageTests.cs +++ b/QuantConnect.BybitBrokerage.Tests/BybitBrokerageTests.cs @@ -36,6 +36,7 @@ namespace QuantConnect.BybitBrokerage.Tests [TestFixture, Explicit("Requires valid credentials to be setup and run outside USA")] public partial class BybitBrokerageTests : BrokerageTests { + private static Symbol MCUSDT = Symbol.Create("MCUSDT", SecurityType.CryptoFuture, "bybit"); private static Symbol BTCUSDT = Symbol.Create("BTCUSDT", SecurityType.Crypto, "bybit"); private BybitApi _client; protected override Symbol Symbol { get; } = BTCUSDT; diff --git a/QuantConnect.BybitBrokerage/BybitBrokerage.Messaging.cs b/QuantConnect.BybitBrokerage/BybitBrokerage.Messaging.cs index e36dcff..c690af7 100644 --- a/QuantConnect.BybitBrokerage/BybitBrokerage.Messaging.cs +++ b/QuantConnect.BybitBrokerage/BybitBrokerage.Messaging.cs @@ -326,6 +326,11 @@ private void HandleOrderBookSnapshot(BybitOrderBookUpdate orderBookUpdate, Bybit } orderBook.BestBidAskUpdated += OnBestBidAskUpdated; + if(orderBook.BestBidPrice == 0 && orderBook.BestAskPrice == 0) + { + // nothing to emit, can happen with illiquid assets + return; + } EmitQuoteTick(symbol, orderBook.BestBidPrice, orderBook.BestBidSize, orderBook.BestAskPrice, orderBook.BestAskSize); }