コード例 #1
0
        //string apiKey = "HKNIeFFUSCIfca2F5B2GA56UqLkBIIYJ7o01JNerIJz6XT8s1k0Mqg2c2PXdn842";
        //string secretKey = "ynM4OWcqRitNkmcs0gOaU1X5Z4jcxkhSgpzc0G3bGYrzCBsfoaP2xg9I9tgyY5Gu";

        public ActionResult Index()
        {
            DashboardModel model    = new DashboardModel();
            var            response = MCAPI.Get <JObject>("ticker/?limit=6");
            var            tickers  = MCAPI.GetData(response);

            model.tickersList = tickers;
            var symbols = MCAPI.Get <Symbols>("listings/");

            Session["TotalCurrency"] = symbols.metadata.num_cryptocurrencies;

            model.SymbolsList = symbols;
            return(View(model));
        }
コード例 #2
0
        public ActionResult CurrencyList()
        {
            List <Ticklers> parentTickers = new List <Ticklers>();
            var             response      = MCAPI.Get <JObject>("ticker/?limit=100");
            var             tickers       = MCAPI.GetData(response);
            double          currencyTotal = 0.00;

            if (Session["TotalCurrency"] == null)
            {
                var symbols = MCAPI.Get <Symbols>("listings/");
                currencyTotal = symbols.metadata.num_cryptocurrencies;
            }
            else
            {
                currencyTotal = Convert.ToInt32(Session["TotalCurrency"]);
            }
            parentTickers.AddRange(tickers);

            double remaining   = currencyTotal / 100;
            int    intPart     = Convert.ToInt32(remaining);
            double decimalPart = remaining - intPart;

            if (decimalPart > 0)
            {
                intPart++;
            }
            int start = 101;

            for (int i = 1; i < intPart; i++)
            {
                response = MCAPI.Get <JObject>($"/ticker/?start={start}&limit=100");
                tickers  = MCAPI.GetData(response);
                parentTickers.AddRange(tickers);
                start = start + 100;
            }
            return(View(parentTickers));
        }