@stoqey/ib 1.3.8 → 1.3.10

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 (214) hide show
  1. package/README.md +3 -3
  2. package/dist/api/api.d.ts +58 -55
  3. package/dist/api/api.js +50 -44
  4. package/dist/api/api.js.map +1 -1
  5. package/dist/api/contract/contract.d.ts +4 -0
  6. package/dist/api/contract/forex.js.map +1 -1
  7. package/dist/api/contract/wsh.d.ts +15 -0
  8. package/dist/api/contract/wsh.js +21 -0
  9. package/dist/api/contract/wsh.js.map +1 -0
  10. package/dist/api/data/enum/duration-unit.js +1 -1
  11. package/dist/api/data/enum/duration-unit.js.map +1 -1
  12. package/dist/api/data/enum/event-name.js +1 -1
  13. package/dist/api/data/enum/event-name.js.map +1 -1
  14. package/dist/api/data/enum/fad-data-type.d.ts +2 -1
  15. package/dist/api/data/enum/fad-data-type.js +3 -2
  16. package/dist/api/data/enum/fad-data-type.js.map +1 -1
  17. package/dist/api/data/enum/log-level.js +1 -1
  18. package/dist/api/data/enum/log-level.js.map +1 -1
  19. package/dist/api/data/enum/min-server-version.d.ts +3 -1
  20. package/dist/api/data/enum/min-server-version.js +3 -1
  21. package/dist/api/data/enum/min-server-version.js.map +1 -1
  22. package/dist/api/data/enum/option-exercise-action.js +1 -1
  23. package/dist/api/data/enum/option-exercise-action.js.map +1 -1
  24. package/dist/api/data/enum/option-type.js +1 -1
  25. package/dist/api/data/enum/option-type.js.map +1 -1
  26. package/dist/api/data/enum/sec-type.d.ts +22 -13
  27. package/dist/api/data/enum/sec-type.js +24 -15
  28. package/dist/api/data/enum/sec-type.js.map +1 -1
  29. package/dist/api/historical/bar-size-setting.js +1 -1
  30. package/dist/api/historical/bar-size-setting.js.map +1 -1
  31. package/dist/api/historical/what-to-show.d.ts +21 -0
  32. package/dist/api/historical/what-to-show.js +25 -0
  33. package/dist/api/historical/what-to-show.js.map +1 -0
  34. package/dist/api/market/tickByTickDataType.js +1 -1
  35. package/dist/api/market/tickByTickDataType.js.map +1 -1
  36. package/dist/api/market/tickType.d.ts +12 -0
  37. package/dist/api/market/tickType.js +13 -1
  38. package/dist/api/market/tickType.js.map +1 -1
  39. package/dist/api/order/enum/conjunction-connection.js +1 -1
  40. package/dist/api/order/enum/conjunction-connection.js.map +1 -1
  41. package/dist/api/order/enum/order-action.js +1 -1
  42. package/dist/api/order/enum/order-action.js.map +1 -1
  43. package/dist/api/order/enum/order-condition-type.js +1 -1
  44. package/dist/api/order/enum/order-condition-type.js.map +1 -1
  45. package/dist/api/order/enum/order-status.js +1 -1
  46. package/dist/api/order/enum/order-status.js.map +1 -1
  47. package/dist/api/order/enum/orderType.d.ts +4 -0
  48. package/dist/api/order/enum/orderType.js +24 -2
  49. package/dist/api/order/enum/orderType.js.map +1 -1
  50. package/dist/api/order/enum/tif.d.ts +30 -0
  51. package/dist/api/order/enum/tif.js +33 -0
  52. package/dist/api/order/enum/tif.js.map +1 -0
  53. package/dist/api/order/enum/trigger-method.js +1 -1
  54. package/dist/api/order/enum/trigger-method.js.map +1 -1
  55. package/dist/api/order/execution.d.ts +1 -0
  56. package/dist/api/order/order.d.ts +21 -6
  57. package/dist/api/order/order.js +2 -0
  58. package/dist/api/order/order.js.map +1 -1
  59. package/dist/api/order/stop.d.ts +3 -2
  60. package/dist/api/order/stop.js +2 -1
  61. package/dist/api/order/stop.js.map +1 -1
  62. package/dist/api/order/stopLimit.d.ts +3 -2
  63. package/dist/api/order/stopLimit.js +2 -1
  64. package/dist/api/order/stopLimit.js.map +1 -1
  65. package/dist/api/order/trailingStop.d.ts +4 -3
  66. package/dist/api/order/trailingStop.js +2 -1
  67. package/dist/api/order/trailingStop.js.map +1 -1
  68. package/dist/api-next/api-next.d.ts +19 -8
  69. package/dist/api-next/api-next.js +91 -35
  70. package/dist/api-next/api-next.js.map +1 -1
  71. package/dist/api-next/common/connection-state.js +1 -1
  72. package/dist/api-next/common/connection-state.js.map +1 -1
  73. package/dist/api-next/common/item-list-update.d.ts +0 -2
  74. package/dist/api-next/market/market-data-type.js +1 -1
  75. package/dist/api-next/market/market-data-type.js.map +1 -1
  76. package/dist/api-next/market/tick-type.js +1 -1
  77. package/dist/api-next/market/tick-type.js.map +1 -1
  78. package/dist/api-next/market-scanner/market-scanner.d.ts +0 -5
  79. package/dist/api-next/market-scanner/market-scanner.js +8 -8
  80. package/dist/api-next/market-scanner/market-scanner.js.map +1 -1
  81. package/dist/common/errorCode.d.ts +4 -1
  82. package/dist/common/errorCode.js +5 -1
  83. package/dist/common/errorCode.js.map +1 -1
  84. package/dist/core/api-next/item-list-update.d.ts +1 -2
  85. package/dist/core/api-next/item-list-update.js +1 -2
  86. package/dist/core/api-next/item-list-update.js.map +1 -1
  87. package/dist/core/api-next/subscription.d.ts +7 -7
  88. package/dist/core/api-next/subscription.js +16 -16
  89. package/dist/core/api-next/subscription.js.map +1 -1
  90. package/dist/core/io/controller.js +9 -0
  91. package/dist/core/io/controller.js.map +1 -1
  92. package/dist/core/io/decoder.d.ts +12 -6
  93. package/dist/core/io/decoder.js +79 -57
  94. package/dist/core/io/decoder.js.map +1 -1
  95. package/dist/core/io/encoder.d.ts +9 -7
  96. package/dist/core/io/encoder.js +99 -14
  97. package/dist/core/io/encoder.js.map +1 -1
  98. package/dist/core/io/enum/in-msg-id.js +1 -1
  99. package/dist/core/io/enum/in-msg-id.js.map +1 -1
  100. package/dist/core/io/socket.d.ts +4 -0
  101. package/dist/core/io/socket.js +5 -5
  102. package/dist/core/io/socket.js.map +1 -1
  103. package/dist/index.d.ts +8 -6
  104. package/dist/index.js +12 -7
  105. package/dist/index.js.map +1 -1
  106. package/dist/tests/unit/api/api.test.js +22 -22
  107. package/dist/tests/unit/api/api.test.js.map +1 -1
  108. package/dist/tests/unit/api/connect.test.js +11 -9
  109. package/dist/tests/unit/api/connect.test.js.map +1 -1
  110. package/dist/tests/unit/api/contract-details.test.d.ts +1 -0
  111. package/dist/tests/unit/api/contract-details.test.js +114 -0
  112. package/dist/tests/unit/api/contract-details.test.js.map +1 -0
  113. package/dist/tests/unit/api/market-data.test.js +16 -13
  114. package/dist/tests/unit/api/market-data.test.js.map +1 -1
  115. package/dist/tests/unit/api/market-scanner.test.d.ts +1 -0
  116. package/dist/tests/unit/api/market-scanner.test.js +71 -0
  117. package/dist/tests/unit/api/market-scanner.test.js.map +1 -0
  118. package/dist/tests/unit/api/matching-symbols.test.d.ts +1 -0
  119. package/dist/tests/unit/api/matching-symbols.test.js +84 -0
  120. package/dist/tests/unit/api/matching-symbols.test.js.map +1 -0
  121. package/dist/tests/unit/api/order/cancelOrder.test.d.ts +1 -0
  122. package/dist/tests/unit/api/order/cancelOrder.test.js +86 -0
  123. package/dist/tests/unit/api/order/cancelOrder.test.js.map +1 -0
  124. package/dist/tests/unit/api/order/placeOrder.test.js +69 -92
  125. package/dist/tests/unit/api/order/placeOrder.test.js.map +1 -1
  126. package/dist/tests/unit/api/order/reqAllOpenOrders.test.js +27 -26
  127. package/dist/tests/unit/api/order/reqAllOpenOrders.test.js.map +1 -1
  128. package/dist/tests/unit/api/wsh-event-data.test.d.ts +1 -0
  129. package/dist/tests/unit/api/wsh-event-data.test.js +113 -0
  130. package/dist/tests/unit/api/wsh-event-data.test.js.map +1 -0
  131. package/dist/tests/unit/api-next/get-account-summary.test.js +17 -6
  132. package/dist/tests/unit/api-next/get-account-summary.test.js.map +1 -1
  133. package/dist/tests/unit/api-next/get-all-open-orders.test.js +1 -2
  134. package/dist/tests/unit/api-next/get-all-open-orders.test.js.map +1 -1
  135. package/dist/tests/unit/api-next/get-head-timestamp.test.js +1 -1
  136. package/dist/tests/unit/api-next/get-head-timestamp.test.js.map +1 -1
  137. package/dist/tests/unit/api-next/get-historical-data-updates.test.js +1 -1
  138. package/dist/tests/unit/api-next/get-historical-data-updates.test.js.map +1 -1
  139. package/dist/tests/unit/api-next/get-historical-data.test.js +2 -2
  140. package/dist/tests/unit/api-next/get-historical-data.test.js.map +1 -1
  141. package/dist/tests/unit/api-next/{search-contracts.test.js → get-matching-symbols.js} +3 -3
  142. package/dist/tests/unit/api-next/get-matching-symbols.js.map +1 -0
  143. package/dist/tests/unit/api-next/get-positions.test.js +3 -0
  144. package/dist/tests/unit/api-next/get-positions.test.js.map +1 -1
  145. package/dist/tools/account-summary.js +1 -7
  146. package/dist/tools/account-summary.js.map +1 -1
  147. package/dist/tools/commission-reports.d.ts +3 -0
  148. package/dist/tools/commission-reports.js +2 -8
  149. package/dist/tools/commission-reports.js.map +1 -1
  150. package/dist/tools/common/ib-api-next-app.d.ts +2 -0
  151. package/dist/tools/common/ib-api-next-app.js +8 -0
  152. package/dist/tools/common/ib-api-next-app.js.map +1 -1
  153. package/dist/tools/contract-details.js +1 -7
  154. package/dist/tools/contract-details.js.map +1 -1
  155. package/dist/tools/current-time.js +1 -7
  156. package/dist/tools/current-time.js.map +1 -1
  157. package/dist/tools/execution-details.d.ts +3 -0
  158. package/dist/tools/execution-details.js +2 -8
  159. package/dist/tools/execution-details.js.map +1 -1
  160. package/dist/tools/get-head-timestamp.js +3 -8
  161. package/dist/tools/get-head-timestamp.js.map +1 -1
  162. package/dist/tools/histogram-data.d.ts +3 -0
  163. package/dist/tools/histogram-data.js +4 -7
  164. package/dist/tools/histogram-data.js.map +1 -1
  165. package/dist/tools/historical-data-updates.js +3 -11
  166. package/dist/tools/historical-data-updates.js.map +1 -1
  167. package/dist/tools/historical-data.d.ts +3 -0
  168. package/dist/tools/historical-data.js +4 -9
  169. package/dist/tools/historical-data.js.map +1 -1
  170. package/dist/tools/historical-ticks-bid-ask.js +1 -7
  171. package/dist/tools/historical-ticks-bid-ask.js.map +1 -1
  172. package/dist/tools/historical-ticks-last.js +1 -7
  173. package/dist/tools/historical-ticks-last.js.map +1 -1
  174. package/dist/tools/historical-ticks-mid.js +1 -7
  175. package/dist/tools/historical-ticks-mid.js.map +1 -1
  176. package/dist/tools/managed-accts.js +1 -7
  177. package/dist/tools/managed-accts.js.map +1 -1
  178. package/dist/tools/market-data-snapshot.js +1 -8
  179. package/dist/tools/market-data-snapshot.js.map +1 -1
  180. package/dist/tools/market-data.js +1 -8
  181. package/dist/tools/market-data.js.map +1 -1
  182. package/dist/tools/market-depth-exchanges.js +1 -7
  183. package/dist/tools/market-depth-exchanges.js.map +1 -1
  184. package/dist/tools/market-depth.js +1 -7
  185. package/dist/tools/market-depth.js.map +1 -1
  186. package/dist/tools/market-scanner.js +1 -7
  187. package/dist/tools/market-scanner.js.map +1 -1
  188. package/dist/tools/modify-order.js +1 -4
  189. package/dist/tools/modify-order.js.map +1 -1
  190. package/dist/tools/next-valid-order-id.js +1 -7
  191. package/dist/tools/next-valid-order-id.js.map +1 -1
  192. package/dist/tools/open-orders-auto.js +1 -7
  193. package/dist/tools/open-orders-auto.js.map +1 -1
  194. package/dist/tools/open-orders.js +1 -7
  195. package/dist/tools/open-orders.js.map +1 -1
  196. package/dist/tools/place-new-order.js +1 -4
  197. package/dist/tools/place-new-order.js.map +1 -1
  198. package/dist/tools/place-order.js +1 -2
  199. package/dist/tools/place-order.js.map +1 -1
  200. package/dist/tools/pnl-single.js +1 -10
  201. package/dist/tools/pnl-single.js.map +1 -1
  202. package/dist/tools/pnl.js +1 -10
  203. package/dist/tools/pnl.js.map +1 -1
  204. package/dist/tools/positions.js +1 -7
  205. package/dist/tools/positions.js.map +1 -1
  206. package/dist/tools/search-contracts.js +2 -8
  207. package/dist/tools/search-contracts.js.map +1 -1
  208. package/dist/tools/sec-def-opt-params.js +1 -7
  209. package/dist/tools/sec-def-opt-params.js.map +1 -1
  210. package/dist/tools/user-info.js +1 -7
  211. package/dist/tools/user-info.js.map +1 -1
  212. package/package.json +6 -6
  213. package/dist/tests/unit/api-next/search-contracts.test.js.map +0 -1
  214. /package/dist/tests/unit/api-next/{search-contracts.test.d.ts → get-matching-symbols.d.ts} +0 -0
