示例#1
0
        public async Task <ExchangeBalance[]> GetBalancesAsync()
        {
            // Get the gdax client and list all accounts.
            var addresses = await bitflyerApiClient.GetAddresses();

            var balances = await bitflyerApiClient.GetBalance();

            // Transform to exchange balance objects.
            var exchangeBalances = balances.Select(x => new ExchangeBalance(this.Exchange, Convert.ToDecimal(x.Available), DateTime.UtcNow, FromCurrencyEnum(x.CurrencyCode), null, null)).Where(x => x.CurrencyCode != null).ToArray();

            // update any addresses
            foreach (var addr in addresses)
            {
                var exchangeBalance = exchangeBalances.SingleOrDefault(x => x.CurrencyCode == FromCurrencyEnum(addr.CurrencyCode));
                if (exchangeBalance == null)
                {
                    continue;
                }
                exchangeBalance.Address = addr.Address;
            }

            return(exchangeBalances);
        }
        public async Task GetAddresses()
        {
            var res1 = await apiClient.GetAddresses();

            Assert.NotNull(res1);
        }