Skip to content

Commit eb7e60d

Browse files
committed
Improve output format
1 parent af6761a commit eb7e60d

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

src/BinanceBot.MarketViewer.Console/Program.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal static class Program
2121
{
2222
#region Bot Settings
2323
// WARN: Set necessary token here
24-
private static readonly MarketSymbol Symbol = new MarketSymbol("BNB", "USDT", ContractType.Spot);
24+
private static readonly MarketSymbol Symbol = new MarketSymbol("BNB", "USDT", ContractType.Perpetual);
2525
private const int OrderBookDepth = 10;
2626
private static readonly TimeSpan OrderBookUpdateInterval = TimeSpan.FromMilliseconds(100);
2727
#endregion
@@ -85,7 +85,6 @@ await AnsiConsole.Status()
8585
var asks = e.Asks.OrderBy(q => q.Price).Take(OrderBookDepth).ToImmutableArray();
8686
var bids = e.Bids.OrderByDescending(q => q.Price).Take(OrderBookDepth).ToImmutableArray();
8787

88-
8988
orderBookTable.Rows.Clear();
9089

9190
foreach (var row in GetValues(asks))
@@ -95,8 +94,8 @@ await AnsiConsole.Status()
9594
orderBookTable.AddRow(String.Empty, $"[green]{row.price}[/]", row.volume);
9695

9796
orderBookTable.Caption = new TableTitle(
98-
$"Spread: {e.Asks.Select(q => q.Price).Min() - e.Bids.Select(q => q.Price).Max()}. " +
99-
$"Last updated as {DateTimeOffset.FromUnixTimeSeconds(e.UpdateTime):T}\n"
97+
$"Spread: {e.Asks.Select(q => q.Price).Min() - e.Bids.Select(q => q.Price).Max()}\n" +
98+
$"Update Id: {e.UpdateTime} at {DateTimeOffset.UtcNow:HH:mm:ss.FFF} (UTC+0)\n"
10099
);
101100

102101
var dominanceChart = new BreakdownChart()
@@ -109,6 +108,8 @@ await AnsiConsole.Status()
109108

110109
AnsiConsole.Write(orderBookTable);
111110
AnsiConsole.Write(dominanceChart);
111+
112+
WriteLine("Press Enter to exit...");
112113
};
113114

114115

@@ -117,10 +118,7 @@ await AnsiConsole.Status()
117118
await marketDepthManager.BuildAsync(marketDepth, OrderBookDepth, OrderBookUpdateInterval, ct);
118119
Logger.Info("Order book ready and streaming updates...");
119120

120-
121-
WriteLine("Press Enter to exit...");
122121
ReadLine();
123-
124122
Logger.Info("Order book viewer stopped");
125123
}
126124
}

0 commit comments

Comments
 (0)