@@ -156,6 +156,15 @@ class Controller {
156
156
  this.ib.emit(event_name_1.EventName.result, eventName, args);
157
157
  }
158
158
  this.ib.emit(event_name_1.EventName.all, eventName, args);
159
+ /*
160
+ Important: The IBApi.EWrapper.nextValidID callback is commonly used to indicate that the connection is completed
161
+ and other messages can be sent from the API client to TWS.
162
+ There is the possibility that function calls made prior to this time could be dropped by TWS.
163
+ */
164
+ if (eventName === event_name_1.EventName.nextValidId) {
165
+ // console.log("nextValidId received");
166
+ this.resume();
167
+ }
159
168
  }
160
169
  /**
161
170
  * Emit an information message event to public API interface.
@@ -1 +1 @@
1
- {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/core/io/controller.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAC3C,8EAA4C;AAG5C,+DAA2D;AAC3D,+EAAuD;AACvD,sDAAmD;AACnD,uCAAsD;AACtD,uCAAsD;AACtD,qCAAkC;AAElC;;;;;GAKG;AACH,MAAa,UAAU;IACrB;;;;OAIG;IACH,YAAoB,EAAS,EAAU,OAA8B;QAAjD,OAAE,GAAF,EAAE,CAAO;QAAU,YAAO,GAAP,OAAO,CAAuB;QAarE,0BAA0B;QACT,aAAQ,GAAG,IAAI,wBAAa,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAKxE,+BAA+B;QACtB,YAAO,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,CAAC;QAErC,+BAA+B;QACtB,YAAO,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,CAAC;QAtBnC,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,MAAM,IAAI,GACR,OAAO,EAAE,YAAY,IAAI,uBAAa,CAAC,kBAAkB,IAAI,EAAE,CAAC;QAClE,IAAI,CAAC,WAAW,GAAG,IAAA,6BAAS,EAAC,IAAI,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC,MAAiB,EAAE,EAAE;YACvE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC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C,IAAa;QAEb,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC;IAED;;;;OAIG;IACK,cAAc,CAAC,QAAiB;QACtC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YAC1B,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;SAC/B;aAAM;YACL,IAAI,CAAC,SAAS,CACZ,sCAAsC,EACtC,qBAAS,CAAC,YAAY,EACtB,CAAC,CAAC,CACH,CAAC;SACH;IACH,CAAC;IAED;;;;OAIG;IACK,iBAAiB;QACvB,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACzB,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;SAC1B;aAAM;YACL,IAAI,CAAC,QAAQ,CACX,4CAA4C,EAC5C,qBAAS,CAAC,aAAa,CACxB,CAAC;SACH;IACH,CAAC;IAED;;;;;;OAMG;IACK,WAAW,CAAC,MAAiB;QACnC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC1B;aAAM;YACL,IAAI,CAAC,SAAS,CACZ,qCAAqC,EACrC,qBAAS,CAAC,aAAa,EACvB,CAAC,CAAC,CACH,CAAC;SACH;IACH,CAAC;CACF;AA/QD,gCA+QC"}
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/core/io/controller.ts"],"names":[],"mappings":";;;;;;AAAA,oEAA2C;AAC3C,8EAA4C;AAG5C,+DAA2D;AAC3D,+EAAuD;AACvD,sDAAmD;AACnD,uCAAsD;AACtD,uCAAsD;AACtD,qCAAkC;AAElC;;;;;GAKG;AACH,MAAa,UAAU;IACrB;;;;OAIG;IACH,YAAoB,EAAS,EAAU,OAA8B;QAAjD,OAAE,GAAF,EAAE,CAAO;QAAU,YAAO,GAAP,OAAO,CAAuB;QAarE,0BAA0B;QACT,aAAQ,GAAG,IAAI,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AC,aAAa,CACxB,CAAC;SACH;IACH,CAAC;IAED;;;;;;OAMG;IACK,WAAW,CAAC,MAAiB;QACnC,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SAC1B;aAAM;YACL,IAAI,CAAC,SAAS,CACZ,qCAAqC,EACrC,qBAAS,CAAC,aAAa,EACvB,CAAC,CAAC,CACH,CAAC;SACH;IACH,CAAC;CACF;AAzRD,gCAyRC"}
@@ -106,6 +106,12 @@ export declare class Decoder {
106
106
  * Returns undefined is the token is Number.MAX_VALUE.
107
107
  */
