@stoqey/ib 1.3.24 → 1.3.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +1 -1
  2. package/dist/api/account/account.d.ts +5 -0
  3. package/dist/api/account/account.js +3 -0
  4. package/dist/api/account/account.js.map +1 -0
  5. package/dist/api/account/market-value.d.ts +27 -0
  6. package/dist/api/account/market-value.js +30 -0
  7. package/dist/api/account/market-value.js.map +1 -0
  8. package/dist/api/api.d.ts +4 -3
  9. package/dist/api/api.js +1 -1
  10. package/dist/api/api.js.map +1 -1
  11. package/dist/api/contract/contract.d.ts +2 -0
  12. package/dist/api/contract/contractDetails.d.ts +18 -0
  13. package/dist/api/contract/fund.d.ts +12 -0
  14. package/dist/api/contract/fund.js +14 -0
  15. package/dist/api/contract/fund.js.map +1 -0
  16. package/dist/api/data/enum/{fad-data-type.js → fa-data-type.js} +1 -1
  17. package/dist/api/data/enum/fa-data-type.js.map +1 -0
  18. package/dist/api/data/enum/min-server-version.d.ts +7 -1
  19. package/dist/api/data/enum/min-server-version.js +6 -0
  20. package/dist/api/data/enum/min-server-version.js.map +1 -1
  21. package/dist/api/historical/what-to-show.d.ts +1 -0
  22. package/dist/api/historical/what-to-show.js +1 -0
  23. package/dist/api/historical/what-to-show.js.map +1 -1
  24. package/dist/api/order/enum/orderType.d.ts +1 -0
  25. package/dist/api/order/enum/orderType.js +3 -1
  26. package/dist/api/order/enum/orderType.js.map +1 -1
  27. package/dist/api/order/order.d.ts +3 -0
  28. package/dist/api/order/order.js +3 -1
  29. package/dist/api/order/order.js.map +1 -1
  30. package/dist/common/configuration.js +1 -2
  31. package/dist/common/configuration.js.map +1 -1
  32. package/dist/common/errorCode.d.ts +37 -22
  33. package/dist/common/errorCode.js +37 -25
  34. package/dist/common/errorCode.js.map +1 -1
  35. package/dist/core/io/decoder.d.ts +3 -19
  36. package/dist/core/io/decoder.js +75 -183
  37. package/dist/core/io/decoder.js.map +1 -1
  38. package/dist/core/io/encoder.d.ts +2 -2
  39. package/dist/core/io/encoder.js +59 -24
  40. package/dist/core/io/encoder.js.map +1 -1
  41. package/dist/index.d.ts +1 -1
  42. package/dist/index.js +2 -2
  43. package/dist/index.js.map +1 -1
  44. package/dist/tests/unit/api/historical-data.test.js +16 -23
  45. package/dist/tests/unit/api/historical-data.test.js.map +1 -1
  46. package/dist/tests/unit/api/order/placeConditionalOrder.test.js +20 -2
  47. package/dist/tests/unit/api/order/placeConditionalOrder.test.js.map +1 -1
  48. package/dist/tests/unit/api/order/placeOrder.test.js +49 -0
  49. package/dist/tests/unit/api/order/placeOrder.test.js.map +1 -1
  50. package/dist/tests/unit/api/{api.test.js → pnl.test.js} +21 -7
  51. package/dist/tests/unit/api/pnl.test.js.map +1 -0
  52. package/dist/tests/unit/api/positions.test.d.ts +1 -0
  53. package/dist/tests/unit/api/positions.test.js +107 -0
  54. package/dist/tests/unit/api/positions.test.js.map +1 -0
  55. package/dist/tests/unit/api-next-live/subscription-registry.test.js +2 -8
  56. package/dist/tests/unit/api-next-live/subscription-registry.test.js.map +1 -1
  57. package/dist/tests/unit/sample-data/contracts.js +1 -1
  58. package/package.json +9 -9
  59. package/dist/api/data/enum/fad-data-type.js.map +0 -1
  60. package/dist/tests/unit/api/api.test.js.map +0 -1
  61. /package/dist/api/data/enum/{fad-data-type.d.ts → fa-data-type.d.ts} +0 -0
  62. /package/dist/tests/unit/api/{api.test.d.ts → pnl.test.d.ts} +0 -0
