Skip to content

Commit af6761a

Browse files
committed
More consistent naming
1 parent ab5ae81 commit af6761a

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

src/BinanceBot.Market/Domain/MarketDepth.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ public MarketDepth(MarketSymbol symbol)
5959
/// <summary>
6060
/// The best pair. If the order book is empty, will be returned <see langword="null"/>.
6161
/// </summary>
62-
public MarketDepthPair BestPair => LastUpdateTime.HasValue
63-
? new MarketDepthPair(BestAsk, BestBid, LastUpdateTime.Value)
62+
public MarketDepthPair BestPair => LastUpdateId.HasValue
63+
? new MarketDepthPair(BestAsk, BestBid, LastUpdateId.Value)
6464
: null;
6565

6666
/// <summary>
6767
/// Last update of market depth
6868
/// </summary>
69-
public long? LastUpdateTime { get; private set; }
69+
public long? LastUpdateId { get; private set; }
7070

7171

7272

@@ -77,13 +77,13 @@ public MarketDepth(MarketSymbol symbol)
7777
/// Update market depth
7878
/// </summary>
7979
/// <remarks>
80-
public void UpdateDepth(IEnumerable<BinanceOrderBookEntry> asks, IEnumerable<BinanceOrderBookEntry> bids, long updateTime)
80+
public void UpdateDepth(IEnumerable<BinanceOrderBookEntry> asks, IEnumerable<BinanceOrderBookEntry> bids, long updateId)
8181
{
82-
if (updateTime <= 0)
83-
throw new ArgumentOutOfRangeException(nameof(updateTime));
82+
if (updateId <= 0)
83+
throw new ArgumentOutOfRangeException(nameof(updateId));
8484

8585
// if nothing was changed then return
86-
if (updateTime <= LastUpdateTime) return;
86+
if (updateId <= LastUpdateId) return;
8787
if (asks == null && bids == null) return;
8888

8989

@@ -111,10 +111,10 @@ static void UpdateOrderBook(IEnumerable<BinanceOrderBookEntry> updates, IDiction
111111
UpdateOrderBook(asks, _asks);
112112
UpdateOrderBook(bids, _bids);
113113
// set new update time
114-
LastUpdateTime = updateTime;
114+
LastUpdateId = updateId;
115115

116116
// raise events
117-
OnMarketDepthChanged(new MarketDepthChangedEventArgs(Asks, Bids, LastUpdateTime.Value));
117+
OnMarketDepthChanged(new MarketDepthChangedEventArgs(Asks, Bids, LastUpdateId.Value));
118118
if(!BestPair.Equals(prevBestPair))
119119
OnMarketBestPairChanged(new MarketBestPairChangedEventArgs(BestPair));
120120
}

tests/BinanceBot.Market.Tests/Core/MarketDepthTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void Constructor_WithValidSymbol_CreatesInstance(ContractType contractTyp
2626
// Assert
2727
Assert.Equal(symbol, marketDepth.Symbol);
2828
Assert.Equal(contractType, marketDepth.Symbol.ContractType);
29-
Assert.Null(marketDepth.LastUpdateTime);
29+
Assert.Null(marketDepth.LastUpdateId);
3030
Assert.Empty(marketDepth.Asks);
3131
Assert.Empty(marketDepth.Bids);
3232
}
@@ -58,7 +58,7 @@ public void UpdateDepth_WithValidData_UpdatesOrderBook()
5858
marketDepth.UpdateDepth(asks, bids, 123456);
5959

6060
// Assert
61-
Assert.Equal(123456, marketDepth.LastUpdateTime);
61+
Assert.Equal(123456, marketDepth.LastUpdateId);
6262
Assert.Equal(2, marketDepth.Asks.Count());
6363
Assert.Equal(2, marketDepth.Bids.Count());
6464
Assert.Equal(50000m, marketDepth.BestAsk.Price);
@@ -86,7 +86,7 @@ public void UpdateDepth_WithValidData_UpdatesOrderBook_Perpetual()
8686

8787
// Assert
8888
Assert.Equal(ContractType.Perpetual, marketDepth.Symbol.ContractType);
89-
Assert.Equal(123456, marketDepth.LastUpdateTime);
89+
Assert.Equal(123456, marketDepth.LastUpdateId);
9090
Assert.Equal(2, marketDepth.Asks.Count());
9191
Assert.Equal(2, marketDepth.Bids.Count());
9292
Assert.Equal(50000m, marketDepth.BestAsk.Price);
@@ -116,7 +116,7 @@ public void UpdateDepth_WithOldUpdateTime_IgnoresUpdate()
116116
marketDepth.UpdateDepth(newAsks, bids, 123400);
117117

118118
// Assert - should still have old data
119-
Assert.Equal(123456, marketDepth.LastUpdateTime);
119+
Assert.Equal(123456, marketDepth.LastUpdateId);
120120
Assert.Equal(50000m, marketDepth.BestAsk.Price);
121121
}
122122

0 commit comments

Comments
 (0)