Пример #1
0
        /// <summary>
        /// Récupération des données depuis le site internet.
        /// </summary>
        /// <returns> L'ensemble des datas non formalisées. </returns>
        private String RecuperationDonnees(long closeTime = long.MinValue)
        {
            String api             = "https://api.binance.com";
            String apiChandelier   = "/api/v1/klines";
            String apiParametres   = "?";
            String apiParametresEt = "&";
            String apiSymbol       = "symbol=";
            String apiInterval     = "interval=";
            String apiCloseTime    = "endTime=";
            String apiLimit        = "limit=";

            String url = api + apiChandelier
                         + apiParametres + apiSymbol
                         + Monnaie.ToString() + MonnaieReference
                         + apiParametresEt + apiInterval + Interval
                         + apiParametresEt + apiLimit + Limit;

            if (closeTime != long.MinValue)
            {
                url += apiParametresEt + apiCloseTime + closeTime;
            }



            HttpWebRequest requete = (HttpWebRequest)WebRequest.Create(url);

            requete.Method = WebRequestMethods.Http.Get;
            requete.Accept = "application/json";
            try
            {
                WebResponse reponse = requete.GetResponse();
                using (Stream reponseStream = reponse.GetResponseStream())
                {
                    StreamReader reader = new StreamReader(reponseStream, Encoding.UTF8);
                    return(reader.ReadToEnd());
                }
            }
            catch (WebException ex)
            {
                WebResponse errorResponse = ex.Response;
                using (Stream responseStream = errorResponse.GetResponseStream())
                {
                    StreamReader reader    = new StreamReader(responseStream, Encoding.GetEncoding("utf-8"));
                    String       errorText = reader.ReadToEnd();
                }
            }

            return(null);
        }
Пример #2
0
        public void SpecifyIntegerValueAndCastIntegerValueToCurrencyEnum()
        {
            Monnaie euro = (Monnaie)1;

            Check.That(euro.ToString()).Equals("Euro");
        }