private async Task <AccountInfo> InitializeAccountInfo() { using (var user = new BinanceApiUser(_config.Key, _config.Secret)) { var accountInfo = await _binanceApi.GetAccountInfoAsync(user, 10000000); _cache.SetAccountInfo(accountInfo); return(accountInfo); } }
public async Task <Interface.Model.AccountInfo> GetAccountInfoAsync(Interface.Model.User user, CancellationToken cancellationToken) { var apiUser = new BinanceApiUser(user.ApiKey, user.ApiSecret); var result = await binanceApi.GetAccountInfoAsync(apiUser, 0, cancellationToken).ConfigureAwait(false); var accountInfo = GetAccountInfo(result); user.RateLimiter = new Interface.Model.RateLimiter { IsEnabled = result.User.RateLimiter.IsEnabled }; accountInfo.User = user; return(accountInfo); }
private async Task <AccountInfo> InitializeAccountInfo() { try { using (var user = new BinanceApiUser(_config.Key, _config.Secret)) { var accountInfo = await _binanceApi.GetAccountInfoAsync(user, 10000000); _cache.SetAccountInfo(accountInfo); return(accountInfo); } } catch (Exception ex) { _cache.ClearAccountInfo(); _log.LogError($"Account info initialization error {ex.Message}"); return(null); } }