UNPKG

@exchanges/binance

Version:

Exchange provider for Binance API

38 lines 2.04 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BLVTInfoStreams = void 0; const apiCall_1 = require("../../../apiCall"); const safe_parsing_1 = require("@berish/safe-parsing"); function BLVTInfoStreams(client, tokenName, callback) { if (!tokenName) throw new TypeError('BLVTInfoStreams tokenName is empty'); if (typeof tokenName !== 'string') throw new TypeError('BLVTInfoStreams tokenName is not string'); const parseCallback = callback && ((data, error) => { if (error) return callback(void 0, error); const response = (0, safe_parsing_1.parse)(data, (_a) => { var { e, E, s, m, b, n, l, t, f } = _a, other = __rest(_a, ["e", "E", "s", "m", "b", "n", "l", "t", "f"]); return (Object.assign({ eventTime: (0, safe_parsing_1.parse)(E, safe_parsing_1.dateParser), symbol: s, tokenIssued: m, baskets: (0, safe_parsing_1.parseArray)(b, (_a) => { var { s, n } = _a, other = __rest(_a, ["s", "n"]); return (Object.assign({ futuresSymbol: s, position: n }, other)); }), BLVTNav: n, realLeverage: l, targetLeverage: t, fundingRatio: f }, other)); }); return callback(response); }); return (0, apiCall_1.apiCall)({ host: 'usdtM', path: `${tokenName.toUpperCase()}@tokenNav`, securityType: 'SOCKET', client }, parseCallback); } exports.BLVTInfoStreams = BLVTInfoStreams; //# sourceMappingURL=BLVTInfoStreams.js.map