@@ -156,39 +156,51 @@ var ErrorCode;
156
156
  ErrorCode[ErrorCode["FAIL_SEND_REQHISTORICALNEWS"] = 565] = "FAIL_SEND_REQHISTORICALNEWS";
157
157
  /** Request Head Time Stamp Sending Error. */
158
158
  ErrorCode[ErrorCode["FAIL_SEND_REQHEADTIMESTAMP"] = 566] = "FAIL_SEND_REQHEADTIMESTAMP";
159
- /** Cancel Head Time Stamp Sending Error. */
160
- ErrorCode[ErrorCode["FAIL_SEND_CANHEADTIMESTAMP"] = 567] = "FAIL_SEND_CANHEADTIMESTAMP";
159
+ /** CRequest Histogram Data Sending Error */
160
+ ErrorCode[ErrorCode["FAIL_SEND_REQHISTOGRAMDATA"] = 567] = "FAIL_SEND_REQHISTOGRAMDATA";
161
161
  /** Request Market Rule Sending Error. */
162
- ErrorCode[ErrorCode["FAIL_SEND_REQMARKETRULE"] = 568] = "FAIL_SEND_REQMARKETRULE";
163
- /** Request PnL Sending Error. */
164
- ErrorCode[ErrorCode["FAIL_SEND_REQPNL"] = 566] = "FAIL_SEND_REQPNL";
165
- /** Cancel PnL Sending Error. */
166
- ErrorCode[ErrorCode["FAIL_SEND_CANPNL"] = 567] = "FAIL_SEND_CANPNL";
167
- /** Request PnL Single Sending Error. */
168
- ErrorCode[ErrorCode["FAIL_SEND_REQPNL_SINGLE"] = 568] = "FAIL_SEND_REQPNL_SINGLE";
162
+ ErrorCode[ErrorCode["FAIL_SEND_CANCELHISTOGRAMDATA"] = 568] = "FAIL_SEND_CANCELHISTOGRAMDATA";
169
163
  /** Cancel PnL Single Sending Error. */
170
- ErrorCode[ErrorCode["FAIL_SEND_CANPNL_SINGLE"] = 569] = "FAIL_SEND_CANPNL_SINGLE";
164
+ ErrorCode[ErrorCode["FAIL_SEND_CANCELHEADTIMESTAMP"] = 569] = "FAIL_SEND_CANCELHEADTIMESTAMP";
171
165
  /** Request Historical Ticks Sending Error. */
172
166
  ErrorCode[ErrorCode["FAIL_SEND_HISTORICAL_TICK"] = 569] = "FAIL_SEND_HISTORICAL_TICK";
