tigeropen 0.3.0 → 0.5.5

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 (84) hide show
  1. package/README.md +55 -2
  2. package/dist/cjs/client/api-response.js +28 -7
  3. package/dist/cjs/client/case-convert.js +4 -3
  4. package/dist/cjs/client/http-client.js +124 -8
  5. package/dist/cjs/client/token-methods.js +42 -0
  6. package/dist/cjs/config/client-config.js +115 -16
  7. package/dist/cjs/config/config-parser.js +19 -9
  8. package/dist/cjs/config/index.js +4 -1
  9. package/dist/cjs/config/token-manager.js +54 -4
  10. package/dist/cjs/index.js +53 -2
  11. package/dist/cjs/model/enums.js +106 -7
  12. package/dist/cjs/model/order-helpers.js +149 -0
  13. package/dist/cjs/model/order-status.js +46 -0
  14. package/dist/cjs/model/quote-requests.js +11 -0
  15. package/dist/cjs/model/trade-requests.js +13 -0
  16. package/dist/cjs/push/index.js +1 -0
  17. package/dist/cjs/push/pb/OrderStatusData.js +24 -0
  18. package/dist/cjs/push/proto-message.js +6 -0
  19. package/dist/cjs/push/push-client.js +117 -19
  20. package/dist/cjs/push/push-message.js +4 -0
  21. package/dist/cjs/push/tick-util.js +172 -0
  22. package/dist/cjs/quote/quote-client.js +584 -42
  23. package/dist/cjs/trade/trade-client.js +334 -32
  24. package/dist/cjs/version.js +4 -0
  25. package/dist/esm/client/api-request.js +1 -1
  26. package/dist/esm/client/api-response.js +29 -8
  27. package/dist/esm/client/case-convert.js +4 -3
  28. package/dist/esm/client/http-client.js +128 -12
  29. package/dist/esm/client/index.js +6 -6
  30. package/dist/esm/client/token-methods.js +37 -0
  31. package/dist/esm/config/client-config.js +118 -20
  32. package/dist/esm/config/config-parser.js +19 -9
  33. package/dist/esm/config/index.js +4 -3
  34. package/dist/esm/config/token-manager.js +55 -5
  35. package/dist/esm/index.js +15 -1
  36. package/dist/esm/logger/index.js +1 -1
  37. package/dist/esm/model/contract-helpers.js +1 -1
  38. package/dist/esm/model/enums.js +104 -6
  39. package/dist/esm/model/order-helpers.js +142 -1
  40. package/dist/esm/model/order-status.js +43 -0
  41. package/dist/esm/model/quote-requests.js +10 -0
  42. package/dist/esm/model/trade-requests.js +12 -0
  43. package/dist/esm/push/index.js +6 -5
  44. package/dist/esm/push/pb/OrderStatusData.js +24 -0
  45. package/dist/esm/push/pb/PushData.js +11 -11
  46. package/dist/esm/push/pb/QuoteBasicData.js +1 -1
  47. package/dist/esm/push/pb/Response.js +1 -1
  48. package/dist/esm/push/pb/index.js +17 -17
  49. package/dist/esm/push/proto-message.js +9 -3
  50. package/dist/esm/push/push-client.js +124 -26
  51. package/dist/esm/push/push-message.js +4 -0
  52. package/dist/esm/push/tick-util.js +165 -0
  53. package/dist/esm/quote/index.js +1 -1
  54. package/dist/esm/quote/quote-client.js +553 -44
  55. package/dist/esm/signer/index.js +2 -2
  56. package/dist/esm/trade/index.js +1 -1
  57. package/dist/esm/trade/trade-client.js +303 -34
  58. package/dist/esm/version.js +1 -0
  59. package/dist/types/client/api-response.d.ts +6 -4
  60. package/dist/types/client/case-convert.d.ts +3 -1
  61. package/dist/types/client/http-client.d.ts +32 -1
  62. package/dist/types/client/token-methods.d.ts +34 -0
  63. package/dist/types/config/client-config.d.ts +22 -1
  64. package/dist/types/config/index.d.ts +3 -1
  65. package/dist/types/config/token-manager.d.ts +27 -3
  66. package/dist/types/index.d.ts +22 -1
  67. package/dist/types/model/enums.d.ts +77 -7
  68. package/dist/types/model/order-helpers.d.ts +52 -1
  69. package/dist/types/model/order-status.d.ts +14 -0
  70. package/dist/types/model/order.d.ts +127 -10
  71. package/dist/types/model/quote-requests.d.ts +356 -0
  72. package/dist/types/model/quote.d.ts +391 -4
  73. package/dist/types/model/trade-requests.d.ts +309 -0
  74. package/dist/types/model/trade.d.ts +231 -5
  75. package/dist/types/push/callbacks.d.ts +3 -7
  76. package/dist/types/push/index.d.ts +1 -0
  77. package/dist/types/push/pb/OrderStatusData.d.ts +4 -0
  78. package/dist/types/push/push-client.d.ts +36 -3
  79. package/dist/types/push/push-message.d.ts +4 -0
  80. package/dist/types/push/tick-util.d.ts +30 -0
  81. package/dist/types/quote/quote-client.d.ts +193 -15
  82. package/dist/types/trade/trade-client.d.ts +136 -18
  83. package/dist/types/version.d.ts +1 -0
  84. package/package.json +5 -2