108
108
  readDouble(): number | undefined;
109
+ /**
110
+ * Read a token from queue and return it as floating point value.
111
+ *
112
+ * Returns undefined if the token is empty or is Number.MAX_VALUE.
113
+ */
114
+ readDecimal(): number | undefined;
109
115
  /**
110
116
  * Read a token from queue and return it as floating point value.
111
117
  *
@@ -164,7 +170,7 @@ export declare class Decoder {
164
170
  */
165
171
  private decodeMsg_ACCT_VALUE;
166
172
  /**
167
- * Decode a PORTFOLIO_VALUE message from data queue and emit a updatePortfolio event.
173
+ * Decode a PORTFOLIO_VALUE message from data queue and emit a updatePortfolio (PortfolioValue) event.
168
174
  */
169
175
  private decodeMsg_PORTFOLIO_VALUE;
170
176
  /**
@@ -184,11 +190,11 @@ export declare class Decoder {
184
190
  */
185
191
  private decodeMsg_EXECUTION_DATA;
186
192
  /**
187
- * Decode a MARKET_DEPTH message from data queue and emit a updateMktDepth event.
193
+ * Decode a MARKET_DEPTH message from data queue and emit a MarketDepth event.
188
194
  */
189
195
  private decodeMsg_MARKET_DEPTH;
