예제 #1
0
        public void Throws()
        {
            const CandlestickInterval interval = CandlestickInterval.Hour;

            Assert.Throws <ArgumentNullException>("symbol", () => _client.Subscribe((string)null, interval));
            Assert.Throws <ArgumentNullException>("symbol", () => _client.Subscribe(string.Empty, interval));

            Assert.Throws <ArgumentNullException>("symbol", () => _client.Unsubscribe((string)null, interval));
            Assert.Throws <ArgumentNullException>("symbol", () => _client.Unsubscribe(string.Empty, interval));
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="client"></param>
        /// <param name="callback"></param>
        /// <param name="interval"></param>
        /// <param name="symbols"></param>
        public static ICandlestickClient Subscribe(this ICandlestickClient client, Action <CandlestickEventArgs> callback, CandlestickInterval interval, params string[] symbols)
        {
            Throw.IfNull(client, nameof(client));
            Throw.IfNull(symbols, nameof(symbols));

            if (callback == null && !symbols.Any())
            {
                throw new ArgumentException($"{nameof(Subscribe)}: At least one symbol is required.", nameof(symbols));
            }

            foreach (var symbol in symbols)
            {
                client.Subscribe(symbol, interval, callback);
            }

            return(client);
        }
예제 #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="client"></param>
 /// <param name="symbol"></param>
 /// <param name="interval"></param>
 /// <returns></returns>
 public static ICandlestickClient Subscribe(this ICandlestickClient client, string symbol, CandlestickInterval interval)
 => client.Subscribe(symbol, interval, null);