UNPKG

@exchanges/binance

Version:

Exchange provider for Binance API

45 lines 3.38 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; 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.lendingAccount = void 0; const apiCall_1 = require("../../../apiCall"); const safe_parsing_1 = require("@berish/safe-parsing"); function lendingAccount(client) { return __awaiter(this, void 0, void 0, function* () { const response = yield (0, apiCall_1.apiCall)({ host: 'spot', path: '/sapi/v1/lending/union/account', method: 'GET', securityType: 'USER_DATA', client, }); return (0, safe_parsing_1.parse)(response, (_a) => { var { positionAmountVos, totalAmountInBTC, totalAmountInUSDT, totalFixedAmountInBTC, totalFixedAmountInUSDT, totalFlexibleInBTC, totalFlexibleInUSDT } = _a, other = __rest(_a, ["positionAmountVos", "totalAmountInBTC", "totalAmountInUSDT", "totalFixedAmountInBTC", "totalFixedAmountInUSDT", "totalFlexibleInBTC", "totalFlexibleInUSDT"]); return (Object.assign({ positionAmountVos: (0, safe_parsing_1.parseArray)(positionAmountVos, (_a) => { var { amount, amountInBTC, amountInUSDT } = _a, other = __rest(_a, ["amount", "amountInBTC", "amountInUSDT"]); return (Object.assign({ amount: (0, safe_parsing_1.parse)(amount, safe_parsing_1.numberParser), amountInBTC: (0, safe_parsing_1.parse)(amountInBTC, safe_parsing_1.numberParser), amountInUSDT: (0, safe_parsing_1.parse)(amountInUSDT, safe_parsing_1.numberParser) }, other)); }), totalAmountInBTC: (0, safe_parsing_1.parse)(totalAmountInBTC, safe_parsing_1.numberParser), totalAmountInUSDT: (0, safe_parsing_1.parse)(totalAmountInUSDT, safe_parsing_1.numberParser), totalFixedAmountInBTC: (0, safe_parsing_1.parse)(totalFixedAmountInBTC, safe_parsing_1.numberParser), totalFixedAmountInUSDT: (0, safe_parsing_1.parse)(totalFixedAmountInUSDT, safe_parsing_1.numberParser), totalFlexibleInBTC: (0, safe_parsing_1.parse)(totalFlexibleInBTC, safe_parsing_1.numberParser), totalFlexibleInUSDT: (0, safe_parsing_1.parse)(totalFlexibleInUSDT, safe_parsing_1.numberParser) }, other)); }); }); } exports.lendingAccount = lendingAccount; //# sourceMappingURL=lendingAccount.js.map