Example #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="api">Exchange API</param>
 /// <param name="name">Exchange name</param>
 /// <param name="symbol">The symbol to trade by default</param>
 public ExchangeInfo(IExchangeAPI api, string name, string symbol)
 {
     API       = api;
     Name      = name;
     Symbols   = api.GetSymbols();
     TradeInfo = new ExchangeTradeInfo(this, symbol);
 }
Example #2
0
 private static void ValidateSymbols(IExchangeAPI api, string[] symbols)
 {
     string[] apiSymbols = api.GetSymbols().ToArray();
     foreach (string symbol in symbols)
     {
         if (!apiSymbols.Contains(symbol))
         {
             throw new ArgumentException(string.Format("Symbol {0} does not exist in API {1}, valid symbols: {2}", symbol, api.Name, string.Join(",", apiSymbols.OrderBy(s => s))));
         }
     }
 }
Example #3
0
        public static void DisplaySymbols(this IExchangeAPI api)
        {
            Console.WriteLine("\n{0}", new string('-', 60));
            int count   = 0;
            var symbols = api.GetSymbols();

            foreach (var s in symbols)
            {
                Console.WriteLine("{0,4}  {1}  {2}", ++count, api.Name, s);
            }
        }
Example #4
0
 public void PrintSymbols(IExchangeAPI api)
 {
     api.GetSymbols().ToList().ForEach(s => Console.WriteLine(s));
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="api">Exchange API</param>
 /// <param name="symbol">The symbol to trade by default, can be null</param>
 public ExchangeInfo(IExchangeAPI api, string symbol = null)
 {
     API       = api;
     Symbols   = api.GetSymbols().ToArray();
     TradeInfo = new ExchangeTradeInfo(this, symbol);
 }