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

changed some events actions to named tuples for ability more clearly understanding what does exactly happened. fixes typo at OnOrderBookUpdate event invocation

This commit is contained in:
Артем Курьянов 2020-08-11 15:52:26 +00:00
parent 3cd54847c7
commit 4b1baf8b82
2 changed files with 9 additions and 9 deletions

View File

@ -31,11 +31,11 @@ namespace CryptoExchange.Net.Interfaces
/// <summary> /// <summary>
/// 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>
event Action<IEnumerable<ISymbolOrderBookEntry>, IEnumerable<ISymbolOrderBookEntry>> OnOrderBookUpdate; event Action<(IEnumerable<ISymbolOrderBookEntry> Bids, IEnumerable<ISymbolOrderBookEntry> Asks)> OnOrderBookUpdate;
/// <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> OnBestOffersChanged; event Action<(ISymbolOrderBookEntry BestBid, ISymbolOrderBookEntry BestAsk)> OnBestOffersChanged;
/// <summary> /// <summary>
/// Timestamp of the last update /// Timestamp of the last update
/// </summary> /// </summary>

View File

@ -96,12 +96,12 @@ 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>? OnBestOffersChanged; public event Action<(ISymbolOrderBookEntry BestBid, ISymbolOrderBookEntry BestAsk)>? 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
/// </summary> /// </summary>
public event Action<IEnumerable<ISymbolOrderBookEntry>, IEnumerable<ISymbolOrderBookEntry>>? OnOrderBookUpdate; public event Action<(IEnumerable<ISymbolOrderBookEntry> Bids, IEnumerable<ISymbolOrderBookEntry> Asks)>? OnOrderBookUpdate;
/// <summary> /// <summary>
/// Timestamp of the last update /// Timestamp of the last update
/// </summary> /// </summary>
@ -356,8 +356,8 @@ namespace CryptoExchange.Net.OrderBook
LastOrderBookUpdate = DateTime.UtcNow; LastOrderBookUpdate = DateTime.UtcNow;
log.Write(LogVerbosity.Debug, $"{Id} order book {Symbol} data set: {BidCount} bids, {AskCount} asks. #{item.EndUpdateId}"); log.Write(LogVerbosity.Debug, $"{Id} order book {Symbol} data set: {BidCount} bids, {AskCount} asks. #{item.EndUpdateId}");
CheckProcessBuffer(); CheckProcessBuffer();
OnOrderBookUpdate?.Invoke(item.Asks, item.Bids); OnOrderBookUpdate?.Invoke((item.Bids, item.Asks));
OnBestOffersChanged?.Invoke(BestBid, BestAsk); OnBestOffersChanged?.Invoke((BestBid, BestAsk));
} }
} }
@ -392,7 +392,7 @@ namespace CryptoExchange.Net.OrderBook
return; return;
} }
OnOrderBookUpdate?.Invoke(item.Bids, item.Asks); OnOrderBookUpdate?.Invoke((item.Bids, item.Asks));
CheckBestOffersChanged(prevBestBid, prevBestAsk); CheckBestOffersChanged(prevBestBid, prevBestAsk);
} }
} }
@ -601,7 +601,7 @@ namespace CryptoExchange.Net.OrderBook
var (bestBid, bestAsk) = BestOffers; var (bestBid, bestAsk) = BestOffers;
if (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); OnBestOffersChanged?.Invoke((bestBid, bestAsk));
} }
/// <summary> /// <summary>