1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-08 00:16:27 +00:00

Renamed OnPriceChanged to OnBestOffersChanged

This commit is contained in:
JKorf 2020-01-23 14:00:58 +01:00
parent 7abdc0b683
commit ccaf1da5c9
3 changed files with 12 additions and 15 deletions

View File

@ -797,7 +797,7 @@
Event when order book was updated. Be careful! It can generate a lot of events at high-liquidity markets Event when order book was updated. Be careful! It can generate a lot of events at high-liquidity markets
</summary> </summary>
</member> </member>
<member name="E:CryptoExchange.Net.Interfaces.ISymbolOrderBook.OnPriceChanged"> <member name="E:CryptoExchange.Net.Interfaces.ISymbolOrderBook.OnBestOffersChanged">
<summary> <summary>
Event when the BestBid or BestAsk changes ie a Pricing Tick Event when the BestBid or BestAsk changes ie a Pricing Tick
</summary> </summary>
@ -1774,7 +1774,7 @@
Event when the state changes Event when the state changes
</summary> </summary>
</member> </member>
<member name="E:CryptoExchange.Net.OrderBook.SymbolOrderBook.OnPriceChanged"> <member name="E:CryptoExchange.Net.OrderBook.SymbolOrderBook.OnBestOffersChanged">
<summary> <summary>
Event when the BestBid or BestAsk changes ie a Pricing Tick Event when the BestBid or BestAsk changes ie a Pricing Tick
</summary> </summary>

View File

@ -35,7 +35,7 @@ namespace CryptoExchange.Net.Interfaces
/// <summary> /// <summary>
/// Event when the BestBid or BestAsk changes ie a Pricing Tick /// Event when the BestBid or BestAsk changes ie a Pricing Tick
/// </summary> /// </summary>
event Action<ISymbolOrderBookEntry, ISymbolOrderBookEntry> OnPriceChanged; event Action<ISymbolOrderBookEntry, ISymbolOrderBookEntry> OnBestOffersChanged;
/// <summary> /// <summary>
/// Timestamp of the last update /// Timestamp of the last update
/// </summary> /// </summary>

View File

@ -83,7 +83,7 @@ namespace CryptoExchange.Net.OrderBook
/// <summary> /// <summary>
/// Event when the BestBid or BestAsk changes ie a Pricing Tick /// Event when the BestBid or BestAsk changes ie a Pricing Tick
/// </summary> /// </summary>
public event Action<ISymbolOrderBookEntry, ISymbolOrderBookEntry>? OnPriceChanged; public event Action<ISymbolOrderBookEntry, ISymbolOrderBookEntry>? OnBestOffersChanged;
/// <summary> /// <summary>
/// Event when order book was updated, containing the changed bids and asks. Be careful! It can generate a lot of events at high-liquidity markets /// Event when order book was updated, containing the changed bids and asks. Be careful! It can generate a lot of events at high-liquidity markets
@ -292,14 +292,15 @@ namespace CryptoExchange.Net.OrderBook
log.Write(LogVerbosity.Debug, $"{Id} order book {Symbol} data set: {BidCount} bids, {AskCount} asks. #{orderBookSequenceNumber}"); log.Write(LogVerbosity.Debug, $"{Id} order book {Symbol} data set: {BidCount} bids, {AskCount} asks. #{orderBookSequenceNumber}");
CheckProcessBuffer(); CheckProcessBuffer();
OnOrderBookUpdate?.Invoke(bidList, askList); OnOrderBookUpdate?.Invoke(bidList, askList);
OnPriceChanged?.Invoke(BestBid, BestAsk); OnBestOffersChanged?.Invoke(BestBid, BestAsk);
} }
} }
private bool BestPricingUpdated(ISymbolOrderBookEntry prevBestBid, ISymbolOrderBookEntry prevBestAsk) private void CheckBestOffersChanged(ISymbolOrderBookEntry prevBestBid, ISymbolOrderBookEntry prevBestAsk)
{ {
return BestBid.Price != prevBestBid.Price || BestBid.Quantity != prevBestBid.Quantity || if (BestBid.Price != prevBestBid.Price || BestBid.Quantity != prevBestBid.Quantity ||
BestAsk.Price != prevBestAsk.Price || BestAsk.Quantity != prevBestAsk.Quantity; BestAsk.Price != prevBestAsk.Price || BestAsk.Quantity != prevBestAsk.Quantity)
OnBestOffersChanged?.Invoke(BestBid, BestAsk);
} }
/// <summary> /// <summary>
@ -332,8 +333,7 @@ namespace CryptoExchange.Net.OrderBook
var prevBestAsk = BestAsk; var prevBestAsk = BestAsk;
ProcessSingleSequenceUpdates(rangeUpdateId, bids, asks); ProcessSingleSequenceUpdates(rangeUpdateId, bids, asks);
OnOrderBookUpdate?.Invoke(bids, asks); OnOrderBookUpdate?.Invoke(bids, asks);
if (BestPricingUpdated(prevBestBid, prevBestAsk)) CheckBestOffersChanged(prevBestBid, prevBestAsk);
OnPriceChanged?.Invoke(BestBid, BestAsk);
} }
} }
} }
@ -370,8 +370,7 @@ namespace CryptoExchange.Net.OrderBook
var prevBestAsk = BestAsk; var prevBestAsk = BestAsk;
ProcessRangeUpdates(firstUpdateId, lastUpdateId, bids, asks); ProcessRangeUpdates(firstUpdateId, lastUpdateId, bids, asks);
OnOrderBookUpdate?.Invoke(bids, asks); OnOrderBookUpdate?.Invoke(bids, asks);
if (BestPricingUpdated(prevBestBid, prevBestAsk)) CheckBestOffersChanged(prevBestBid, prevBestAsk);
OnPriceChanged?.Invoke(BestBid, BestAsk);
} }
} }
} }
@ -401,9 +400,7 @@ namespace CryptoExchange.Net.OrderBook
var prevBestAsk = BestAsk; var prevBestAsk = BestAsk;
ProcessUpdates(bids, asks); ProcessUpdates(bids, asks);
OnOrderBookUpdate?.Invoke(bids, asks); OnOrderBookUpdate?.Invoke(bids, asks);
if (BestPricingUpdated(prevBestBid, prevBestAsk)) CheckBestOffersChanged(prevBestBid, prevBestAsk);
OnPriceChanged?.Invoke(BestBid, BestAsk);
} }
} }
} }