190
196
  /**
191
- * Decode a MARKET_DEPTH_L2 message from data queue and emit a updateMktDepthL2 event.
197
+ * Decode a MARKET_DEPTH_L2 message from data queue and emit a MarketDepthL2 event.
192
198
  */
193
199
  private decodeMsg_MARKET_DEPTH_L2;
194
200
  /**
@@ -224,7 +230,7 @@ export declare class Decoder {
224
230
  */
225
231
  private decodeMsg_MARKET_RULE;
226
232
  /**
227
- * Decode a BOND_CONTRACT_DATA message from data queue and emit a bondContractDetails event.
233
+ * Decode a BOND_CONTRACT_DATA message from data queue and emit a BondContractData event.
228
234
  */
229
235
  private decodeMsg_BOND_CONTRACT_DATA;
230
236
  /**
@@ -256,7 +262,7 @@ export declare class Decoder {
256
262
  */
257
263
  private decodeMsg_CURRENT_TIME;
258
264
  /**
259
- * Decode a REAL_TIME_BARS message from data queue and emit a realtimeBar event.
265
+ * Decode a REAL_TIME_BARS message from data queue and emit a realtimeBars event.
260
266
  */
261
267
  private decodeMsg_REAL_TIME_BARS;
262
268
  /**
@@ -320,7 +326,7 @@ export declare class Decoder {
320
326
  */
