Skip to content

Commit

Permalink
Fix no bid/ask price
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin-Molinero committed Nov 17, 2023
1 parent a720409 commit 62da869
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions QuantConnect.BybitBrokerage.Tests/BybitBrokerageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions QuantConnect.BybitBrokerage/BybitBrokerage.Messaging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 62da869

Please sign in to comment.