ib-client
Version:
Interactive Brokers API client library for Node.js
14 lines (11 loc) • 1.03 kB
JavaScript
;Object.defineProperty(exports, "__esModule", { value: true });exports["default"] = void 0;var _validators = require("../validators");
var _constants = require("../constants");function _classCallCheck(instance, Constructor) {if (!(instance instanceof Constructor)) {throw new TypeError("Cannot call a class as a function");}}var _default =
function _default(_ref) {var conId = _ref.conId,ratio = _ref.ratio,action = _ref.action,exchange = _ref.exchange;_classCallCheck(this, _default);
(0, _validators.validateInput)(typeof conId === 'number', 'Contract Id must be a number.');
(0, _validators.validateInput)(!ratio || typeof ratio === 'number', 'Ratio must be a number.');
(0, _validators.validateInput)([_constants.ACTION.BUY, _constants.ACTION.SELL].includes(action), 'Action must either be BUY or SELL.');
this.conId = conId || undefined;
this.ratio = ratio || 1;
this.action = action || _constants.ACTION.BUY;
this.exchange = exchange || _constants.DEFAULT_EXCHANGE;
};exports["default"] = _default;