Exemplo n.º 1
0
        public CoinMarketCapAPI()
        {
            restClient = new RestClient("https://api.coinmarketcap.com");

            // Please limit requests to no more than 10 per minute.
            throttle   = new Throttle(TimeSpan.FromMinutes(2 * 1 / 10), TimeSpan.FromMinutes(1));
            autoUpdate = new AutoUpdateWithThrottle(
                Refresh,
                TimeSpan.FromMinutes(10),
                throttle,
                CrypnosticController.instance.cancellationTokenSource.Token);
        }
Exemplo n.º 2
0
        /// <param name="timeBetweenAutoUpdates">Defaults to 10 seconds</param>
        protected Exchange(
            ExchangeName exchangeName,
            int maxRequestsPerMinute        = 60,
            TimeSpan timeBetweenAutoUpdates = default(TimeSpan))
        {
            Debug.Assert(maxRequestsPerMinute > 0);

            if (timeBetweenAutoUpdates <= TimeSpan.Zero)
            {
                timeBetweenAutoUpdates = TimeSpan.FromSeconds(10);
            }

            this.exchangeName = exchangeName;
            this.throttle     = new Throttle(TimeSpan.FromMinutes(2 * 1.0 / maxRequestsPerMinute));
            this.autoUpdate   = new AutoUpdateWithThrottle(OnAutoUpdate,
                                                           timeBetweenAutoUpdates,
                                                           throttle,
                                                           CrypnosticController.instance.cancellationTokenSource.Token);
        }