Skip to content
Merged
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
20 changes: 20 additions & 0 deletions src/ExchangeSharp/API/Exchanges/Coinbase/ExchangeCoinbaseAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,26 @@ protected override async Task<Dictionary<string, decimal>> OnGetAmountsAvailable
return amounts;
}

protected override async Task<Dictionary<string, decimal>> OnGetFeesAsync()
{
var symbols = await OnGetMarketSymbolsAsync();

Dictionary<string, decimal> fees = new Dictionary<string, decimal>(StringComparer.OrdinalIgnoreCase);

JObject token = await MakeJsonRequestAsync<JObject>("/fees", null, await GetNoncePayloadAsync(), "GET");
/*
* We can chose between maker and taker fee, but currently ExchangeSharp only supports 1 fee rate per symbol.
* Here, we choose taker fee, which are usually higher
*/
decimal makerRate = token["taker_fee_rate"].Value<decimal>(); //percentage between 0 and 1

fees = symbols
.Select(symbol => new KeyValuePair<string, decimal>(symbol, makerRate))
.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);

return fees;
}

protected override async Task<ExchangeWithdrawalResponse> OnWithdrawAsync(ExchangeWithdrawalRequest request)
{
var nonce = await GenerateNonceAsync();
Expand Down