package/dist/esm/index.js CHANGED
@@ -15,4 +15,18 @@
15
15
  * @packageDocumentation
16
16
  */
17
17
  /** SDK 版本号 */
18
- export const VERSION = '0.3.0';
18
+ export { SDK_VERSION as VERSION } from './version.js';
19
+ // Config
20
+ export { createClientConfig, loadPropertiesFile, SANDBOX_TIGER_PUBLIC_KEY } from './config/index.js';
21
+ export { TokenManager } from './config/index.js';
22
+ // Transport
23
+ export { HttpClient } from './client/index.js';
24
+ export { TigerError, classifyErrorCode } from './client/index.js';
25
+ // Clients
26
+ export { QuoteClient, parseOptionIdentifier } from './quote/index.js';
27
+ export { TradeClient } from './trade/index.js';
28
+ export { PushClient, ConnectionState, SubjectType } from './push/index.js';
29
+ export { marketOrder, limitOrder, stopOrder, stopLimitOrder } from './model/order-helpers.js';
30
+ export { normalizeOrderStatus } from './model/order-status.js';
31
+ // Enums
32
+ export { OrderStatus, SecurityType, OrderType, TimeInForce, Market, Currency, QuoteRight, SegmentType, OrderSortBy, CorporateActionType, IndustryLevel, SortDirection, OptionAnalysisPeriod, FinancialReportPeriod, Language, License, BarPeriod, orderStatusCode, } from './model/enums.js';
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * 日志模块导出
3
3
  */
4
- export * from './logger';
4
+ export * from './logger.js';
@@ -1,4 +1,4 @@
1
- import { SecurityType } from './enums';
1
+ import { SecurityType } from './enums.js';
2
2
  /** 构造股票合约 */
3
3
  export function stockContract(symbol, currency) {
4
4
  return { symbol, secType: SecurityType.STK, currency };
@@ -47,20 +47,63 @@ export var OrderType;
47
47
  OrderType["TWAP"] = "TWAP";
48
48
  OrderType["VWAP"] = "VWAP";
49
49
  OrderType["OCA"] = "OCA";
50
+ OrderType["ICEBERG"] = "ICEBERG";
50
51
  })(OrderType || (OrderType = {}));
