UNPKG

shrimpy-node

Version:
62 lines 3.1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var decimal_dto_converter_1 = require("./decimal-dto-converter"); var date_dto_converter_1 = require("./date-dto-converter"); var HistoricalOrderBookItemDtoConverter = /** @class */ (function () { function HistoricalOrderBookItemDtoConverter() { this._decimalDtoConverter = new decimal_dto_converter_1.DecimalDtoConverter(); } HistoricalOrderBookItemDtoConverter.prototype.convertFromDto = function (dto) { return { price: this._decimalDtoConverter.convertFromDto(dto.price), size: this._decimalDtoConverter.convertFromDto(dto.size) }; }; HistoricalOrderBookItemDtoConverter.prototype.convertToDto = function (model) { return { price: this._decimalDtoConverter.convertToDto(model.price), size: this._decimalDtoConverter.convertToDto(model.size) }; }; return HistoricalOrderBookItemDtoConverter; }()); exports.HistoricalOrderBookItemDtoConverter = HistoricalOrderBookItemDtoConverter; var HistoricalOrderBooksDtoConverter = /** @class */ (function () { function HistoricalOrderBooksDtoConverter() { this._dateDtoConverter = new date_dto_converter_1.DateDtoConverter(); this._historicalOrderBookItemDtoConverter = new HistoricalOrderBookItemDtoConverter(); } HistoricalOrderBooksDtoConverter.prototype.convertFromDto = function (dto) { var _this = this; return dto.map(function (historicalDepthDto) { var historicalDepth = { time: _this._dateDtoConverter.convertFromDto(historicalDepthDto.time), bids: historicalDepthDto.bids.map(function (depthItemDto) { return _this._historicalOrderBookItemDtoConverter.convertFromDto(depthItemDto); }), asks: historicalDepthDto.asks.map(function (depthItemDto) { return _this._historicalOrderBookItemDtoConverter.convertFromDto(depthItemDto); }) }; return historicalDepth; }); }; HistoricalOrderBooksDtoConverter.prototype.convertToDto = function (model) { var _this = this; return model.map(function (historicalDepth) { var historicalDepthDto = { time: _this._dateDtoConverter.convertToDto(historicalDepth.time), bids: historicalDepth.bids.map(function (depthItem) { return _this._historicalOrderBookItemDtoConverter.convertToDto(depthItem); }), asks: historicalDepth.asks.map(function (depthItem) { return _this._historicalOrderBookItemDtoConverter.convertToDto(depthItem); }) }; return historicalDepthDto; }); }; return HistoricalOrderBooksDtoConverter; }()); exports.HistoricalOrderBooksDtoConverter = HistoricalOrderBooksDtoConverter; //# sourceMappingURL=historical-orderbooks-dto-converter.js.map