173
- /** Request Tick-By-Tick Sending Error. */
174
- ErrorCode[ErrorCode["FAIL_SEND_REQTICKBYTICK"] = 570] = "FAIL_SEND_REQTICKBYTICK";
175
- /** Cancel Tick-By-Tick Sending Error. */
176
- ErrorCode[ErrorCode["FAIL_SEND_CANTICKBYTICK"] = 571] = "FAIL_SEND_CANTICKBYTICK";
177
- /** Request Completed Orders Sending Error. */
178
- ErrorCode[ErrorCode["FAIL_SEND_REQ_COMPLETED_ORDERS"] = 572] = "FAIL_SEND_REQ_COMPLETED_ORDERS";
179
- /** Request WSH Meta Data Sending Error. */
180
- ErrorCode[ErrorCode["FAIL_SEND_REQ_WSH_META_DATA"] = 573] = "FAIL_SEND_REQ_WSH_META_DATA";
167
+ /** Request Market Rule Sending Error. */
168
+ ErrorCode[ErrorCode["FAIL_SEND_REQMARKETRULE"] = 570] = "FAIL_SEND_REQMARKETRULE";
169
+ /** Request PnL Sending Error. */
170
+ ErrorCode[ErrorCode["FAIL_SEND_REQPNL"] = 571] = "FAIL_SEND_REQPNL";
171
+ /** Cancel PnL Sending Error. */
172
+ ErrorCode[ErrorCode["FAIL_SEND_CANCELPNL"] = 572] = "FAIL_SEND_CANCELPNL";
173
+ /** Request PnL Single Error. */
174
+ ErrorCode[ErrorCode["FAIL_SEND_REQPNLSINGLE"] = 573] = "FAIL_SEND_REQPNLSINGLE";
175
+ /** Cancel PnL Single Sending Error . */
176
+ ErrorCode[ErrorCode["FAIL_SEND_CANCELPNLSINGLE"] = 574] = "FAIL_SEND_CANCELPNLSINGLE";
177
+ /** Request Historical Ticks Error. */
178
+ ErrorCode[ErrorCode["FAIL_SEND_REQHISTORICALTICKS"] = 575] = "FAIL_SEND_REQHISTORICALTICKS";
179
+ /** Request Tick-By-Tick Data Sending Error */
180
+ ErrorCode[ErrorCode["FAIL_SEND_REQTICKBYTICKDATA"] = 576] = "FAIL_SEND_REQTICKBYTICKDATA";
181
+ /** Cancel Tick-By-Tick Data Sending Error */
182
+ ErrorCode[ErrorCode["FAIL_SEND_CANCELTICKBYTICKDATA"] = 577] = "FAIL_SEND_CANCELTICKBYTICKDATA";
183
+ /** Request Completed Orders Sending Error */
184
+ ErrorCode[ErrorCode["FAIL_SEND_REQCOMPLETEDORDERS"] = 578] = "FAIL_SEND_REQCOMPLETEDORDERS";
185
+ /** Invalid symbol in string */
186
+ ErrorCode[ErrorCode["INVALID_SYMBOL"] = 579] = "INVALID_SYMBOL";
187
+ /** "Request WSH Meta Data Sending Error */
188
+ ErrorCode[ErrorCode["FAIL_SEND_REQ_WSH_META_DATA"] = 580] = "FAIL_SEND_REQ_WSH_META_DATA";
181
189
  /** Cancel WSH Meta Data Sending Error */
182
- ErrorCode[ErrorCode["FAIL_SEND_CAN_WSH_META_DATA"] = 574] = "FAIL_SEND_CAN_WSH_META_DATA";
190
+ ErrorCode[ErrorCode["FAIL_SEND_CAN_WSH_META_DATA"] = 581] = "FAIL_SEND_CAN_WSH_META_DATA";
183
191
  /** Request WSH Event Data Sending Error */
184
- ErrorCode[ErrorCode["FAIL_SEND_REQ_WSH_EVENT_DATA"] = 575] = "FAIL_SEND_REQ_WSH_EVENT_DATA";
192
+ ErrorCode[ErrorCode["FAIL_SEND_REQ_WSH_EVENT_DATA"] = 582] = "FAIL_SEND_REQ_WSH_EVENT_DATA";
185
193
  /** Cancel WSH Event Data Sending Error */
186
- ErrorCode[ErrorCode["FAIL_SEND_CAN_WSH_EVENT_DATA"] = 576] = "FAIL_SEND_CAN_WSH_EVENT_DATA";
187
- /* Invalid symbol in string */
188
- ErrorCode[ErrorCode["INVALID_SYMBOL"] = 579] = "INVALID_SYMBOL";
189
- /* Part of requested market data is not subscribed. */
194
+ ErrorCode[ErrorCode["FAIL_SEND_CAN_WSH_EVENT_DATA"] = 583] = "FAIL_SEND_CAN_WSH_EVENT_DATA";
195
+ /** Request User Info Sending Error */
196
+ ErrorCode[ErrorCode["FAIL_SEND_REQ_USER_INFO"] = 584] = "FAIL_SEND_REQ_USER_INFO";
197
+ /** FA Profile is not supported anymore, use FA Group instead */
198
+ ErrorCode[ErrorCode["FA_PROFILE_NOT_SUPPORTED"] = 585] = "FA_PROFILE_NOT_SUPPORTED";
199
+ /** Invalid position trade derived value */
200
+ ErrorCode[ErrorCode["INVALID_POSITION_TRADE_DERIVATED_VALUE"] = 2150] = "INVALID_POSITION_TRADE_DERIVATED_VALUE";
201
+ /** Part of requested market data is not subscribed. */
190
202
  ErrorCode[ErrorCode["PART_OF_REQUESTED_DATA_NOT_SUBSCRIBED"] = 10090] = "PART_OF_REQUESTED_DATA_NOT_SUBSCRIBED";
