public void Stop() { Debug.Assert(instance == this); shouldStop = true; instance = null; }
public ExchangeMonitor( ExchangeMonitorConfig config) { Debug.Assert(instance == null); instance = this; foreach (KeyValuePair <string, string> aliasToName in config.coinAliasToName) { AddAlias(aliasToName.Key, aliasToName.Value); } exchangeList = new Exchange[config.supportedExchangeList.Length]; for (int i = 0; i < config.supportedExchangeList.Length; i++) { ExchangeName name = config.supportedExchangeList[i]; Exchange exchange = Exchange.LoadExchange(this, name); exchangeList[i] = exchange; } foreach (string blacklistedCoin in config.blacklistedCoins) { blacklistedFullNameLowerList.Add(blacklistedCoin.ToLowerInvariant()); } CompleteFirstLoad().Wait(); }
/// <summary> /// Throttle: /// 1200 requests per minute is the stated max. /// Targeting half that to avoid issues. /// </summary> public BinanceExchange( ExchangeMonitor exchangeMonitor) : base(exchangeMonitor, ExchangeName.Binance, 1200, "https://www.binance.com") { ApiClient api = new ApiClient(null, null); client = new BinanceClient(api); }
protected Exchange( ExchangeMonitor exchangeMonitor, ExchangeName exchangeName, int maxRequestsPerMinute) { this.exchangeMonitor = exchangeMonitor; this.exchangeName = exchangeName; // Set the throttle to half the stated max requests per min throttle = new Throttle(TimeSpan.FromMilliseconds( 2 * TimeSpan.FromMinutes(1).TotalMilliseconds / maxRequestsPerMinute)); timerRefreshData = new Timer(TimeSpan.FromSeconds(30).TotalMilliseconds); timerRefreshData.AutoReset = false; timerRefreshData.Elapsed += Timer_Elapsed; }
/// <summary> /// Throttle: /// 1200 requests per minute is the stated max. /// Targeting half that to avoid issues. /// </summary> public BinanceExchange( ExchangeMonitor exchangeMonitor) : base(exchangeMonitor, ExchangeName.Binance, 1200, "https://www.binance.com") { exchangeMonitor.AddAlias("TetherUS", "Tether"); exchangeMonitor.AddAlias("KyberNetwork", "Kyber Network"); exchangeMonitor.AddAlias("EnjinCoin", "Enjin Coin"); exchangeMonitor.AddAlias("iExecRLC", "iExec RLC"); exchangeMonitor.AddAlias("MIOTA", "IOTA"); exchangeMonitor.AddAlias("NeoGas", "Gas"); exchangeMonitor.AddAlias("PowerLedger", "Power Ledger"); exchangeMonitor.AddAlias("Stellar Lumens", "Stellar"); exchangeMonitor.AddAlias("Walton", "Waltonchain"); exchangeMonitor.AddAlias("Amber", "AmberCoin"); exchangeMonitor.AddAlias("CHAT", "ChatCoin"); ApiClient api = new ApiClient(null, null); client = new BinanceClient(api); }
/// <summary> /// 1,000 requests/minute /// 1,000,000 requests/day (smaller) /// (using half daily limit) /// </summary> /// <param name="exchangeMonitor"></param> public CryptopiaExchange( ExchangeMonitor exchangeMonitor) : base(exchangeMonitor, ExchangeName.Cryptopia, 1_000_000 / 1_440)
/// <summary> /// No stated throttle limit, going with the same as Crytpopia /// </summary> /// <param name="exchangeMonitor"></param> public EtherDeltaExchange( ExchangeMonitor exchangeMonitor) : base(exchangeMonitor, ExchangeName.EtherDelta, 1_000_000 / 1_440,