diff --git a/src/ExchangeSharp/API/Exchanges/GateIo/ExchangeGateIoAPI.cs b/src/ExchangeSharp/API/Exchanges/GateIo/ExchangeGateIoAPI.cs index 2202ef82..d7b5e269 100644 --- a/src/ExchangeSharp/API/Exchanges/GateIo/ExchangeGateIoAPI.cs +++ b/src/ExchangeSharp/API/Exchanges/GateIo/ExchangeGateIoAPI.cs @@ -264,6 +264,31 @@ protected override async Task> OnGetCandlesAsync( return candles; } + protected override async Task> OnGetAmountsAsync() + { + var payload = await GetNoncePayloadAsync(); + var responseToken = await MakeJsonRequestAsync("/spot/accounts", payload: payload); + return responseToken.Select(x => ParseBalance(x)) + .ToDictionary(x => x.currency, x => x.available + x.locked); + } + + protected override async Task> OnGetAmountsAvailableToTradeAsync() + { + var payload = await GetNoncePayloadAsync(); + var responseToken = await MakeJsonRequestAsync("/spot/accounts", payload: payload); + return responseToken.Select(x => ParseBalance(x)) + .ToDictionary(x => x.currency, x => x.available); + } + + private (string currency, decimal available, decimal locked) ParseBalance(JToken balanceToken) + { + var currency = balanceToken["currency"].ToStringInvariant(); + var available = balanceToken["available"].ConvertInvariant(); + var locked = balanceToken["locked"].ConvertInvariant(); + + return (currency, available, locked); + } + protected override async Task OnPlaceOrderAsync(ExchangeOrderRequest order) { if (order.OrderType != OrderType.Limit)