public async Task <ActionResult> GetCandleStick(GetCandleStickModel model)
    {
        var pair = await _pairsRepository.GetPairByAcronimAsync(model.Acronim.ToUpper());

        if (pair == null)
        {
            return(BadRequest("wrong pair"));
        }

        if (!model.DateStart.HasValue)
        {
            model.DateStart = System.DateTime.Now.AddDays(-2);
        }

        var candleStick = await _candleStickRepository.GetCandleStick(model, pair.SQLTableName);

        var currentCandleStick = await _candleStickRepository.GetCurrentCandleStick(pair.SQLTableName);

        var resultModel = new CandleStickViewModel()
        {
            CurrentCandleStick = currentCandleStick,
            LastCandleSticks   = candleStick
        };

        return(Ok(resultModel));
    }
Example #2
0
        public async Task <ActionResult> GetCandleStick(GetCandleStickModel model)
        {
            if (!model.DateStart.HasValue)
            {
                model.DateStart = System.DateTime.Now.AddDays(-2);
            }

            var candleStick = await _candleStickRepository.Get_BTC_USDT_CandleSticks(model);

            var currentCandleStick = await _candleStickRepository.GetCurrent_BTC_USDT_CandleStick();

            var resultModel = new CandleStickViewModel()
            {
                CurrentCandleStick = currentCandleStick,
                LastCandleSticks   = candleStick
            };

            return(Ok(resultModel));
        }