/// <summary> /// Create a new Binance Client based on the configuration provided /// </summary> /// <param name="configuration"></param> /// <param name="apiProcessor"></param> /// <param name="logger"></param> public BinanceRestClient(BinanceClientConfiguration configuration, IAPIProcessor apiProcessor = null, Logger logger = null) { Guard.AgainstNull(configuration); Guard.AgainstNullOrEmpty(configuration.ApiKey); Guard.AgainstNull(configuration.SecretKey); _defaultReceiveWindow = configuration.DefaultReceiveWindow; var apiKey = configuration.ApiKey; var secretKey = configuration.SecretKey; RequestClient.SetTimestampOffset(configuration.TimestampOffset); RequestClient.SetRateLimiting(configuration.EnableRateLimiting); RequestClient.SetAPIKey(apiKey); if (apiProcessor == null) { _apiProcessor = new APIProcessor(apiKey, secretKey); _apiProcessor.SetCacheTime(configuration.CacheTime); } else { _apiProcessor = apiProcessor; } _logger = logger ?? LogManager.GetCurrentClassLogger(); }
/// <summary> /// Create a new Binance Client based on the configuration provided /// </summary> /// <param name="configuration"></param> /// <param name="apiCache"></param> public BinanceClient(IClientConfiguration configuration, IAPIProcessor apiProcessor = null) { _logger = configuration.Logger ?? LogManager.GetLogger(typeof(BinanceClient)); Guard.AgainstNull(configuration); Guard.AgainstNullOrEmpty(configuration.ApiKey); Guard.AgainstNull(configuration.SecretKey); if (!string.IsNullOrWhiteSpace(configuration.ApiUrl)) { Endpoints.APIBaseUrl = configuration.ApiUrl; } _defaultReceiveWindow = configuration.DefaultReceiveWindow; _apiKey = configuration.ApiKey; _secretKey = configuration.SecretKey; RequestClient.SetTimestampOffset(configuration.TimestampOffset); RequestClient.SetRateLimiting(configuration.EnableRateLimiting); RequestClient.SetAPIKey(_apiKey); if (apiProcessor == null) { _apiProcessor = new APIProcessor(_apiKey, _secretKey, new APICacheManager()); _apiProcessor.SetCacheTime(configuration.CacheTime); } else { _apiProcessor = apiProcessor; } }
/// <summary> /// Create a new Binance Client based on the configuration provided /// </summary> /// <param name="configuration"></param> /// <param name="apiCache"></param> public BinanceClient(ClientConfiguration configuration, IAPIProcessor apiProcessor = null) { _logger = configuration.Logger ?? LogManager.GetCurrentClassLogger(); Guard.AgainstNull(configuration); Guard.AgainstNullOrEmpty(configuration.ApiKey); Guard.AgainstNull(configuration.SecretKey); _apiKey = configuration.ApiKey; _secretKey = configuration.SecretKey; RequestClient.SetTimestampOffset(configuration.TimestampOffset); RequestClient.SetRateLimiting(configuration.EnableRateLimiting); RequestClient.SetAPIKey(_apiKey); if (apiProcessor == null) { _apiProcessor = new APIProcessor(_apiKey, _secretKey, new APICacheManager()); _apiProcessor.SetCacheTime(configuration.CacheTime); } else { _apiProcessor = apiProcessor; } }