51
- /** 订单状态枚举 */
52
+ /** 冰山单价格类型 */
53
+ export var PriceType;
54
+ (function (PriceType) {
55
+ /** 限价 */
56
+ PriceType["LIMIT_PRICE"] = "LIMIT_PRICE";
57
+ /** 卖一价 */
58
+ PriceType["ASK_PRICE"] = "ASK_PRICE";
59
+ /** 买一价 */
60
+ PriceType["BID_PRICE"] = "BID_PRICE";
61
+ /** 最新价 */
62
+ PriceType["LATEST_PRICE"] = "LATEST_PRICE";
63
+ })(PriceType || (PriceType = {}));
64
+ /**
65
+ * 订单状态枚举。对齐 Java SDK OrderStatus 定义。
66
+ *
67
+ * 服务端 wire 返回的值同时可能是:
68
+ * - 数字: -2 / -1 / 3 / 4 / 5 / 6 / 7 / 8
69
+ * - 字符串: "Invalid" / "Initial" / "PendingCancel" / "Cancelled" /
70
+ * "Submitted" / "Filled" / "Inactive" / "PendingSubmit"
71
+ *
72
+ * Client 层通过 normalizeOrderStatus() 做数字→字符串归一,不做跨别名合并。
73
+ */
52
74
  export var OrderStatus;
53
75
  (function (OrderStatus) {
54
- OrderStatus["PendingNew"] = "PendingNew";
76
+ OrderStatus["Invalid"] = "Invalid";
55
77
  OrderStatus["Initial"] = "Initial";
78
+ OrderStatus["PendingCancel"] = "PendingCancel";
79
+ OrderStatus["Cancelled"] = "Cancelled";
56
80
  OrderStatus["Submitted"] = "Submitted";
57
- OrderStatus["PartiallyFilled"] = "PartiallyFilled";
58
81
  OrderStatus["Filled"] = "Filled";
59
- OrderStatus["Cancelled"] = "Cancelled";
60
- OrderStatus["PendingCancel"] = "PendingCancel";
61
82
  OrderStatus["Inactive"] = "Inactive";
62
- OrderStatus["Invalid"] = "Invalid";
83
+ OrderStatus["PendingSubmit"] = "PendingSubmit";
63
84
  })(OrderStatus || (OrderStatus = {}));
85
+ /** 返回订单状态对应的服务端数字码,未知返回 0。 */
86
+ export function orderStatusCode(status) {
87
+ switch (status) {
88
+ case OrderStatus.Invalid:
89
+ return -2;
90
+ case OrderStatus.Initial:
91
+ return -1;
92
+ case OrderStatus.PendingCancel:
93
+ return 3;
94
+ case OrderStatus.Cancelled:
95
+ return 4;
96
+ case OrderStatus.Submitted:
97
+ return 5;
98
+ case OrderStatus.Filled:
99
+ return 6;
100
+ case OrderStatus.Inactive:
101
+ return 7;
102
+ case OrderStatus.PendingSubmit:
103
+ return 8;
104
+ }
105
+ return 0;
106
+ }
64
107
  /** K 线周期枚举 */
65
108
  export var BarPeriod;
