1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-07 16:06:15 +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
</summary>
</member>
<member name="E:CryptoExchange.Net.Interfaces.ISymbolOrderBook.OnPriceChanged">
<member name="E:CryptoExchange.Net.Interfaces.ISymbolOrderBook.OnBestOffersChanged">
<summary>
Event when the BestBid or BestAsk changes ie a Pricing Tick
</summary>
@ -1774,7 +1774,7 @@
Event when the state changes
</summary>
</member>
<member name="E:CryptoExchange.Net.OrderBook.SymbolOrderBook.OnPriceChanged">
<member name="E:CryptoExchange.Net.OrderBook.SymbolOrderBook.OnBestOffersChanged">
<summary>
Event when the BestBid or BestAsk changes ie a Pricing Tick
</summary>

View File

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

View File

@ -83,7 +83,7 @@ namespace CryptoExchange.Net.OrderBook
/// <summary>
/// Event when the BestBid or BestAsk changes ie a Pricing Tick
/// </summary>
public event Action<ISymbolOrderBookEntry, ISymbolOrderBookEntry>? OnPriceChanged;
public event Action<ISymbolOrderBookEntry, ISymbolOrderBookEntry>? OnBestOffersChanged;
/// <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
@ -292,14 +292,15 @@ namespace CryptoExchange.Net.OrderBook
log.Write(LogVerbosity.Debug, $"{Id} order book {Symbol} data set: {BidCount} bids, {AskCount} asks. #{orderBookSequenceNumber}");
CheckProcessBuffer();
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 ||
BestAsk.Price != prevBestAsk.Price || BestAsk.Quantity != prevBestAsk.Quantity;
if (BestBid.Price != prevBestBid.Price || BestBid.Quantity != prevBestBid.Quantity ||
BestAsk.Price != prevBestAsk.Price || BestAsk.Quantity != prevBestAsk.Quantity)
OnBestOffersChanged?.Invoke(BestBid, BestAsk);
}
/// <summary>
@ -332,8 +333,7 @@ namespace CryptoExchange.Net.OrderBook
var prevBestAsk = BestAsk;
ProcessSingleSequenceUpdates(rangeUpdateId, bids, asks);
OnOrderBookUpdate?.Invoke(bids, asks);
if (BestPricingUpdated(prevBestBid, prevBestAsk))
OnPriceChanged?.Invoke(BestBid, BestAsk);
CheckBestOffersChanged(prevBestBid, prevBestAsk);
}
}
}
@ -370,8 +370,7 @@ namespace CryptoExchange.Net.OrderBook
var prevBestAsk = BestAsk;
ProcessRangeUpdates(firstUpdateId, lastUpdateId, bids, asks);
OnOrderBookUpdate?.Invoke(bids, asks);
if (BestPricingUpdated(prevBestBid, prevBestAsk))
OnPriceChanged?.Invoke(BestBid, BestAsk);
CheckBestOffersChanged(prevBestBid, prevBestAsk);
}
}
}
@ -401,9 +400,7 @@ namespace CryptoExchange.Net.OrderBook
var prevBestAsk = BestAsk;
ProcessUpdates(bids, asks);
OnOrderBookUpdate?.Invoke(bids, asks);
if (BestPricingUpdated(prevBestBid, prevBestAsk))
OnPriceChanged?.Invoke(BestBid, BestAsk);
CheckBestOffersChanged(prevBestBid, prevBestAsk);
}
}
}