* Websocket mini ticker * @param {function} callback - callback function * @return {string} the websocket endpoint
(callback)
| 6750 | * @return {string} the websocket endpoint |
| 6751 | */ |
| 6752 | miniTicker(callback) { |
| 6753 | const reconnect = () => { |
| 6754 | if (this.Options.reconnect) this.miniTicker(callback); |
| 6755 | }; |
| 6756 | const subscription = this.subscribe('!miniTicker@arr', function (data: any) { |
| 6757 | const markets = {}; |
| 6758 | for (const obj of data) { |
| 6759 | markets[obj.s] = { |
| 6760 | close: obj.c, |
| 6761 | open: obj.o, |
| 6762 | high: obj.h, |
| 6763 | low: obj.l, |
| 6764 | volume: obj.v, |
| 6765 | quoteVolume: obj.q, |
| 6766 | eventTime: obj.E |
| 6767 | }; |
| 6768 | } |
| 6769 | callback(markets); |
| 6770 | }, reconnect); |
| 6771 | return (subscription as any).url; |
| 6772 | } |
| 6773 | |
| 6774 | /** |
| 6775 | * Spot WebSocket bookTicker (bid/ask quotes including price & amount) |