* Used by balance to get the balance data * @param {array} data - account info object * @return {object} - balances hel with available, onorder amounts
(data: any)
| 3295 | * @return {object} - balances hel with available, onorder amounts |
| 3296 | */ |
| 3297 | balanceData(data: any) { |
| 3298 | const balances = {}; |
| 3299 | if (typeof data === 'undefined') return {}; |
| 3300 | if (typeof data.balances === 'undefined') { |
| 3301 | this.Options.log('balanceData error', data); |
| 3302 | return {}; |
| 3303 | } |
| 3304 | for (const obj of data.balances) { |
| 3305 | balances[obj.asset] = { available: obj.free, onOrder: obj.locked }; |
| 3306 | } |
| 3307 | return balances; |
| 3308 | } |
| 3309 | |
| 3310 | /** |
| 3311 | * Used by web sockets depth and populates OHLC and info |