@exchanges/binance
Version:
Exchange provider for Binance API
49 lines • 3.97 kB
JavaScript
;
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.getDetailOnSubAccountMarginAccount = void 0;
const apiCall_1 = require("../../../apiCall");
const safe_parsing_1 = require("@berish/safe-parsing");
function getDetailOnSubAccountMarginAccount(client, email) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield (0, apiCall_1.apiCall)({
host: 'spot',
path: '/sapi/v1/sub-account/margin/account',
method: 'GET',
securityType: 'USER_DATA',
client,
data: { email },
});
return (0, safe_parsing_1.parse)(response, (_a) => {
var { marginLevel, totalAssetOfBtc, totalLiabilityOfBtc, totalNetAssetOfBtc, marginTradeCoeffVo, marginUserAssetVoList } = _a, other = __rest(_a, ["marginLevel", "totalAssetOfBtc", "totalLiabilityOfBtc", "totalNetAssetOfBtc", "marginTradeCoeffVo", "marginUserAssetVoList"]);
return (Object.assign({ marginLevel: (0, safe_parsing_1.parse)(marginLevel, safe_parsing_1.numberParser), totalAssetOfBtc: (0, safe_parsing_1.parse)(totalAssetOfBtc, safe_parsing_1.numberParser), totalLiabilityOfBtc: (0, safe_parsing_1.parse)(totalLiabilityOfBtc, safe_parsing_1.numberParser), totalNetAssetOfBtc: (0, safe_parsing_1.parse)(totalNetAssetOfBtc, safe_parsing_1.numberParser), marginTradeCoeffVo: (0, safe_parsing_1.parse)(marginTradeCoeffVo, (_a) => {
var { forceLiquidationBar, marginCallBar, normalBar } = _a, other = __rest(_a, ["forceLiquidationBar", "marginCallBar", "normalBar"]);
return (Object.assign({ forceLiquidationBar: (0, safe_parsing_1.parse)(forceLiquidationBar, safe_parsing_1.numberParser), marginCallBar: (0, safe_parsing_1.parse)(marginCallBar, safe_parsing_1.numberParser), normalBar: (0, safe_parsing_1.parse)(normalBar, safe_parsing_1.numberParser) }, other));
}), marginUserAssetVoList: (0, safe_parsing_1.parseArray)(marginUserAssetVoList, (_a) => {
var { borrowed, free, interest, locked, netAsset } = _a, other = __rest(_a, ["borrowed", "free", "interest", "locked", "netAsset"]);
return (Object.assign({ borrowed: (0, safe_parsing_1.parse)(borrowed, safe_parsing_1.numberParser), free: (0, safe_parsing_1.parse)(free, safe_parsing_1.numberParser), interest: (0, safe_parsing_1.parse)(interest, safe_parsing_1.numberParser), locked: (0, safe_parsing_1.parse)(locked, safe_parsing_1.numberParser), netAsset: (0, safe_parsing_1.parse)(netAsset, safe_parsing_1.numberParser) }, other));
}) }, other));
});
});
}
exports.getDetailOnSubAccountMarginAccount = getDetailOnSubAccountMarginAccount;
//# sourceMappingURL=getDetailOnSubAccountMarginAccount.js.map