public async Task <List <WithdrawalHistoryEntry> > GetWithdrawalHistoryAsync(WithdrawalHistoryContext context) { if (!context.Asset.ToRemoteCode(this).Equals(Asset.Btc.ToRemoteCode(this))) { throw new AssetPairNotSupportedException(context.Asset.ShortCode, this); } var api = ApiProvider.GetApi(context); var remoteCode = context.Asset.ToRemoteCode(this); var r = await api.GetWalletHistoryAsync(remoteCode).ConfigureAwait(false); var history = new List <WithdrawalHistoryEntry>(); foreach (var rHistory in r.Where(x => x.transactType.Equals("Withdrawal", StringComparison.OrdinalIgnoreCase))) { history.Add(new WithdrawalHistoryEntry() { Price = new Money(rHistory.amount * ConversionRate, context.Asset), Fee = new Money(rHistory.fee * ConversionRate ?? 0.0m, context.Asset), CreatedTimeUtc = rHistory.timestamp, Address = rHistory.address, WithdrawalRemoteId = rHistory.transactID, WithdrawalStatus = ParseWithdrawalStatus(rHistory.transactStatus) }); } return(history); }
public void TestGetWithdrawalHistory(WithdrawalHistoryContext context) { var p = IsType <IWithdrawalHistoryProvider>(); if (p.Success) { GetWithdrawalHistory(p.Provider, context); } }
public override void TestGetWithdrawalHistory() { var context = new WithdrawalHistoryContext(UserContext.Current) { Asset = Asset.Btc }; base.TestGetWithdrawalHistory(context); }
private void GetWithdrawalHistory(IWithdrawalHistoryProvider provider, WithdrawalHistoryContext context) { if (context == null) { return; } var r = AsyncContext.Run(() => provider.GetWithdrawalHistoryAsync(context)); foreach (var historyEntry in r) { Trace.WriteLine($"{historyEntry.CreatedTimeUtc} {historyEntry.WithdrawalStatus} {historyEntry.WithdrawalRemoteId} {historyEntry.Price.Display}"); } // Assert.IsTrue(r); }