Ejemplo n.º 1
0
        public TickerPriceResponse GetPriceValue(AvailableStrategy availableStrategy)
        {
            var result = new TickerPriceResponse();

            var response = _kucoinClient.GetTicker(availableStrategy.Symbol);

            if (response.Success)
            {
                result.SetResult(response.Data.LastTradePrice.GetValueOrDefault());
            }
            else
            {
                result.Message = response.Error.Message;
            }

            return(result);
        }
Ejemplo n.º 2
0
        public TickerPriceResponse GetPriceValue(AvailableStrategy availableStrategy)
        {
            var result = new TickerPriceResponse();

            var response = _binanceClient.Spot.Market.GetPrice(availableStrategy.Symbol);

            if (response.Success)
            {
                result.SetResult(response.Data.Price);
            }
            else
            {
                result.Message = response.Error.Message;
            }

            return(result);
        }
Ejemplo n.º 3
0
        public TickerContextResponse GetPriceValue(AvailableStrategy availableStrategy)
        {
            var result = new TickerContextResponse();

            if (availableStrategy.TickerType == TickerType.CURRENTPRICE)
            {
                var response = _binanceClient.GetPrice(availableStrategy.Symbol);

                if (response.Success)
                {
                    result.SetResult(response.Data.Price);
                }
                else
                {
                    result.Message = response.Error.Message;
                }
            }
            else if (availableStrategy.TickerType == TickerType.CURRENTAVERAGEPRICE)
            {
                var response = _binanceClient.GetCurrentAvgPrice(availableStrategy.Symbol);

                if (response.Success)
                {
                    result.SetResult(response.Data.Price);
                }
                else
                {
                    result.Message = response.Error.Message;
                }
            }
            else
            {
                result.Message = LogGenerator.ErrorTicker;
            }
            return(result);
        }