Exemplo n.º 1
0
 /// <summary>
 /// The data field is a list containing one or more trade objects. The server may combine consecutive trades with the same price and bm value into one aggregated item. Each trade object contains the following fields:
 /// </summary>
 /// <param name="symbols">Trading Symbols List</param>
 /// <param name="period">Candle Period</param>
 /// <param name="onData">On Data Handler</param>
 /// <returns></returns>
 public virtual CallResult <UpdateSubscription> SubscribeToCandles(IEnumerable <string> symbols, BitMaxPeriod period, Action <BitMaxSocketCandle> onData) => SubscribeToCandlesAsync(symbols, period, onData).Result;
Exemplo n.º 2
0
        /// <summary>
        /// The data field is a list containing one or more trade objects. The server may combine consecutive trades with the same price and bm value into one aggregated item. Each trade object contains the following fields:
        /// </summary>
        /// <param name="symbols">Trading Symbols List</param>
        /// <param name="period">Candle Period</param>
        /// <param name="onData">On Data Handler</param>
        /// <returns></returns>
        public virtual async Task <CallResult <UpdateSubscription> > SubscribeToCandlesAsync(IEnumerable <string> symbols, BitMaxPeriod period, Action <BitMaxSocketCandle> onData)
        {
            var internalHandler = new Action <BitMaxSocketBarChannelResponse <BitMaxSocketCandle> >(data =>
            {
                data.Data.Symbol = data.Symbol;
                onData(data.Data);
            });

            var period_s = JsonConvert.SerializeObject(period, new PeriodConverter(false));
            var request  = new BitMaxSocketCashChannelRequest(NextRequestId(), BitMaxSocketCashChannelOperation.Subscribe, "bar:" + period_s + ":" + string.Join(",", symbols));

            return(await Subscribe(request, "bar", false, internalHandler).ConfigureAwait(false));
        }
Exemplo n.º 3
0
 /// <summary>
 /// The data field is a list containing one or more trade objects. The server may combine consecutive trades with the same price and bm value into one aggregated item. Each trade object contains the following fields:
 /// </summary>
 /// <param name="symbol">Trading Symbol</param>
 /// <param name="period">Candle Period</param>
 /// <param name="onData">On Data Handler</param>
 /// <returns></returns>
 public virtual CallResult <UpdateSubscription> SubscribeToCandles(string symbol, BitMaxPeriod period, Action <BitMaxSocketCandle> onData) => SubscribeToCandlesAsync(new List <string> {
     symbol
 }, period, onData).Result;