| 2380 | * @return {object} - balances hel with available, onorder amounts |
| 2381 | */ |
| 2382 | const balanceData = data => { |
| 2383 | let balances = {}; |
| 2384 | if (typeof data === 'undefined') return {}; |
| 2385 | if (typeof data.balances === 'undefined') { |
| 2386 | Binance.options.log('balanceData error', data); |
| 2387 | return {}; |
| 2388 | } |
| 2389 | for (let obj of data.balances) { |
| 2390 | balances[obj.asset] = { available: obj.free, onOrder: obj.locked }; |
| 2391 | } |
| 2392 | return balances; |
| 2393 | }; |
| 2394 | |
| 2395 | /** |
| 2396 | * Used by web sockets depth and populates OHLC and info |