191
- /* Requested market data is not subscribed. Displaying delayed market data. */
203
+ /** Requested market data is not subscribed. Displaying delayed market data. */
192
204
  ErrorCode[ErrorCode["DISPLAYING_DELAYED_DATA"] = 10167] = "DISPLAYING_DELAYED_DATA";
193
205
  /* News feed is not allowed. */
194
206
  ErrorCode[ErrorCode["NEWS_FEED_NOT_ALLOWED"] = 10276] = "NEWS_FEED_NOT_ALLOWED";
@@ -1 +1 @@
1
- {"version":3,"file":"errorCode.js","sourceRoot":"","sources":["../../src/common/errorCode.ts"],"names":[],"mappings":";AAAA;;GAEG;AACH,gEAAgE;;;AAEhE,IAAY,SAgRX;AAhRD,WAAY,SAAS;IACnB,+BAA+B;IAC/B,iEAAqB,CAAA;IAErB,8JAA8J;IAC9J,6EAA2B,CAAA;IAE3B,yBAAyB;IACzB,qEAAuB,CAAA;IAEvB,qFAAqF;IACrF,+EAA4B,CAAA;IAE5B,8BAA8B;IAC9B,+EAA4B,CAAA;IAC5B;;;;;;;;;OASG;IACH,2DAAkB,CAAA;IAElB,mDAAmD;IACnD,uDAAgB,CAAA;IAEhB,qBAAqB;IACrB,6DAAmB,CAAA;IAEnB,uCAAuC;IACvC,uDAAgB,CAAA;IAEhB,2BAA2B;IAC3B,yEAAyB,CAAA;IAEzB,0BAA0B;IAC1B,uDAAgB,CAAA;IAEhB,mBAAmB;IACnB,yDAAiB,CAAA;IAEjB,8BAA8B;IAC9B,qDAAe,CAAA;IAEf,yCAAyC;IACzC,mEAAsB,CAAA;IAEtB,wCAAwC;IACxC,mEAAsB,CAAA;IAEtB,2BAA2B;IAC3B,iEAAqB,CAAA;IAErB,4CAA4C;IAC5C,+DAAoB,CAAA;IAEpB,4CAA4C;IAC5C,+DAAoB,CAAA;IAEpB,kCAAkC;IAClC,mEAAsB,CAAA;IAEtB,wCAAwC;IACxC,mEAAsB,CAAA;IAEtB,8DAA8D;IAC9D,m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20 +122,19 @@ export declare class Decoder {
122
122
  * Read a token from queue and return it as integer value.
123
123
  *
124
124
  * Returns 0 if the token is empty.
125
- * Returns undefined is the token is Number.MAX_VALUE.
126
125
  */
127
- readInt(): number | undefined;
126
+ readInt(): number;
128
127
  /**
129
128
  * Read a token from queue and return it as integer value.
130
129
  *
131
130
  * Returns Number.MAX_VALUE if the token is empty.
132
131
  * @deprecated readIntOrUndefined is probably what you are looking for
133
132
  */
134
- readIntMax(): number;
133
+ readIntMax: () => number | undefined;
135
134
  /**
136
135
  * Read a token from queue and return it as integer value.
137
136
  *
138
- * Returns undefined if the token is empty or Number.MAX_VALUE.
137
+ * Returns undefined if the token is empty or `2147483647`.
139
138
  */
140
139
  readIntOrUndefined(): number | undefined;
141
140
  /**
@@ -458,21 +457,6 @@ export declare class Decoder {
458
457
  * Decode a USER_INFO message from data queue and a emit userInfo event.
459
458
  */
460
459
  private decodeMsg_USER_INFO;
461
- /**
462
- * Decode a [[Contract]] object from data queue.
463
- * @deprecated to remove
464
- */
465
- private decodeContract;
466
- /**
467
- * Decode a [[Order]] object from data queue.
468
- * @deprecated to remove
469
- */
470
- private decodeOrder;
471
- /**
472
- * Decode a [[ComboLeg]] object from data queue.
473
- * @deprecated to remove
474
- */
475
- private decodeComboLeg;
476
460
  /**
477
461
  * Read last trade date, parse it and assign to proper [[ContractDetails]] attributes.
478
462
  */
@@ -7,6 +7,7 @@ exports.Decoder = exports.UnderrunError = void 0;
7
7
  const event_name_1 = require("../../api/data/enum/event-name");
8
8
  const min_server_version_1 = __importDefault(require("../../api/data/enum/min-server-version"));
9
9
  const option_type_1 = __importDefault(require("../../api/data/enum/option-type"));
10
+ const sec_type_1 = __importDefault(require("../../api/data/enum/sec-type"));
10
11
  const tickType_1 = require("../../api/market/tickType");
11
12
  const execution_condition_1 = __importDefault(require("../../api/order/condition/execution-condition"));
12
13
  const margin_condition_1 = __importDefault(require("../../api/order/condition/margin-condition"));
@@ -64,6 +65,13 @@ class Decoder {
64
65
  this.dataQueue = [];
65
66
  /** Data emit queue (data to be emitted to controller). */
66
67
  this.emitQueue = [];
68
+ /**
69
+ * Read a token from queue and return it as integer value.
70
+ *
71
+ * Returns Number.MAX_VALUE if the token is empty.
72
+ * @deprecated readIntOrUndefined is probably what you are looking for
73
+ */
74
+ this.readIntMax = this.readIntOrUndefined;
67
75
  }
68
76
  /**
69
77
  * Add a new message to queue.
@@ -340,7 +348,7 @@ class Decoder {
340
348
  * Read a token from queue and return it as boolean value.
341
349
  */
342
350
  readBool() {
343
- return parseInt(this.readStr()) != 0;
351
+ return parseInt(this.readStr(), 10) != 0;
344
352
  }
345
353
  /**
346
354
  * Read a token from queue and return it as floating point value.
@@ -386,7 +394,6 @@ class Decoder {
386
394
  * Read a token from queue and return it as integer value.
387
395
  *
388
396
  * Returns 0 if the token is empty.
389
- * Returns undefined is the token is Number.MAX_VALUE.
390
397
  */
391
398
  readInt() {
392
399
  const token = this.readStr();
@@ -394,25 +401,12 @@ class Decoder {
394
401
  return 0;
395
402
  }
396
403
  const val = parseInt(token, 10);
397
- return val === Number.MAX_VALUE ? undefined : val;
398
- }
399
- /**
400
- * Read a token from queue and return it as integer value.
401
- *
402
- * Returns Number.MAX_VALUE if the token is empty.
403
- * @deprecated readIntOrUndefined is probably what you are looking for
404
- */
405
- readIntMax() {
406
- const token = this.readStr();
407
- if (!token || token === "") {
408
- return Number.MAX_VALUE;
409
- }
410
- return parseInt(token, 10);
404
+ return val;
411
405
  }
412
406
  /**
413
407
  * Read a token from queue and return it as integer value.
414
408
  *
415
- * Returns undefined if the token is empty or Number.MAX_VALUE.
409
+ * Returns undefined if the token is empty or `2147483647`.
416
410
  */
417
411
  readIntOrUndefined() {
418
412
  const token = this.readStr();
@@ -420,7 +414,7 @@ class Decoder {
420
414
  return undefined;
421
415
  }
422
416
  const val = parseInt(token, 10);
423
- return val === Number.MAX_VALUE ? undefined : val;
417
+ return val === 2147483647 ? undefined : val;
424
418
  }
425
419
  /**
426
420
  * Drain all tokens on queue until the start marker of a new message or until queue is empty.
@@ -651,6 +645,8 @@ class Decoder {
651
645
  orderDecoder.readPostToAts();
652
646
  orderDecoder.readAutoCancelParent(min_server_version_1.default.AUTO_CANCEL_PARENT);
653
647
  orderDecoder.readPegBestPegMidOrderAttributes();
648
+ orderDecoder.readCustomerAccount();
649
+ orderDecoder.readProfessionalCustomer();
654
650
  this.emit(event_name_1.EventName.openOrder, order.orderId, contract, order, orderState);
655
651
  }
656
652
  /**
@@ -743,6 +739,9 @@ class Decoder {
743
739
  contract.contract.symbol = this.readStr();
744
740
  contract.contract.secType = this.readStr();
745
741
  this.readLastTradeDate(contract, false);
742
+ if (this.serverVersion >= min_server_version_1.default.LAST_TRADE_DATE) {
743
+ contract.contract.lastTradeDate = this.readStr();
744
+ }
746
745
  contract.contract.strike = this.readDouble();
747
746
  contract.contract.right = validateOptionType(this.readStr());
748
747
  contract.contract.exchange = this.readStr();
@@ -797,31 +796,52 @@ class Decoder {
797
796
  contract.secIdList.push(tagValue);
798
797
  }
799
798
  }
800
- if (this.serverVersion >= min_server_version_1.default.AGG_GROUP) {
801
- contract.aggGroup = this.readInt();
802
- }
803
- if (this.serverVersion >= min_server_version_1.default.UNDERLYING_INFO) {
804
- contract.underSymbol = this.readStr();
805
- contract.underSecType = this.readStr();
806
- }
807
- if (this.serverVersion >= min_server_version_1.default.MARKET_RULES) {
808
- contract.marketRuleIds = this.readStr();
809
- }
810
- if (this.serverVersion >= min_server_version_1.default.REAL_EXPIRATION_DATE) {
811
- contract.realExpirationDate = this.readStr();
812
- }
813
- if (this.serverVersion >= min_server_version_1.default.STOCK_TYPE) {
814
- contract.stockType = this.readStr();
815
- }
816
- if (this.serverVersion >= min_server_version_1.default.FRACTIONAL_SIZE_SUPPORT &&
817
- this.serverVersion < min_server_version_1.default.SIZE_RULES) {
818
- this.readDecimal(); // sizeMinTick - not used anymore
819
- }
820
- if (this.serverVersion >= min_server_version_1.default.SIZE_RULES) {
821
- contract.minSize = this.readDecimal();
822
- contract.sizeIncrement = this.readDecimal();
823
- contract.suggestedSizeIncrement = this.readDecimal();
824
- }
799
+ }
800
+ if (this.serverVersion >= min_server_version_1.default.AGG_GROUP) {
801
+ contract.aggGroup = this.readInt();
802
+ }
803
+ if (this.serverVersion >= min_server_version_1.default.UNDERLYING_INFO) {
804
+ contract.underSymbol = this.readStr();
805
+ contract.underSecType = this.readStr();
806
+ }
807
+ if (this.serverVersion >= min_server_version_1.default.MARKET_RULES) {
808
+ contract.marketRuleIds = this.readStr();
809
+ }
810
+ if (this.serverVersion >= min_server_version_1.default.REAL_EXPIRATION_DATE) {
811
+ contract.realExpirationDate = this.readStr();
812
+ }
813
+ if (this.serverVersion >= min_server_version_1.default.STOCK_TYPE) {
814
+ contract.stockType = this.readStr();
815
+ }
816
+ if (this.serverVersion >= min_server_version_1.default.FRACTIONAL_SIZE_SUPPORT &&
817
+ this.serverVersion < min_server_version_1.default.SIZE_RULES) {
818
+ this.readDecimal(); // sizeMinTick - not used anymore
819
+ }
820
+ if (this.serverVersion >= min_server_version_1.default.SIZE_RULES) {
821
+ contract.minSize = this.readDecimal();
822
+ contract.sizeIncrement = this.readDecimal();
823
+ contract.suggestedSizeIncrement = this.readDecimal();
824
+ }
825
+ if (this.serverVersion >= min_server_version_1.default.FUND_DATA_FIELDS &&
826
+ contract.contract.secType == sec_type_1.default.FUND) {
827
+ contract.fundName = this.readStr();
828
+ contract.fundFamily = this.readStr();
829
+ contract.fundType = this.readStr();
830
+ contract.fundFrontLoad = this.readStr();
831
+ contract.fundBackLoad = this.readStr();
832
+ contract.fundBackLoadTimeInterval = this.readStr();
833
+ contract.fundManagementFee = this.readStr();
834
+ contract.fundClosed = this.readBool();
835
+ contract.fundClosedForNewInvestors = this.readBool();
836
+ contract.fundClosedForNewMoney = this.readBool();
837
+ contract.fundNotifyAmount = this.readStr();
838
+ contract.fundMinimumInitialPurchase = this.readStr();
839
+ contract.fundSubsequentMinimumPurchase = this.readStr();
840
+ contract.fundBlueSkyStates = this.readStr();
841
+ contract.fundBlueSkyTerritories = this.readStr();
842
+ contract.fundDistributionPolicyIndicator =
843
+ this.readStr();
844
+ contract.fundAssetType = this.readStr();
825
845
  }
826
846
  this.emit(event_name_1.EventName.contractDetails, reqId, contract);
827
847
  }
@@ -1964,6 +1984,8 @@ class Decoder {
1964
1984
  orderDecoder.readCompletedTime();
1965
1985
  orderDecoder.readCompletedStatus();
1966
1986
  orderDecoder.readPegBestPegMidOrderAttributes();
1987
+ orderDecoder.readCustomerAccount();
1988
+ orderDecoder.readProfessionalCustomer();
1967
1989
  this.emit(event_name_1.EventName.completedOrder, contract, order, orderState);
1968
1990
  }
1969
1991
  /**
@@ -2026,146 +2048,6 @@ class Decoder {
2026
2048
  const whiteBrandingId = this.readStr();
2027
2049
  this.emit(event_name_1.EventName.userInfo, reqId, whiteBrandingId);
2028
2050
  }
2029
- /**
2030
- * Decode a [[Contract]] object from data queue.
2031
- * @deprecated to remove
2032
- */
2033
- decodeContract(version) {
2034
- const contract = {};
2035
- contract.conId = this.readInt();
2036
- contract.symbol = this.readStr();
2037
- contract.secType = this.readStr();
2038
- contract.lastTradeDateOrContractMonth = this.readStr();
2039
- contract.strike = this.readDouble();
2040
- contract.right = validateOptionType(this.readStr());
2041
- if (version >= 32) {
2042
- contract.multiplier = this.readInt();
2043
- }
2044
- contract.exchange = this.readStr();
2045
- contract.currency = this.readStr();
2046
- contract.localSymbol = this.readStr();
2047
- if (version >= 32) {
2048
- contract.tradingClass = this.readStr();
2049
- }
2050
- return contract;
2051
- }
2052
- /**
2053
- * Decode a [[Order]] object from data queue.
2054
- * @deprecated to remove
2055
- */
2056
- decodeOrder(version) {
2057
- const order = {};
2058
- order.action = this.readStr();
2059
- if (this.serverVersion >= min_server_version_1.default.FRACTIONAL_POSITIONS) {
2060
- order.totalQuantity = this.readDouble();
2061
- }
2062
- else {
2063
- order.totalQuantity = this.readInt();
2064
- }
2065
- order.orderType = this.readStr();
2066
- if (version < 29) {
2067
- order.lmtPrice = this.readDouble();
2068
- }
2069
- else {
2070
- order.lmtPrice = this.readDoubleOrUndefined();
2071
- }
2072
- if (version < 30) {
2073
- order.auxPrice = this.readDouble();
2074
- }
2075
- else {
2076
- order.auxPrice = this.readDoubleOrUndefined();
2077
- }
2078
- order.tif = this.readStr();
2079
- order.ocaGroup = this.readStr();
2080
- order.account = this.readStr();
2081
- order.openClose = this.readStr();
2082
- order.origin = this.readInt();
2083
- order.orderRef = this.readStr();
2084
- order.clientId = this.readInt();
2085
- order.permId = this.readInt();
2086
- order.outsideRth = this.readBool();
2087
- order.hidden = this.readBool();
2088
- order.discretionaryAmt = this.readDouble();
2089
- order.goodAfterTime = this.readStr();
2090
- this.readStr(); // skip deprecated sharesAllocation field
2091
- order.faGroup = this.readStr();
2092
- order.faMethod = this.readStr();
2093
- order.faPercentage = this.readStr();
2094
- order.faProfile = this.readStr();
2095
- if (this.serverVersion >= min_server_version_1.default.MODELS_SUPPORT) {
2096
- order.modelCode = this.readStr();
2097
- }
2098
- order.goodTillDate = this.readStr();
2099
- order.rule80A = this.readStr();
2100
- order.percentOffset = this.readDoubleOrUndefined();
2101
- order.settlingFirm = this.readStr();
2102
- order.shortSaleSlot = this.readInt();
2103
- order.designatedLocation = this.readStr();
2104
- if (this.serverVersion === min_server_version_1.default.SSHORTX_OLD) {
2105
- this.readInt(); // exemptCode
2106
- }
2107
- else if (version >= 23) {
2108
- order.exemptCode = this.readInt();
2109
- }
2110
- order.auctionStrategy = this.readInt();
2111
- order.startingPrice = this.readDoubleOrUndefined();
2112
- order.stockRefPrice = this.readDoubleOrUndefined();
2113
- order.delta = this.readDoubleOrUndefined();
2114
- order.stockRangeLower = this.readDoubleOrUndefined();
2115
- order.stockRangeUpper = this.readDoubleOrUndefined();
2116
- order.displaySize = this.readInt();
2117
- order.blockOrder = this.readBool();
2118
- order.sweepToFill = this.readBool();
2119
- order.allOrNone = this.readBool();
2120
- order.minQty = this.readIntOrUndefined();
2121
- order.ocaType = this.readInt();
2122
- order.eTradeOnly = this.readBool();
2123
- order.firmQuoteOnly = this.readBool();
2124
- order.nbboPriceCap = this.readDoubleOrUndefined();
2125
- order.parentId = this.readInt();
2126
- order.triggerMethod = this.readInt();
2127
- order.volatility = this.readDoubleOrUndefined();
2128
- order.volatilityType = this.readInt();
2129
- order.deltaNeutralOrderType = this.readStr();
2130
- order.deltaNeutralAuxPrice = this.readDoubleOrUndefined();
2131
- if (version >= 27 && order?.deltaNeutralOrderType.length) {
2132
- order.deltaNeutralConId = this.readInt();
2133
- order.deltaNeutralSettlingFirm = this.readStr();
2134
- order.deltaNeutralClearingAccount = this.readStr();
2135
- order.deltaNeutralClearingIntent = this.readStr();
2136
- }
2137
- if (version >= 31 && order?.deltaNeutralOrderType.length) {
2138
- order.deltaNeutralOpenClose = this.readStr();
2139
- order.deltaNeutralShortSale = this.readBool();
2140
- order.deltaNeutralShortSaleSlot = this.readInt();
2141
- order.deltaNeutralDesignatedLocation = this.readStr();
2142
- }
2143
- order.continuousUpdate = this.readInt();
2144
- order.referencePriceType = this.readInt();
2145
- order.trailStopPrice = this.readDoubleOrUndefined();
2146
- if (version >= 30) {
2147
- order.trailingPercent = this.readDoubleOrUndefined();
2148
- }
2149
- order.basisPoints = this.readDoubleOrUndefined();
2150
- order.basisPointsType = this.readIntOrUndefined();
2151
- return order;
2152
- }
2153
- /**
2154
- * Decode a [[ComboLeg]] object from data queue.
2155
- * @deprecated to remove
2156
- */
2157
- decodeComboLeg() {
2158
- return {
2159
- conId: this.readInt(),
2160
- ratio: this.readInt(),
2161
- action: this.readStr(),
2162
- exchange: this.readStr(),
2163
- openClose: this.readInt(),
2164
- shortSaleSlot: this.readInt(),
2165
- designatedLocation: this.readStr(),
2166
- exemptCode: this.readInt(),
2167
- };
2168
- }
2169
2051
  /**
2170
2052
  * Read last trade date, parse it and assign to proper [[ContractDetails]] attributes.
2171
2053
  */
@@ -2865,5 +2747,15 @@ class OrderDecoder {
2865
2747
  this.order.midOffsetAtHalf = this.decoder.readDoubleOrUndefined();
2866
2748
  }
2867
2749
  }
2750
+ readCustomerAccount() {
2751
+ if (this.serverVersion >= min_server_version_1.default.CUSTOMER_ACCOUNT) {
2752
+ this.order.customerAccount = this.decoder.readStr();
2753
+ }
2754
+ }
2755
+ readProfessionalCustomer() {
2756
+ if (this.serverVersion >= min_server_version_1.default.PROFESSIONAL_CUSTOMER) {
2757
+ this.order.professionalCustomer = this.decoder.readBool();
2758
+ }
2759
+ }
2868
2760
  }
2869
2761
  //# sourceMappingURL=decoder.js.map