321
327
  private decodeMsg_DISPLAY_GROUP_UPDATED;
322
328
  /**
323
- * Decode a POSITION_MULTI message from data queue and emit a accountSummary event.
329
+ * Decode a POSITION_MULTI message from data queue and emit a PositionMulti event.
324
330
  */
325
331
  private decodeMsg_POSITION_MULTI;
326
332
  /**
@@ -356,6 +356,19 @@ class Decoder {
356
356
  const val = parseFloat(token);
357
357
  return val === Number.MAX_VALUE ? undefined : val;
358
358
  }
359
+ /**
360
+ * Read a token from queue and return it as floating point value.
361
+ *
362
+ * Returns undefined if the token is empty or is Number.MAX_VALUE.
363
+ */
364
+ readDecimal() {
365
+ const token = this.readStr();
366
+ if (!token || token === "") {
367
+ return undefined;
368
+ }
369
+ const val = parseFloat(token.replaceAll(",", ""));
370
+ return val === Number.MAX_VALUE || val === Infinity ? undefined : val;
371
+ }
359
372
  /**
360
373
  * Read a token from queue and return it as floating point value.
361
374
  *
@@ -438,7 +451,7 @@ class Decoder {
438
451
  const price = this.readDouble();
439
452
  let size = undefined;
440
453
  if (version >= 2) {
441
- size = this.readInt();
454
+ size = this.readDecimal();
442
455
  }
443
456
  let canAutoExecute = undefined;
444
457
  if (version >= 3) {
@@ -480,7 +493,7 @@ class Decoder {
480
493
  this.readInt(); // version
481
494
  const tickerId = this.readInt();
482
495
  const tickType = this.readInt();
483
- const size = this.readInt();
496
+ const size = this.readDecimal();
484
497
  this.emit(event_name_1.EventName.tickSize, tickerId, tickType, size);
485
498
  }
486
499
  /**
@@ -492,8 +505,8 @@ class Decoder {
492
505
  : this.readInt();
493
506
  const id = this.readInt();
494
507
  const status = this.readStr();
495
- const filled = this.readInt();
496
- const remaining = this.readInt();
508
+ const filled = this.readDecimal();
509
+ const remaining = this.readDecimal();
497
510
  const avgFillPrice = this.readDouble();
498
511
  let permId = undefined;
499
512
  if (version >= 2) {
@@ -636,6 +649,7 @@ class Decoder {
636
649
  orderDecoder.readDuration();
637
650
  orderDecoder.readPostToAts();
638
651
  orderDecoder.readAutoCancelParent(min_server_version_1.default.AUTO_CANCEL_PARENT);
652
+ orderDecoder.readPegBestPegMidOrderAttributes();
639
653
  this.emit(event_name_1.EventName.openOrder, order.orderId, contract, order, orderState);
640
654
  }
641
655
  /**
@@ -650,7 +664,7 @@ class Decoder {
650
664
  this.emit(event_name_1.EventName.updateAccountValue, key, value, currency, accountName);
651
665
  }
652
666
  /**
653
- * Decode a PORTFOLIO_VALUE message from data queue and emit a updatePortfolio event.
667
+ * Decode a PORTFOLIO_VALUE message from data queue and emit a updatePortfolio (PortfolioValue) event.
654
668
  */
