Пример #1
0
        private double GetWageFromNobitext(double amount, string symbol)
        {
            var webRequest       = new MyWebRequest(NobitexBaseUrl, "POST", "srcCurrency=" + symbol + "&dstCurrency=rls");
            var response         = webRequest.GetResponse();
            var nobitextResponse = JsonConvert.DeserializeObject <NobitextResponseVm>(response);

            var nobitext = nobitextResponse.Stats.Values.First();

            if (nobitext != null)
            {
                return(amount * nobitext.BestSell - amount * nobitext.BestBuy);
            }

            return(0);
        }
Пример #2
0
        //private async Task<double> GetTeterDollar(double amount, string symbol)
        //{
        //    using var httpClient = new HttpClient();
        //    using var response = await httpClient.GetAsync(BinanceBaseUrl + symbol);
        //    var apiResponse = await response.Content.ReadAsStringAsync();
        //    var binanceResponse = JsonConvert.DeserializeObject<BinanceResponseVm>(apiResponse);

        //    var some = binanceResponse.Price * amount;
        //    return some;
        //}

        private double GetTomanPriceFromNobitex(double amount, string symbol)
        {
            var webRequest       = new MyWebRequest(NobitexBaseUrl, "POST", "srcCurrency=" + symbol + "&dstCurrency=rls");
            var response         = webRequest.GetResponse();
            var nobitextResponse = JsonConvert.DeserializeObject <NobitextResponseVm>(response);

            var nobitext = nobitextResponse.Stats.Values.First();

            if (nobitext != null)
            {
                return(amount * nobitext.Latest);
            }

            return(0);
            //using var httpClient = new HttpClient();
            //using var response = await httpClient.PostAsync(NobitexBaseUrl, );
            //var apiResponse = await response.Content.ReadAsStringAsync();

            //var navasanResponse = new NavasanResponseVm(apiResponse);

            //return navasanResponse.Value * amount;
        }