66
109
  (function (BarPeriod) {
@@ -103,5 +146,60 @@ export var TimeInForce;
103
146
  (function (TimeInForce) {
104
147
  TimeInForce["DAY"] = "DAY";
105
148
  TimeInForce["GTC"] = "GTC";
149
+ TimeInForce["GTD"] = "GTD";
106
150
  TimeInForce["OPG"] = "OPG";
107
151
  })(TimeInForce || (TimeInForce = {}));
152
+ /** 订单排序字段 */
153
+ export var OrderSortBy;
154
+ (function (OrderSortBy) {
155
+ OrderSortBy["LatestCreated"] = "LATEST_CREATED";
156
+ OrderSortBy["LatestStatusUpdated"] = "LATEST_STATUS_UPDATED";
157
+ })(OrderSortBy || (OrderSortBy = {}));
158
+ /** 账户分部类型 */
159
+ export var SegmentType;
160
+ (function (SegmentType) {
161
+ SegmentType["All"] = "ALL";
162
+ SegmentType["Sec"] = "SEC";
163
+ SegmentType["Fut"] = "FUT";
164
+ SegmentType["Fund"] = "FUND";
165
+ })(SegmentType || (SegmentType = {}));
166
+ /** 公司行动类型 */
167
+ export var CorporateActionType;
168
+ (function (CorporateActionType) {
169
+ CorporateActionType["Split"] = "split";
170
+ CorporateActionType["Dividend"] = "dividend";
171
+ CorporateActionType["Earning"] = "earning";
172
+ CorporateActionType["SymbolChange"] = "symbol_change";
173
+ CorporateActionType["Delisting"] = "delisting";
174
+ CorporateActionType["IPO"] = "ipo";
175
+ })(CorporateActionType || (CorporateActionType = {}));
176
+ /** 行业级别 (1~4 级) */
177
+ export var IndustryLevel;
178
+ (function (IndustryLevel) {
179
+ IndustryLevel["GSector"] = "GSECTOR";
180
+ IndustryLevel["GGroup"] = "GGROUP";
181
+ IndustryLevel["GInd"] = "GIND";
182
+ IndustryLevel["GSubInd"] = "GSUBIND";
183
+ })(IndustryLevel || (IndustryLevel = {}));
184
+ /** 排序方向 */
185
+ export var SortDirection;
186
+ (function (SortDirection) {
187
+ SortDirection["No"] = "SortDir_No";
188
+ SortDirection["Ascend"] = "SortDir_Ascend";
189
+ SortDirection["Descend"] = "SortDir_Descend";
190
+ })(SortDirection || (SortDirection = {}));
191
+ /** 期权分析周期 */
192
+ export var OptionAnalysisPeriod;
193
+ (function (OptionAnalysisPeriod) {
194
+ OptionAnalysisPeriod["ThreeYear"] = "3year";
195
+ OptionAnalysisPeriod["FiftyTwoWeek"] = "52week";
196
+ OptionAnalysisPeriod["TwentySixWeek"] = "26week";
197
+ OptionAnalysisPeriod["ThirteenWeek"] = "13week";
198
+ })(OptionAnalysisPeriod || (OptionAnalysisPeriod = {}));
199
+ /** 财报类型 */
200
+ export var FinancialReportPeriod;
201
+ (function (FinancialReportPeriod) {
202
+ FinancialReportPeriod["Annual"] = "Annual";
203
+ FinancialReportPeriod["Quarterly"] = "Quarterly";
204
+ FinancialReportPeriod["LTM"] = "LTM";
205
+ })(FinancialReportPeriod || (FinancialReportPeriod = {}));
@@ -1,4 +1,4 @@
1
- import { OrderType, TimeInForce } from './enums';
1
+ import { OrderType, TimeInForce, PriceType } from './enums.js';
2
2
  /** Market order */
3
3
  export function marketOrder(account, symbol, secType, action, quantity) {
4
4
  return {
@@ -87,7 +87,148 @@ export function algoOrder(account, symbol, secType, action, quantity, limitPrice
87
87
  outsideRth: false,
88
88
  };
89
89
  }
90
+ /**
91
+ * Iceberg order. `displaySize` is required; all other parameters are optional.
92
+ * Pass `priceType` as empty string to use the server default (LIMIT_PRICE).
93
+ * Pass `startTime` / `endTime` as 0 to omit the time window.
94
+ */
95
+ export function icebergOrder(account, symbol, secType, action, quantity, limitPrice, displaySize, minDisplaySize, checkIntervals, priceType, startTime, endTime) {
96
+ const req = {
97
+ account, symbol, secType, action,
98
+ orderType: OrderType.ICEBERG,
99
+ totalQuantity: quantity,
100
+ limitPrice,
101
+ timeInForce: TimeInForce.DAY,
102
+ outsideRth: false,
103
+ displaySize,
104
+ priceType: priceType || PriceType.LIMIT_PRICE,
105
+ };
106
+ if (minDisplaySize !== undefined && minDisplaySize > 0)
107
+ req.minDisplaySize = minDisplaySize;
108
+ if (checkIntervals !== undefined && checkIntervals > 0)
109
+ req.checkIntervals = checkIntervals;
110
+ if (startTime && startTime > 0)
111
+ req.startTime = startTime;
112
+ if (endTime && endTime > 0)
113
+ req.endTime = endTime;
114
+ return req;
115
+ }
90
116
  /** Attached profit / loss leg */
91
117
  export function orderLeg(legType, price, timeInForce) {
92
118
  return { legType, price, timeInForce };
93
119
  }
120
+ /**
121
+ * Market order by cash amount (instead of quantity).
122
+ * Server uses `isQuantityByAmount=true` + `amount` field.
123
+ */
124
+ export function marketOrderByAmount(account, symbol, secType, action, amount) {
125
+ return {
126
+ account, symbol, secType, action,
127
+ orderType: OrderType.MKT,
128
+ totalQuantity: 0,
129
+ cashAmount: amount,
130
+ timeInForce: TimeInForce.DAY,
131
+ outsideRth: false,
132
+ };
133
+ }
134
+ /**
135
+ * Limit order by cash amount (instead of quantity).
136
+ */
137
+ export function limitOrderByAmount(account, symbol, secType, action, amount, limitPrice) {
138
+ return {
139
+ account, symbol, secType, action,
140
+ orderType: OrderType.LMT,
141
+ totalQuantity: 0,
142
+ cashAmount: amount,
143
+ limitPrice,
144
+ timeInForce: TimeInForce.DAY,
145
+ outsideRth: false,
146
+ };
147
+ }
148
+ /**
149
+ * Trailing stop order using a fixed price offset (auxPrice) instead of a percentage.
150
+ * Use `trailOrder()` for percentage-based trailing stops.
151
+ */
152
+ export function trailOrderByPrice(account, symbol, secType, action, quantity, auxPrice) {
153
+ return {
154
+ account, symbol, secType, action,
155
+ orderType: OrderType.TRAIL,
156
+ totalQuantity: quantity,
157
+ auxPrice,
158
+ timeInForce: TimeInForce.DAY,
159
+ outsideRth: false,
160
+ };
161
+ }
162
+ /**
163
+ * Limit order with attached profit/loss legs (bracket order).
164
+ * At most 2 legs are supported.
165
+ *
166
+ * @param orderLegs - Array of `OrderLegRequest` (use `orderLeg()` helper)
167
+ */
168
+ export function limitOrderWithLegs(account, symbol, secType, action, quantity, limitPrice, orderLegs) {
169
+ if (orderLegs.length === 0) {
170
+ throw new Error('At least 1 order leg is required for a bracket order');
171
+ }
172
+ if (orderLegs.length > 2) {
173
+ throw new Error('At most 2 order legs are supported');
174
+ }
175
+ return {
176
+ account, symbol, secType, action,
177
+ orderType: OrderType.LMT,
178
+ totalQuantity: quantity,
179
+ limitPrice,
180
+ orderLegs,
181
+ timeInForce: TimeInForce.DAY,
182
+ outsideRth: false,
183
+ };
184
+ }
185
+ /**
186
+ * Multi-leg (combo/MLEG) order for options combos.
187
+ *
188
+ * @param contractLegs - Array of `ContractLegRequest` (use `contractLeg()` helper)
189
+ * @param comboType - e.g. `'MLEG'`
190
+ */
191
+ export function comboOrder(account, action, quantity, orderType, contractLegs, comboType = 'MLEG', limitPrice, auxPrice, trailingPercent) {
192
+ return {
193
+ account,
194
+ symbol: '', // not used for combo orders
195
+ secType: 'MLEG',
196
+ action,
197
+ orderType,
198
+ totalQuantity: quantity,
199
+ limitPrice,
200
+ auxPrice,
201
+ trailingPercent,
202
+ contractLegs,
203
+ comboType,
204
+ timeInForce: TimeInForce.DAY,
205
+ outsideRth: false,
206
+ };
207
+ }
208
+ /**
209
+ * OCA (One-Cancels-All) order.
210
+ * Server expects `orderType: 'OCA'` and an `ocaOrders` list.
211
+ *
212
+ * @param ocaOrders - The contained orders (use any order helper to build each)
213
+ */
214
+ export function ocaOrder(account, symbol, secType, action, quantity, ocaOrders) {
215
+ return {
216
+ account, symbol, secType, action,
217
+ orderType: OrderType.OCA,
218
+ totalQuantity: quantity,
219
+ ocaOrders,
220
+ timeInForce: TimeInForce.DAY,
221
+ outsideRth: false,
222
+ };
223
+ }
224
+ /**
225
+ * Build a single leg for a multi-leg (MLEG / combo) order.
226
+ *
227
+ * @param symbol - Underlying symbol
228
+ * @param secType - Security type (e.g. `'OPT'`)
229
+ * @param action - `'BUY'` or `'SELL'`
230
+ * @param ratio - Number of contracts for this leg
231
+ */
232
+ export function contractLeg(symbol, secType, action, ratio, expiry, strike, right) {
233
+ return { symbol, secType, action, ratio, expiry, strike, right };
234
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Order status normalization.
3
+ *
4
+ * 服务端返回的订单状态有时是整数(-2/-1/3/4/5/6/7/8),有时是字符串
5
+ * ("Invalid"/"Submitted"/...)。本模块把二者统一为 Java SDK OrderStatus 的
6
+ * 字符串值。不做跨别名合并。
7
+ *
8
+ * 对齐 Java SDK OrderStatus.java。
9
+ */
10
+ import { OrderStatus } from './enums.js';
11
+ /** 把数字状态码映射到字符串,未识别返回空串。 */
12
+ function statusIntToString(n) {
13
+ switch (n) {
14
+ case -2:
15
+ return OrderStatus.Invalid;
16
+ case -1:
17
+ return OrderStatus.Initial;
18
+ case 3:
19
+ return OrderStatus.PendingCancel;
20
+ case 4:
21
+ return OrderStatus.Cancelled;
22
+ case 5:
23
+ return OrderStatus.Submitted;
24
+ case 6:
25
+ return OrderStatus.Filled;
26
+ case 7:
27
+ return OrderStatus.Inactive;
28
+ case 8:
29
+ return OrderStatus.PendingSubmit;
30
+ }
31
+ return '';
32
+ }
33
+ /**
34
+ * 把服务端可能返回的 string/number 订单状态归一为字符串。
35
+ * 字符串原样透传;数字按映射表转换;其他输入返回空串。
36
+ */
37
+ export function normalizeOrderStatus(raw) {
38
+ if (typeof raw === 'string')
39
+ return raw;
40
+ if (typeof raw === 'number')
41
+ return statusIntToString(raw);
42
+ return '';
43
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Quote request interfaces (v0.4.0).
3
+ *
4
+ * 所有字段可选(用户调用时传一个空对象即可);字段名用 camelCase,
5
+ * client 层通过 keysToSnakeCase 转成服务端 wire 真名的 snake_case。
6
+ * **字段名设计规则:camelCase → snake_case 后必须等于服务端 wire 真名。**
7
+ *
8
+ * 参考 Go SDK model/quote_requests.go。
9
+ */
10
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Trade request interfaces (v0.4.0).
3
+ *
4
+ * 所有字段可选(用户调用时传一个空对象即可);字段名用 camelCase,
5
+ * client 层通过 keysToSnakeCase 转成服务端 wire 真名的 snake_case。
6
+ * **字段名设计规则:camelCase → snake_case 后必须等于服务端 wire 真名。**
7
+ * 比如 Trade 用 `startDate`/`endDate`(wire `start_date`/`end_date`),
8
+ * 不用 `startTime`/`endTime`(会被转成 `start_time`/`end_time`,与 wire 不符)。
9
+ *
10
+ * 参考 Go SDK model/trade_requests.go。
11
+ */
12
+ export {};
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Push module exports
3
3
  */
4
- export { SubjectType } from './push-message';
5
- export * from './callbacks';
6
- export * from './varint';
7
- export * from './proto-message';
8
- export { PushClient, ConnectionState } from './push-client';
4
+ export { SubjectType } from './push-message.js';
5
+ export * from './callbacks.js';
6
+ export * from './varint.js';
7
+ export * from './tick-util.js';
8
+ export * from './proto-message.js';
9
+ export { PushClient, ConnectionState } from './push-client.js';
@@ -51,6 +51,8 @@ function createBaseOrderStatusData() {
51
51
  gst: 0,
52
52
  attrList: [],
53
53
  timeInForce: "",
54
+ updateTime: 0,
55
+ latestTime: 0,
54
56
  };
55
57
  }
56
58
  export const OrderStatusData = {
@@ -184,6 +186,12 @@ export const OrderStatusData = {
184
186
  if (message.timeInForce !== "") {
185
187
  writer.uint32(346).string(message.timeInForce);
186
188
  }
189
+ if (message.updateTime !== 0) {
190
+ writer.uint32(352).uint64(message.updateTime);
191
+ }
192
+ if (message.latestTime !== 0) {
193
+ writer.uint32(360).uint64(message.latestTime);
194
+ }
187
195
  return writer;
188
196
  },
189
197
  decode(input, length) {
@@ -494,6 +502,20 @@ export const OrderStatusData = {
494
502
  message.timeInForce = reader.string();
495
503
  continue;
496
504
  }
505
+ case 44: {
506
+ if (tag !== 352) {
507
+ break;
508
+ }
509
+ message.updateTime = longToNumber(reader.uint64());
510
+ continue;
511
+ }
512
+ case 45: {
513
+ if (tag !== 360) {
514
+ break;
515
+ }
516
+ message.latestTime = longToNumber(reader.uint64());
517
+ continue;
518
+ }
497
519
  }
498
520
  if ((tag & 7) === 4 || tag === 0) {
499
521
  break;
@@ -550,6 +572,8 @@ export const OrderStatusData = {
550
572
  message.gst = object.gst ?? 0;
551
573
  message.attrList = object.attrList?.map((e) => e) || [];
552
574
  message.timeInForce = object.timeInForce ?? "";
575
+ message.updateTime = object.updateTime ?? 0;
576
+ message.latestTime = object.latestTime ?? 0;
553
577
  return message;
554
578
  },
555
579
  };
@@ -5,17 +5,17 @@
5
5
  // source: PushData.proto
6
6
  /* eslint-disable */
7
7
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
- import { AssetData } from "./AssetData";
9
- import { KlineData } from "./KlineData";
10
- import { OptionTopData } from "./OptionTopData";
11
- import { OrderStatusData } from "./OrderStatusData";
12
- import { OrderTransactionData } from "./OrderTransactionData";
13
- import { PositionData } from "./PositionData";
14
- import { QuoteData } from "./QuoteData";
15
- import { QuoteDepthData } from "./QuoteDepthData";
16
- import { StockTopData } from "./StockTopData";
17
- import { TickData } from "./TickData";
18
- import { TradeTickData } from "./TradeTickData";
8
+ import { AssetData } from "./AssetData.js";
9
+ import { KlineData } from "./KlineData.js";
10
+ import { OptionTopData } from "./OptionTopData.js";
11
+ import { OrderStatusData } from "./OrderStatusData.js";
12
+ import { OrderTransactionData } from "./OrderTransactionData.js";
13
+ import { PositionData } from "./PositionData.js";
14
+ import { QuoteData } from "./QuoteData.js";
15
+ import { QuoteDepthData } from "./QuoteDepthData.js";
16
+ import { StockTopData } from "./StockTopData.js";
17
+ import { TickData } from "./TickData.js";
18
+ import { TradeTickData } from "./TradeTickData.js";
19
19
  export const protobufPackage = "com.tigerbrokers.stock.openapi.client.socket.data.pb";
20
20
  function createBasePushData() {
21
21
  return {
@@ -5,7 +5,7 @@
5
5
  // source: QuoteBasicData.proto
6
6
  /* eslint-disable */
7
7
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
- import { QuoteData_Minute } from "./QuoteData";
8
+ import { QuoteData_Minute } from "./QuoteData.js";
9
9
  export const protobufPackage = "com.tigerbrokers.stock.openapi.client.socket.data.pb";
10
10
  function createBaseQuoteBasicData() {
11
11
  return {
@@ -5,7 +5,7 @@
5
5
  // source: Response.proto
6
6
  /* eslint-disable */
7
7
  import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
- import { PushData } from "./PushData";
8
+ import { PushData } from "./PushData.js";
9
9
  export const protobufPackage = "com.tigerbrokers.stock.openapi.client.socket.data.pb";
10
10
  function createBaseResponse() {
11
11
  return { command: 0, id: undefined, code: undefined, msg: undefined, body: undefined };
@@ -4,22 +4,22 @@
4
4
  * 由 ts-proto 从 proto 文件生成的所有类型、枚举和编解码函数
5
5
  */
6
6
  // 基础层:命令和数据类型枚举
7
- export { SocketCommon_Command, SocketCommon_DataType, SocketCommon_QuoteType, } from './SocketCommon';
7
+ export { SocketCommon_Command, SocketCommon_DataType, SocketCommon_QuoteType, } from './SocketCommon.js';
8
8
  // 协议层:请求和响应消息
9
- export { Request, Request_Connect, Request_Subscribe } from './Request';
10
- export { Response } from './Response';
11
- export { PushData } from './PushData';
9
+ export { Request, Request_Connect, Request_Subscribe } from './Request.js';
10
+ export { Response } from './Response.js';
11
+ export { PushData } from './PushData.js';
12
12
  // 数据层:业务数据消息
13
- export { QuoteData } from './QuoteData';
14
- export { QuoteBasicData } from './QuoteBasicData';
15
- export { QuoteBBOData } from './QuoteBBOData';
16
- export { QuoteDepthData } from './QuoteDepthData';
17
- export { TradeTickData } from './TradeTickData';
18
- export { TickData } from './TickData';
19
- export { AssetData } from './AssetData';
20
- export { PositionData } from './PositionData';
21
- export { OrderStatusData } from './OrderStatusData';
22
- export { OrderTransactionData } from './OrderTransactionData';
23
- export { StockTopData } from './StockTopData';
24
- export { OptionTopData } from './OptionTopData';
25
- export { KlineData } from './KlineData';
13
+ export { QuoteData } from './QuoteData.js';
14
+ export { QuoteBasicData } from './QuoteBasicData.js';
15
+ export { QuoteBBOData } from './QuoteBBOData.js';
16
+ export { QuoteDepthData } from './QuoteDepthData.js';
17
+ export { TradeTickData } from './TradeTickData.js';
18
+ export { TickData } from './TickData.js';
19
+ export { AssetData } from './AssetData.js';
20
+ export { PositionData } from './PositionData.js';
21
+ export { OrderStatusData } from './OrderStatusData.js';
22
+ export { OrderTransactionData } from './OrderTransactionData.js';
23
+ export { StockTopData } from './StockTopData.js';
24
+ export { OptionTopData } from './OptionTopData.js';
25
+ export { KlineData } from './KlineData.js';
@@ -4,9 +4,9 @@
4
4
  * 对齐 Java SDK 的 ProtoMessageUtil,提供构建各种 Request 消息的工具函数。
5
5
  * 所有构建函数共享一个递增的 requestId 计数器。
6
6
  */
7
- import { Request, Request_Connect, Request_Subscribe, } from './pb/Request';
8
- import { SocketCommon_Command, SocketCommon_DataType, } from './pb/SocketCommon';
9
- import { SubjectType } from './push-message';
7
+ import { Request, Request_Connect, Request_Subscribe, } from './pb/Request.js';
8
+ import { SocketCommon_Command, SocketCommon_DataType, } from './pb/SocketCommon.js';
9
+ import { SubjectType } from './push-message.js';
10
10
  /** 递增请求 ID 计数器(单线程环境,简单递增变量) */
11
11
  let requestId = 0;
12
12
  /**
@@ -115,6 +115,12 @@ export function subjectToDataType(subject) {
115
115
  return SocketCommon_DataType.TradeTick;
116
116
  case SubjectType.QuoteBBO:
117
117
  return SocketCommon_DataType.Quote;
118
+ case SubjectType.Cc:
119
+ // 加密货币推送
120
+ return SocketCommon_DataType.Cc;
121
+ case SubjectType.Market:
122
+ // 市场状态推送协议上 dataType=Quote,只设置 market 字段
123
+ return SocketCommon_DataType.Quote;
118
124
  default:
119
125
  return SocketCommon_DataType.Unknown;
120
126
  }