Пример #1
0
        public BtcMarketApi(ApiSettings settings)
        {
            _settings = settings;
            var authHandler = new AuthenticationHandler(_settings);

            _client = new HttpClient(authHandler)
            {
                BaseAddress = new Uri(_settings.BaseUrl)
            };
        }
Пример #2
0
        public async Task <bool> CheckApiCredentials(string apiKey, string secret)
        {
            var settings = new ApiSettings();

            settings.BaseUrl = _settings.BaseUrl;
            settings.ApiKey  = apiKey;
            settings.Secret  = secret;

            var authHandler = new AuthenticationHandler(settings);
            var client      = new HttpClient(authHandler)
            {
                BaseAddress = new Uri(settings.BaseUrl)
            };
            var api      = RestService.For <IBtcMarketsApi>(client);
            var response = await GetAccountBalance(api);

            var isValid = response.Success.HasValue ? response.Success.Value : false;

            return(isValid);
        }