* @method * @name ndax#fetchBalance * @description query for balance and get the amount of funds available for trading or funds locked in orders * @see https://apidoc.ndax.io/#getaccountpositions * @param {object} [params] extra parameters specific to the exchange API endpoint
(params = {})
| 1181 | * @returns {object} a [balance structure]{@link https://docs.ccxt.com/?id=balance-structure} |
| 1182 | */ |
| 1183 | async fetchBalance (params = {}): Promise<Balances> { |
| 1184 | const omsId = this.safeInteger (this.options, 'omsId', 1); |
| 1185 | await this.loadMarkets (); |
| 1186 | await this.loadAccounts (); |
| 1187 | const defaultAccountId = this.safeInteger2 (this.options, 'accountId', 'AccountId'); |
| 1188 | let accountId = this.safeInteger2 (params, 'accountId', 'AccountId', defaultAccountId); |
| 1189 | if (accountId === undefined) { |
| 1190 | accountId = parseInt (this.accounts[0]['id']); |
| 1191 | } |
| 1192 | params = this.omit (params, [ 'accountId', 'AccountId' ]); |
| 1193 | const request: Dict = { |
| 1194 | 'omsId': omsId, |
| 1195 | 'AccountId': accountId, |
| 1196 | }; |
| 1197 | const response = await this.privateGetGetAccountPositions (this.extend (request, params)); |
| 1198 | // |
| 1199 | // [ |
| 1200 | // { |
| 1201 | // "OMSId":1, |
| 1202 | // "AccountId":449, |
| 1203 | // "ProductSymbol":"BTC", |
| 1204 | // "ProductId":1, |
| 1205 | // "Amount":10.000000000000000000000000000, |
| 1206 | // "Hold":0, |
| 1207 | // "PendingDeposits":0.0000000000000000000000000000, |
| 1208 | // "PendingWithdraws":0.0000000000000000000000000000, |
| 1209 | // "TotalDayDeposits":10.000000000000000000000000000, |
| 1210 | // "TotalMonthDeposits":10.000000000000000000000000000, |
| 1211 | // "TotalYearDeposits":10.000000000000000000000000000, |
| 1212 | // "TotalDayDepositNotional":10.000000000000000000000000000, |
| 1213 | // "TotalMonthDepositNotional":10.000000000000000000000000000, |
| 1214 | // "TotalYearDepositNotional":10.000000000000000000000000000, |
| 1215 | // "TotalDayWithdraws":0, |
| 1216 | // "TotalMonthWithdraws":0, |
| 1217 | // "TotalYearWithdraws":0, |
| 1218 | // "TotalDayWithdrawNotional":0, |
| 1219 | // "TotalMonthWithdrawNotional":0, |
| 1220 | // "TotalYearWithdrawNotional":0, |
| 1221 | // "NotionalProductId":8, |
| 1222 | // "NotionalProductSymbol":"USDT", |
| 1223 | // "NotionalValue":10.000000000000000000000000000, |
| 1224 | // "NotionalHoldAmount":0, |
| 1225 | // "NotionalRate":1 |
| 1226 | // }, |
| 1227 | // ] |
| 1228 | // |
| 1229 | return this.parseBalance (response); |
| 1230 | } |
| 1231 | |
| 1232 | parseLedgerEntryType (type) { |
| 1233 | const types: Dict = { |
nothing calls this directly
no test coverage detected