MCPcopy Create free account
hub / github.com/ccxt/ccxt / parseSwapBalance

Method parseSwapBalance

ts/src/hashkey.ts:1843–1866  ·  view source on GitHub ↗
(balance)

Source from the content-addressed store, hash-verified

1841 }
1842
1843 parseSwapBalance (balance): Balances {
1844 //
1845 // {
1846 // "balance": "30.63364672",
1847 // "availableBalance": "28.85635534",
1848 // "positionMargin": "4.3421",
1849 // "orderMargin": "0",
1850 // "asset": "USDT",
1851 // "crossUnRealizedPnl": "2.5649"
1852 // }
1853 //
1854 const currencyId = this.safeString (balance, 'asset');
1855 const code = this.safeCurrencyCode (currencyId);
1856 const account = this.account ();
1857 account['total'] = this.safeString (balance, 'balance');
1858 const positionMargin = this.safeString (balance, 'positionMargin');
1859 const orderMargin = this.safeString (balance, 'orderMargin');
1860 account['used'] = Precise.stringAdd (positionMargin, orderMargin);
1861 const result: Dict = {
1862 'info': balance,
1863 };
1864 result[code] = account;
1865 return this.safeBalance (result);
1866 }
1867
1868 /**
1869 * @method

Callers 1

fetchBalanceMethod · 0.95

Calls 5

safeStringMethod · 0.45
safeCurrencyCodeMethod · 0.45
accountMethod · 0.45
stringAddMethod · 0.45
safeBalanceMethod · 0.45

Tested by

no test coverage detected