Skip to content

Withdrawal fees #691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,8 @@ protected override async Task<ExchangeWithdrawalResponse> OnWithdrawAsync(Exchan

resp.Id = result[0]["withdrawal_id"].ToStringInvariant();
resp.Message = result[0]["message"].ToStringInvariant();
resp.Fee = result[0].Value<decimal?>("WITHDRAWAL_FEE");

return resp;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,8 @@ protected override async Task<ExchangeWithdrawalResponse> OnWithdrawAsync(Exchan
ExchangeWithdrawalResponse withdrawalResponse = new ExchangeWithdrawalResponse
{
Id = result["id"].ToStringInvariant(),
Message = result["status"].ToStringInvariant()
Message = result["status"].ToStringInvariant(),
Fee = result.Value<decimal?>("txCost")
};

return withdrawalResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,12 @@ protected override async Task<ExchangeWithdrawalResponse> OnWithdrawAsync(Exchan
}

var result = await MakeJsonRequestAsync<WithdrawalResult>("/withdrawals/crypto", null, payload, "POST");
var feeParsed = decimal.TryParse(result.Fee, out var fee);

return new ExchangeWithdrawalResponse
{
Id = result.Id
Id = result.Id,
Fee = feeParsed ? fee : (decimal?)null
};
}

Expand Down
3 changes: 2 additions & 1 deletion src/ExchangeSharp/API/Exchanges/FTX/ExchangeFTXAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ protected override async Task<ExchangeWithdrawalResponse> OnWithdrawAsync(Exchan

return new ExchangeWithdrawalResponse
{
Id = result["id"].ToString()
Id = result["id"].ToString(),
Fee = result.Value<decimal?>("fee")
};
}

Expand Down
3 changes: 2 additions & 1 deletion src/ExchangeSharp/API/Exchanges/Kraken/ExchangeKrakenAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,8 @@ protected override async Task<ExchangeWithdrawalResponse> OnWithdrawAsync(Exchan

return new ExchangeWithdrawalResponse
{
Id = result["refid"].ToString()
Id = result["refid"].ToString(),
Fee = result.Value<decimal?>("fee")
};
}

Expand Down
13 changes: 8 additions & 5 deletions src/ExchangeSharp/Model/ExchangeWithdrawalResponse.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
MIT LICENSE

Copyright 2017 Digital Ruby, LLC - http://www.digitalruby.com
Expand Down Expand Up @@ -26,11 +26,14 @@ public sealed class ExchangeWithdrawalResponse
/// <summary>Whether the withdrawal was successful</summary>
public bool Success { get; set; } = true;

/// <summary>Returns a <see cref="System.String" /> that represents this instance.</summary>
/// <returns>A <see cref="System.String" /> that represents this instance.</returns>
public override string ToString()
/// <summary>Fee for the withdrawal</summary>
public decimal? Fee { get; set; }

/// <summary>Returns a <see cref="System.String" /> that represents this instance.</summary>
/// <returns>A <see cref="System.String" /> that represents this instance.</returns>
public override string ToString()
{
return $"Success: {Success} Id: {Id ?? "null"} Message: {Message ?? "null"}";
}
}
}
}