예제 #1
0
        /// <summary>
        /// WARNING!!! BitSkins stop support CryptoAPI! This api call can work not correct!
        /// Allows you to retrieve the current exchange rate per Bitcoin (in USD), and the time this conversion rate will expire.
        /// </summary>
        /// <returns>Bitcoin deposit rate and the time this rate will expire.</returns>
        public static BitcoinDepositRate GetBitcoinDepositRate()
        {
            string             urlRequest         = GetUrlRequest();
            string             result             = Server.ServerRequest.RequestServer(urlRequest);
            BitcoinDepositRate bitcoinDepositRate = ReadBitcoinDepositRate(result);

            return(bitcoinDepositRate);
        }
예제 #2
0
        private static BitcoinDepositRate ReadBitcoinDepositRate(string result)
        {
            dynamic responseServerD = JsonConvert.DeserializeObject(result);
            dynamic dataD           = responseServerD.data;

            BitcoinDepositRate bitcoinDepositRate = null;

            if (dataD != null)
            {
                double?  pricePerBitcoinInUsd = dataD.price_per_bitcoin_in_usd ?? null;
                DateTime?expiresAt            = null;
                if (dataD.expires_at != null)
                {
                    expiresAt = DateTimeExtension.FromUnixTime((long)dataD.expires_at);
                }
                int?expiresIn = dataD.expires_in ?? null;

                bitcoinDepositRate = new BitcoinDepositRate(pricePerBitcoinInUsd, expiresAt, expiresIn);
            }

            return(bitcoinDepositRate);
        }