@exchanges/binance
Version:
Exchange provider for Binance API
26 lines • 2.14 kB
JavaScript
;
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.parseOrder = void 0;
const safe_parsing_1 = require("@berish/safe-parsing");
function parseOrder(response) {
return (0, safe_parsing_1.parse)(response, (_a) => {
var { transactTime, price, stopPrice, origQty, executedQty, cummulativeQuoteQty, icebergQty, fills } = _a, other = __rest(_a, ["transactTime", "price", "stopPrice", "origQty", "executedQty", "cummulativeQuoteQty", "icebergQty", "fills"]);
return (Object.assign({ transactTime: (0, safe_parsing_1.parse)(transactTime, safe_parsing_1.dateParser), price: (0, safe_parsing_1.parse)(price, safe_parsing_1.numberParser), stopPrice: (0, safe_parsing_1.parse)(stopPrice, safe_parsing_1.numberParser), origQuantity: (0, safe_parsing_1.parse)(origQty, safe_parsing_1.numberParser), executedQuantity: (0, safe_parsing_1.parse)(executedQty, safe_parsing_1.numberParser), cummulativeQuoteQuantity: (0, safe_parsing_1.parse)(cummulativeQuoteQty, safe_parsing_1.numberParser), icebergQuantity: (0, safe_parsing_1.parse)(icebergQty, safe_parsing_1.numberParser), fills: (0, safe_parsing_1.parseArray)(fills, (_a) => {
var { price, qty, commission } = _a, other = __rest(_a, ["price", "qty", "commission"]);
return (Object.assign({ price: (0, safe_parsing_1.parse)(price, safe_parsing_1.numberParser), quantity: (0, safe_parsing_1.parse)(qty, safe_parsing_1.numberParser), commission: (0, safe_parsing_1.parse)(commission, safe_parsing_1.numberParser) }, other));
}) }, other));
});
}
exports.parseOrder = parseOrder;
//# sourceMappingURL=order.js.map