ib-client
Version:
Interactive Brokers API client library for Node.js
20 lines (17 loc) • 1.26 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,symbol = _ref.symbol,expiry = _ref.expiry,multiplier = _ref.multiplier,currency = _ref.currency,exchange = _ref.exchange;_classCallCheck(this, _default);
if (!conId) {
(0, _validators.validateInput)(typeof symbol === 'string' && symbol.length > 0, 'Symbol must be a string.');
(0, _validators.validateInput)(typeof expiry === 'string' && expiry.length > 0, 'Expiry must be a string.');
} else {
(0, _validators.validateInput)(typeof conId === 'number', 'Contract Id must be a number.');
}
this.conId = conId || undefined;
this.symbol = symbol || undefined;
this.secType = _constants.SEC_TYPE.FUTURES;
this.expiry = expiry || undefined;
this.multiplier = multiplier || undefined;
this.currency = currency || _constants.DEFAULT_CURRENCY;
this.exchange = exchange || _constants.DEFAULT_EXCHANGE;
};exports["default"] = _default;