Files
spark/src/client/spark_api_server/DumpBooksOptions.cs
T

51 lines
1.5 KiB
C#

namespace Spark.Api.Server {
using bts.utils;
using CommandLine;
using Spark.Core;
using System.Collections.Generic;
[Verb("dump-books")]
public class DumpBooksOptions {
#if DEBUG
const string _default_user = "bts";
#else
const string _default_user = "";
#endif
[Option("user", Default = _default_user)]
public string? user { get; set; }
[Option("password", Default = "")]
public string? password { get; set; }
[Option("sparkd", MetaValue = "URL", HelpText = "The sparkd server")]
public string? sparkd { get; set; }
[Option("securities", HelpText = "The securities for which to dump books", Separator = ' ')]
public IEnumerable<string>? securities { get; set; }
[Option("num-levels", HelpText = "The number of price levels to show (per side)", Default = 5)]
public int num_levels { get; set; }
[Option("price-width", HelpText = "The price column width", Default = 10)]
public int price_width { get; set; }
[Option("quantity-width", HelpText = "The quantity column width", Default = 10)]
public int quantity_width { get; set; }
public override string ToString() =>
TableFormatter.fmt_table(new (string, object?)[] {
("user", user),
("password", password),
("sparkd", sparkd),
("securities", ", ".join(securities.empty_if_null())),
("num-levels", num_levels),
("price-width", price_width),
("quantity-width", quantity_width),
});
}
}