Skip to content

Commit

Permalink
Merge pull request JKorf#46 from ridicoulous/master
Browse files Browse the repository at this point in the history
tuples at SymbolOrderBook events
  • Loading branch information
JKorf authored Aug 12, 2020
2 parents f859f38 + 4b1baf8 commit 99a770b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions CryptoExchange.Net/Interfaces/ISymbolOrderBook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public interface ISymbolOrderBook
/// <summary>
/// Event when order book was updated. Be careful! It can generate a lot of events at high-liquidity markets
/// </summary>
event Action<IEnumerable<ISymbolOrderBookEntry>, IEnumerable<ISymbolOrderBookEntry>> OnOrderBookUpdate;
event Action<(IEnumerable<ISymbolOrderBookEntry> Bids, IEnumerable<ISymbolOrderBookEntry> Asks)> OnOrderBookUpdate;
/// <summary>
/// Event when the BestBid or BestAsk changes ie a Pricing Tick
/// </summary>
event Action<ISymbolOrderBookEntry, ISymbolOrderBookEntry> OnBestOffersChanged;
event Action<(ISymbolOrderBookEntry BestBid, ISymbolOrderBookEntry BestAsk)> OnBestOffersChanged;
/// <summary>
/// Timestamp of the last update
/// </summary>
Expand Down
14 changes: 7 additions & 7 deletions CryptoExchange.Net/OrderBook/SymbolOrderBook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ public OrderBookStatus Status
/// <summary>
/// Event when the BestBid or BestAsk changes ie a Pricing Tick
/// </summary>
public event Action<ISymbolOrderBookEntry, ISymbolOrderBookEntry>? OnBestOffersChanged;
public event Action<(ISymbolOrderBookEntry BestBid, ISymbolOrderBookEntry BestAsk)>? 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
/// 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>
public event Action<IEnumerable<ISymbolOrderBookEntry>, IEnumerable<ISymbolOrderBookEntry>>? OnOrderBookUpdate;
public event Action<(IEnumerable<ISymbolOrderBookEntry> Bids, IEnumerable<ISymbolOrderBookEntry> Asks)>? OnOrderBookUpdate;
/// <summary>
/// Timestamp of the last update
/// </summary>
Expand Down Expand Up @@ -356,8 +356,8 @@ private void ProcessInitialOrderBookItem(InitialOrderBookItem item)
LastOrderBookUpdate = DateTime.UtcNow;
log.Write(LogVerbosity.Debug, $"{Id} order book {Symbol} data set: {BidCount} bids, {AskCount} asks. #{item.EndUpdateId}");
CheckProcessBuffer();
OnOrderBookUpdate?.Invoke(item.Asks, item.Bids);
OnBestOffersChanged?.Invoke(BestBid, BestAsk);
OnOrderBookUpdate?.Invoke((item.Bids, item.Asks));
OnBestOffersChanged?.Invoke((BestBid, BestAsk));
}
}

Expand Down Expand Up @@ -392,7 +392,7 @@ private void ProcessQueueItem(ProcessQueueItem item)
return;
}

OnOrderBookUpdate?.Invoke(item.Bids, item.Asks);
OnOrderBookUpdate?.Invoke((item.Bids, item.Asks));
CheckBestOffersChanged(prevBestBid, prevBestAsk);
}
}
Expand Down Expand Up @@ -601,7 +601,7 @@ private void CheckBestOffersChanged(ISymbolOrderBookEntry prevBestBid, ISymbolOr
var (bestBid, bestAsk) = BestOffers;
if (bestBid.Price != prevBestBid.Price || bestBid.Quantity != prevBestBid.Quantity ||
bestAsk.Price != prevBestAsk.Price || bestAsk.Quantity != prevBestAsk.Quantity)
OnBestOffersChanged?.Invoke(bestBid, bestAsk);
OnBestOffersChanged?.Invoke((bestBid, bestAsk));
}

/// <summary>
Expand Down

0 comments on commit 99a770b

Please sign in to comment.