示例#1
0
        private static void update()
        {
            //
            if (CurrentPrices == null)
            {
                CurrentPrices = new CryptoFeedModel();
            }
            //
            bool chance = new Random().Next(0, 9) > 7;

            if (chance || (CurrentPrices.GlobalMarketCapBillion < 10))
            {
                CurrentPrices.GlobalMarketCapBillion = getMarketCap();
            }
            //
            JObject jObject = getCryptowatch();

            //Gateway
            CurrentPrices.GeminiBTCUSD = getCryptowatchPrice(jObject, "market:gemini:btcusd");
            CurrentPrices.GeminiETHUSD = getCryptowatchPrice(jObject, "market:gemini:ethusd");
            CurrentPrices.KrakenBTCUSD = getCryptowatchPrice(jObject, "market:kraken:btcusd");
            CurrentPrices.KrakenETHUSD = getCryptowatchPrice(jObject, "market:kraken:ethusd");
            CurrentPrices.LunoBTCZAR   = getCryptowatchPrice(jObject, "market:luno:btczar");
            //
            CurrentPrices.KrakenXRPUSD = getCryptowatchPrice(jObject, "market:kraken:xrpusd");
            CurrentPrices.KrakenXLMUSD = getCryptowatchPrice(jObject, "market:kraken:xlmusd");
            //Cash
            CurrentPrices.KrakenLTCUSD  = getCryptowatchPrice(jObject, "market:kraken:ltcusd");
            CurrentPrices.KrakenDASHUSD = getCryptowatchPrice(jObject, "market:kraken:dashusd");
            CurrentPrices.KrakenXMRUSD  = getCryptowatchPrice(jObject, "market:kraken:xmrusd");
            CurrentPrices.KrakenZECUSD  = getCryptowatchPrice(jObject, "market:kraken:zecusd");
            //Contract Platforms
            CurrentPrices.KrakenEOSUSD   = getCryptowatchPrice(jObject, "market:kraken:eosusd");
            CurrentPrices.KrakenADAUSD   = getCryptowatchPrice(jObject, "market:kraken:adausd");
            CurrentPrices.KrakenXTZUSD   = getCryptowatchPrice(jObject, "market:kraken:xtzusd");
            CurrentPrices.BinanceTRXUSD  = getCryptowatchPrice(jObject, "market:binance:trxusdt");
            CurrentPrices.BinanceNEOUSD  = getCryptowatchPrice(jObject, "market:binance:neousdt");
            CurrentPrices.BinanceQTUMUSD = getCryptowatchPrice(jObject, "market:binance:qtumusdt");
            //Block Lattice
            CurrentPrices.BinanceNANOUSD = getCryptowatchPrice(jObject, "market:binance:nanousdt");
            CurrentPrices.BinanceIOTUSD  = getCryptowatchPrice(jObject, "market:binance:iotausdt");
            //
            CurrentPrices.BinanceRVNBTC = getCryptowatchPrice(jObject, "market:binance:rvnbtc");
            CurrentPrices.BinanceRVNUSD = CurrentPrices.BinanceRVNBTC * CurrentPrices.GeminiBTCUSD;
            //
            if (RoundNumber % 96 == 0)
            {
                //Dictionary<string, double> xe = getXe();
                Dictionary <string, double> xe = getOER();
                CurrentPrices.USDZAR = xe["ZAR"];
                CurrentPrices.ZARHKD = xe["HKD"] / xe["ZAR"];
                CurrentPrices.HKDZAR = 1.0 / CurrentPrices.ZARHKD;
            }
            //
            RoundNumber++;
            //
            CurrentPrices.UpdateProfitability();
        }
示例#2
0
        private string getContent()
        {
            //
            CryptoFeedModel model = CryptoFeed.CurrentPrices;
            //
            string rows = "";

            rows += getRow("Gemini:ETHUSD", String.Format("${0:0,0.00}", model.GeminiETHUSD));
            rows += getRow("Gemini:BTCUSD", String.Format("${0:0,0.00}", model.GeminiBTCUSD));
            rows += getRow("Luno:BTCUSD", String.Format("${0:0,0.00}", model.LunoBTCUSD));
            rows += getRow("Luno:BTCZAR", String.Format("R{0:n0}", model.LunoBTCZAR));
            rows += getRow("Arbi Gap", model.ArbiPercentage.ToString("N") + " %");
            //rows += getRow("Arbi Profitability", model.ArbiProfitability.ToString("N") + " %");
            rows += getRow("Global M.Cap", Math.Round(model.GlobalMarketCapBillion, 2).ToString() + " bln");
            rows += getRow("USDZAR", model.USDZAR.ToString());
            rows += getRow("HKDZAR", model.HKDZAR.ToString());
            rows += getRow("ZARHKD", model.ZARHKD.ToString());
            //
            string   status     = model.Startup.ToString("MM-dd") + " #" + model.Round.ToString();
            string   lastUpdate = model.LastUpdate.ToString("MM-dd HH:mm");
            TimeSpan elapsed    = DateTime.Now - model.LastUpdate;

            if (elapsed.TotalSeconds > 50)
            {
                lastUpdate += "!";
            }
            rows += getRow(status, lastUpdate);

            //
            string page = "<html><head>@head</head><body>@body</body></html>";

            page = page.Replace("@head", HtmlHead);
            page = page.Replace("@body", TemplateBody);
            page = page.Replace("@rows", rows);
            page = page + "<!-- @round -->".Replace("@round", model.Round.ToString());
            return(page);
        }