File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
src/ExchangeSharp/API/Exchanges/GateIo Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,31 @@ protected override async Task<IEnumerable<MarketCandle>> OnGetCandlesAsync(
264264 return candles ;
265265 }
266266
267+ protected override async Task < Dictionary < string , decimal > > OnGetAmountsAsync ( )
268+ {
269+ var payload = await GetNoncePayloadAsync ( ) ;
270+ var responseToken = await MakeJsonRequestAsync < JToken > ( "/spot/accounts" , payload : payload ) ;
271+ return responseToken . Select ( x => ParseBalance ( x ) )
272+ . ToDictionary ( x => x . currency , x => x . available + x . locked ) ;
273+ }
274+
275+ protected override async Task < Dictionary < string , decimal > > OnGetAmountsAvailableToTradeAsync ( )
276+ {
277+ var payload = await GetNoncePayloadAsync ( ) ;
278+ var responseToken = await MakeJsonRequestAsync < JToken > ( "/spot/accounts" , payload : payload ) ;
279+ return responseToken . Select ( x => ParseBalance ( x ) )
280+ . ToDictionary ( x => x . currency , x => x . available ) ;
281+ }
282+
283+ private ( string currency , decimal available , decimal locked ) ParseBalance ( JToken balanceToken )
284+ {
285+ var currency = balanceToken [ "currency" ] . ToStringInvariant ( ) ;
286+ var available = balanceToken [ "available" ] . ConvertInvariant < decimal > ( ) ;
287+ var locked = balanceToken [ "locked" ] . ConvertInvariant < decimal > ( ) ;
288+
289+ return ( currency , available , locked ) ;
290+ }
291+
267292 protected override async Task < ExchangeOrderResult > OnPlaceOrderAsync ( ExchangeOrderRequest order )
268293 {
269294 if ( order . OrderType != OrderType . Limit )
You can’t perform that action at this time.
0 commit comments