655
669
  decodeMsg_PORTFOLIO_VALUE() {
656
670
  const version = this.readInt();
@@ -674,13 +688,7 @@ class Decoder {
674
688
  if (version >= 8) {
675
689
  contract.tradingClass = this.readStr();
676
690
  }
677
- let position;
678
- if (this.serverVersion >= min_server_version_1.default.FRACTIONAL_POSITIONS) {
679
- position = this.readDouble();
680
- }
681
- else {
682
- position = this.readInt();
683
- }
691
+ const position = this.readDecimal();
684
692
  const marketPrice = this.readDouble();
685
693
  const marketValue = this.readDouble();
686
694
  let averageCost = undefined;
@@ -806,12 +814,12 @@ class Decoder {
806
814
  }
807
815
  if (this.serverVersion >= min_server_version_1.default.FRACTIONAL_SIZE_SUPPORT &&
808
816
  this.serverVersion < min_server_version_1.default.SIZE_RULES) {
809
- this.readDouble(); // sizeMinTick - not used anymore
817
+ this.readDecimal(); // sizeMinTick - not used anymore
810
818
  }
811
819
  if (this.serverVersion >= min_server_version_1.default.SIZE_RULES) {
812
- contract.minSize = this.readDouble();
813
- contract.sizeIncrement = this.readDouble();
814
- contract.suggestedSizeIncrement = this.readDouble();
820
+ contract.minSize = this.readDecimal();
821
+ contract.sizeIncrement = this.readDecimal();
822
+ contract.suggestedSizeIncrement = this.readDecimal();
815
823
  }
816
824
  }
817
825
  this.emit(event_name_1.EventName.contractDetails, reqId, contract);
@@ -855,7 +863,7 @@ class Decoder {
855
863
  exec.acctNumber = this.readStr();
856
864
  exec.exchange = this.readStr();
857
865
  exec.side = this.readStr();
858
- exec.shares = this.readInt();
866
+ exec.shares = this.readDecimal();
859
867
  exec.price = this.readDouble();
860
868
  if (version >= 2) {
861
869
  exec.permId = this.readInt();
@@ -867,7 +875,7 @@ class Decoder {
867
875
  exec.liquidation = this.readInt();
868
876
  }
869
877
  if (version >= 6) {
870
- exec.cumQty = this.readInt();
878
+ exec.cumQty = this.readDecimal();
871
879
  exec.avgPrice = this.readDouble();
872
880
  }
873
881
  if (version >= 8) {
@@ -883,10 +891,13 @@ class Decoder {
883
891
  if (this.serverVersion >= min_server_version_1.default.LAST_LIQUIDITY) {
884
892
  exec.lastLiquidity = { value: this.readInt() };
885
893
  }
894
+ if (this.serverVersion >= min_server_version_1.default.PENDING_PRICE_REVISION) {
895
+ exec.pendingPriceRevision = this.readBool();
896
+ }
886
897
  this.emit(event_name_1.EventName.execDetails, reqId, contract, exec);
887
898
  }
888
899
  /**
889
- * Decode a MARKET_DEPTH message from data queue and emit a updateMktDepth event.
900
+ * Decode a MARKET_DEPTH message from data queue and emit a MarketDepth event.
890
901
  */
891
902
  decodeMsg_MARKET_DEPTH() {
892
903
  this.readInt(); // version
@@ -895,11 +906,11 @@ class Decoder {
895
906
  const operation = this.readInt();
896
907
  const side = this.readInt();
897
908
  const price = this.readDouble();
898
- const size = this.readInt();
909
+ const size = this.readDecimal();
899
910
  this.emit(event_name_1.EventName.updateMktDepth, id, position, operation, side, price, size);
900
911
  }
901
912
  /**
902
- * Decode a MARKET_DEPTH_L2 message from data queue and emit a updateMktDepthL2 event.
913
+ * Decode a MARKET_DEPTH_L2 message from data queue and emit a MarketDepthL2 event.
903
914
  */
904
915
  decodeMsg_MARKET_DEPTH_L2() {
905
916
  this.readInt(); // version
@@ -909,7 +920,7 @@ class Decoder {
909
920
  const operation = this.readInt();
910
921
  const side = this.readInt();
911
922
  const price = this.readDouble();
912
- const size = this.readInt();
923
+ const size = this.readDecimal();
913
924
  let isSmartDepth = undefined;
914
925
  if (this.serverVersion >= min_server_version_1.default.SMART_DEPTH) {
915
926
  isSmartDepth = this.readBool();
@@ -968,8 +979,9 @@ class Decoder {
968
979
  const high = this.readDouble();
969
980
  const low = this.readDouble();
970
981
  const close = this.readDouble();
971
- const volume = this.readInt();
972
- const WAP = this.readDouble();
982
+ const volume = this.readDecimal();
983
+ const WAP = this.readDecimal();
984
+ // TODO: hasGap is deprecated, we should readStr and ignore result
973
985
  let hasGaps = undefined;
974
986
  if (this.serverVersion < min_server_version_1.default.SYNT_REALTIME_BARS) {
975
987
  hasGaps = this.readBool();
@@ -994,8 +1006,8 @@ class Decoder {
994
1006
  const close = this.readDouble();
995
1007
  const high = this.readDouble();
996
1008
  const low = this.readDouble();
997
- const WAP = this.readDouble();
998
- const volume = this.readInt();
1009
+ const WAP = this.readDecimal();
1010
+ const volume = this.readDecimal();
999
1011
  this.emit(event_name_1.EventName.historicalDataUpdate, reqId, date, open, high, low, close, volume, barCount, WAP);
1000
1012
  }
1001
1013
  /**
@@ -1032,7 +1044,7 @@ class Decoder {
1032
1044
  this.emit(event_name_1.EventName.marketRule, marketRuleId, priceIncrements);
1033
1045
  }
1034
1046
  /**
1035
- * Decode a BOND_CONTRACT_DATA message from data queue and emit a bondContractDetails event.
1047
+ * Decode a BOND_CONTRACT_DATA message from data queue and emit a BondContractData event.
1036
1048
  */
1037
1049
  decodeMsg_BOND_CONTRACT_DATA() {
1038
1050
  let version = 6;
@@ -1104,9 +1116,9 @@ class Decoder {
1104
1116
  contract.marketRuleIds = this.readStr();
1105
1117
  }
1106
1118
  if (this.serverVersion >= min_server_version_1.default.SIZE_RULES) {
1107
- contract.minSize = this.readDouble();
1108
- contract.sizeIncrement = this.readDouble();
1109
- contract.suggestedSizeIncrement = this.readDouble();
1119
+ contract.minSize = this.readDecimal();
1120
+ contract.sizeIncrement = this.readDecimal();
1121
+ contract.suggestedSizeIncrement = this.readDecimal();
1110
1122
  }
1111
1123
  this.emit(event_name_1.EventName.bondContractDetails, reqId, contract);
1112
1124
  }
@@ -1268,7 +1280,7 @@ class Decoder {
1268
1280
  this.emit(event_name_1.EventName.currentTime, time);
1269
1281
  }
1270
1282
  /**
1271
- * Decode a REAL_TIME_BARS message from data queue and emit a realtimeBar event.
1283
+ * Decode a REAL_TIME_BARS message from data queue and emit a realtimeBars event.
1272
1284
  */
1273
1285
  decodeMsg_REAL_TIME_BARS() {
1274
1286
  this.readInt(); // version
@@ -1278,8 +1290,8 @@ class Decoder {
1278
1290
  const high = this.readDouble();
1279
1291
  const low = this.readDouble();
1280
1292
  const close = this.readDouble();
1281
- const volume = this.readInt();
1282
- const wap = this.readDouble();
1293
+ const volume = this.readDecimal();
1294
+ const wap = this.readDecimal();
1283
1295
  const count = this.readInt();
1284
1296
  this.emit(event_name_1.EventName.realtimeBar, reqId, time, open, high, low, close, volume, wap, count);
1285
1297
  }
@@ -1387,9 +1399,7 @@ class Decoder {
1387
1399
  if (version >= 2) {
1388
1400
  contract.tradingClass = this.readStr();
1389
1401
  }
1390
- const pos = this.serverVersion >= min_server_version_1.default.FRACTIONAL_POSITIONS
1391
- ? this.readDouble()
1392
- : this.readInt();
1402
+ const pos = this.readDecimal();
1393
1403
  let avgCost = 0;
1394
1404
  if (version >= 3) {
1395
1405
  avgCost = this.readDouble();
@@ -1442,7 +1452,7 @@ class Decoder {
1442
1452
  this.emit(event_name_1.EventName.displayGroupUpdated, reqId, contractInfo);
1443
1453
  }
1444
1454
  /**
1445
- * Decode a POSITION_MULTI message from data queue and emit a accountSummary event.
1455
+ * Decode a POSITION_MULTI message from data queue and emit a PositionMulti event.
1446
1456
  */
1447
1457
  decodeMsg_POSITION_MULTI() {
1448
1458
  this.readInt(); // version
@@ -1460,7 +1470,7 @@ class Decoder {
1460
1470
  contract.currency = this.readStr();
1461
1471
  contract.localSymbol = this.readStr();
1462
1472
  contract.tradingClass = this.readStr();
1463
- const pos = this.readInt();
1473
+ const pos = this.readDecimal();
1464
1474
  const avgCost = this.readDouble();
1465
1475
  const modelCode = this.readStr();
1466
1476
  this.emit(event_name_1.EventName.positionMulti, reqId, account, modelCode, contract, pos, avgCost);
@@ -1572,6 +1582,10 @@ class Decoder {
1572
1582
  for (let j = 0; j < nDerivativeSecTypes; j++) {
1573
1583
  derivativeSecTypes[j] = this.readStr();
1574
1584
  }
1585
+ if (this.serverVersion >= min_server_version_1.default.BOND_ISSUERID) {
1586
+ contract.description = this.readStr();
1587
+ contract.issuerId = this.readStr();
1588
+ }
1575
1589
  contractDescriptions[i] = {
1576
1590
  contract: contract,
1577
1591
  derivativeSecTypes: derivativeSecTypes,
@@ -1704,7 +1718,7 @@ class Decoder {
1704
1718
  for (let i = 0; i < count; i++) {
1705
1719
  items[i] = {
1706
1720
  price: this.readDouble(),
1707
- size: this.readInt(),
1721
+ size: this.readDecimal(),
1708
1722
  };
1709
1723
  }
1710
1724
  this.emit(event_name_1.EventName.histogramData, reqId, items);
@@ -1730,7 +1744,7 @@ class Decoder {
1730
1744
  */
1731
1745
  decodeMsg_PNL_SINGLE() {
1732
1746
  const reqId = this.readInt();
1733
- const pos = this.readInt();
1747
+ const pos = this.readDecimal();
1734
1748
  const dailyPnL = this.readDouble();
1735
1749
  let unrealizedPnL = undefined;
1736
1750
  let realizedPnL = undefined;
@@ -1754,7 +1768,7 @@ class Decoder {
1754
1768
  const time = this.readInt();
1755
1769
  this.readInt(); //for consistency
1756
1770
  const price = this.readDouble();
1757
- const size = this.readInt();
1771
+ const size = this.readDecimal();
1758
1772
  ticks[i] = {
1759
1773
  time,
1760
1774
  price,
@@ -1776,8 +1790,8 @@ class Decoder {
1776
1790
  const flags = this.readInt();
1777
1791
  const priceBid = this.readDouble();
1778
1792
  const priceAsk = this.readDouble();
1779
- const sizeBid = this.readInt();
1780
- const sizeAsk = this.readInt();
1793
+ const sizeBid = this.readDecimal();
1794
+ const sizeAsk = this.readDecimal();
1781
1795
  ticks[i] = {
1782
1796
  time: time,
1783
1797
  tickAttribBidAsk: {
@@ -1804,7 +1818,7 @@ class Decoder {
1804
1818
  const time = this.readInt();
1805
1819
  const mask = this.readInt();
1806
1820
  const price = this.readDouble();
1807
- const size = this.readInt();
1821
+ const size = this.readDecimal();
1808
1822
  const exchange = this.readStr();
1809
1823
  const specialConditions = this.readStr();
1810
1824
  ticks[i] = {
@@ -1836,7 +1850,7 @@ class Decoder {
1836
1850
  case 2: {
1837
1851
  // All-last
1838
1852
  const price = this.readDouble();
1839
- const size = this.readInt();
1853
+ const size = this.readDecimal();
1840
1854
  const mask = this.readInt();
1841
1855
  const pastLimit = (mask & (1 << 0)) !== 0;
1842
1856
  const unreported = (mask & (1 << 1)) !== 0;
@@ -1849,8 +1863,8 @@ class Decoder {
1849
1863
  // BidAsk
1850
1864
  const bidPrice = this.readDouble();
1851
1865
  const askPrice = this.readDouble();
1852
- const bidSize = this.readInt();
1853
- const askSize = this.readInt();
1866
+ const bidSize = this.readDecimal();
1867
+ const askSize = this.readDecimal();
1854
1868
  const mask = this.readInt();
1855
1869
  const bidPastLow = (mask & (1 << 0)) !== 0;
1856
1870
  const askPastHigh = (mask & (1 << 1)) !== 0;
@@ -2413,7 +2427,9 @@ class Decoder {
2413
2427
  readLastTradeDate(contract, isBond) {
2414
2428
  const lastTradeDateOrContractMonth = this.readStr();
2415
2429
  if (lastTradeDateOrContractMonth?.length) {
2416
- const tokens = lastTradeDateOrContractMonth.split("\\s+");
2430
+ const tokens = lastTradeDateOrContractMonth.indexOf("-") > 0
2431
+ ? lastTradeDateOrContractMonth.split("-")
2432
+ : lastTradeDateOrContractMonth.split("\\s+");
2417
2433
  if (tokens.length > 0) {
2418
2434
  if (isBond) {
2419
2435
  contract.maturity = tokens[0];
@@ -2475,12 +2491,7 @@ class OrderDecoder {
2475
2491
  this.order.action = this.decoder.readStr();
2476
2492
  }
2477
2493
  readTotalQuantity() {
2478
- if (this.serverVersion >= min_server_version_1.default.FRACTIONAL_POSITIONS) {
2479
- this.order.totalQuantity = this.decoder.readDouble();
2480
- }
2481
- else {
2482
- this.order.totalQuantity = this.decoder.readInt();
2483
- }
2494
+ this.order.totalQuantity = this.decoder.readDecimal();
2484
2495
  }
2485
2496
  readOrderType() {
2486
2497
  this.order.orderType = this.decoder.readStr();
@@ -2566,7 +2577,8 @@ class OrderDecoder {
2566
2577
  this.order.faGroup = this.decoder.readStr();
2567
2578
  this.order.faMethod = this.decoder.readStr();
2568
2579
  this.order.faPercentage = this.decoder.readStr();
2569
- this.order.faProfile = this.decoder.readStr();
2580
+ if (this.serverVersion < min_server_version_1.default.FA_PROFILE_DESUPPORT)
2581
+ this.order.faProfile = this.decoder.readStr();
2570
2582
  }
2571
2583
  }
2572
2584
  readModelCode() {
@@ -2920,7 +2932,7 @@ class OrderDecoder {
2920
2932
  }
2921
2933
  readPegToBenchParams() {
2922
2934
  if (this.serverVersion >= min_server_version_1.default.PEGGED_TO_BENCHMARK) {
2923
- if (this.order.orderType === orderType_1.OrderType.PEG_BENCH) {
2935
+ if ((0, orderType_1.isPegBenchOrder)(this.order.orderType)) {
2924
2936
  this.order.referenceContractId = this.decoder.readInt();
2925
2937
  this.order.isPeggedChangeAmountDecrease = this.decoder.readBool();
2926
2938
  this.order.peggedChangeAmount = this.decoder.readDouble();
@@ -3052,7 +3064,7 @@ class OrderDecoder {
3052
3064
  this.order.autoCancelDate = this.decoder.readStr();
3053
3065
  }
3054
3066
  readFilledQuantity() {
3055
- this.order.filledQuantity = this.decoder.readDoubleOrUndefined();
3067
+ this.order.filledQuantity = this.decoder.readDecimal();
3056
3068
  }
3057
3069
  readRefFuturesConId() {
3058
3070
  this.order.refFuturesConId = this.decoder.readInt();
@@ -3096,5 +3108,15 @@ class OrderDecoder {
3096
3108
  this.order.postToAts = this.decoder.readIntMax();
3097
3109
  }
3098
3110
  }
3111
+ readPegBestPegMidOrderAttributes() {
3112
+ if (this.serverVersion >= min_server_version_1.default.PEGBEST_PEGMID_OFFSETS) {
3113
+ this.order.minTradeQty = this.decoder.readIntMax();
3114
+ this.order.minCompeteSize = this.decoder.readIntMax();
3115
+ this.order.competeAgainstBestOffset =
3116
+ this.decoder.readDoubleOrUndefined();
3117
+ this.order.midOffsetAtWhole = this.decoder.readDoubleOrUndefined();
3118
+ this.order.midOffsetAtHalf = this.decoder.readDoubleOrUndefined();
3119
+ }
3120
+ }
3099
3121
  }
3100
3122
  //# sourceMappingURL=decoder.js.map