tigeropen 0.4.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.
- package/README.md +55 -2
- package/dist/cjs/client/api-response.js +28 -7
- package/dist/cjs/client/case-convert.js +4 -3
- package/dist/cjs/client/http-client.js +124 -8
- package/dist/cjs/client/token-methods.js +42 -0
- package/dist/cjs/config/client-config.js +115 -16
- package/dist/cjs/config/config-parser.js +19 -9
- package/dist/cjs/config/index.js +4 -1
- package/dist/cjs/config/token-manager.js +54 -4
- package/dist/cjs/index.js +53 -2
- package/dist/cjs/model/enums.js +18 -1
- package/dist/cjs/model/order-helpers.js +149 -0
- package/dist/cjs/push/index.js +1 -0
- package/dist/cjs/push/push-client.js +47 -19
- package/dist/cjs/push/tick-util.js +172 -0
- package/dist/cjs/quote/quote-client.js +300 -70
- package/dist/cjs/trade/trade-client.js +174 -13
- package/dist/cjs/version.js +4 -0
- package/dist/esm/client/api-request.js +1 -1
- package/dist/esm/client/api-response.js +29 -8
- package/dist/esm/client/case-convert.js +4 -3
- package/dist/esm/client/http-client.js +128 -12
- package/dist/esm/client/index.js +6 -6
- package/dist/esm/client/token-methods.js +37 -0
- package/dist/esm/config/client-config.js +118 -20
- package/dist/esm/config/config-parser.js +19 -9
- package/dist/esm/config/index.js +4 -3
- package/dist/esm/config/token-manager.js +55 -5
- package/dist/esm/index.js +15 -1
- package/dist/esm/logger/index.js +1 -1
- package/dist/esm/model/contract-helpers.js +1 -1
- package/dist/esm/model/enums.js +17 -0
- package/dist/esm/model/order-helpers.js +142 -1
- package/dist/esm/model/order-status.js +1 -1
- package/dist/esm/push/index.js +6 -5
- package/dist/esm/push/pb/PushData.js +11 -11
- package/dist/esm/push/pb/QuoteBasicData.js +1 -1
- package/dist/esm/push/pb/Response.js +1 -1
- package/dist/esm/push/pb/index.js +17 -17
- package/dist/esm/push/proto-message.js +3 -3
- package/dist/esm/push/push-client.js +54 -26
- package/dist/esm/push/tick-util.js +165 -0
- package/dist/esm/quote/index.js +1 -1
- package/dist/esm/quote/quote-client.js +269 -72
- package/dist/esm/signer/index.js +2 -2
- package/dist/esm/trade/index.js +1 -1
- package/dist/esm/trade/trade-client.js +144 -16
- package/dist/esm/version.js +1 -0
- package/dist/types/client/api-response.d.ts +6 -4
- package/dist/types/client/case-convert.d.ts +3 -1
- package/dist/types/client/http-client.d.ts +32 -1
- package/dist/types/client/token-methods.d.ts +34 -0
- package/dist/types/config/client-config.d.ts +22 -1
- package/dist/types/config/index.d.ts +3 -1
- package/dist/types/config/token-manager.d.ts +27 -3
- package/dist/types/index.d.ts +22 -1
- package/dist/types/model/enums.d.ts +18 -2
- package/dist/types/model/order-helpers.d.ts +52 -1
- package/dist/types/model/order.d.ts +127 -10
- package/dist/types/model/quote-requests.d.ts +27 -15
- package/dist/types/model/quote.d.ts +150 -24
- package/dist/types/model/trade-requests.d.ts +118 -4
- package/dist/types/model/trade.d.ts +121 -17
- package/dist/types/push/callbacks.d.ts +3 -7
- package/dist/types/push/index.d.ts +1 -0
- package/dist/types/push/push-client.d.ts +5 -3
- package/dist/types/push/tick-util.d.ts +30 -0
- package/dist/types/quote/quote-client.d.ts +101 -36
- package/dist/types/trade/trade-client.d.ts +57 -11
- package/dist/types/version.d.ts +1 -0
- package/package.json +5 -2
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export interface OrdersRequest {
|
|
13
13
|
account?: string;
|
|
14
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
15
|
+
secretKey?: string;
|
|
14
16
|
secType?: string;
|
|
15
17
|
market?: string;
|
|
16
18
|
symbol?: string;
|
|
@@ -32,6 +34,8 @@ export interface OrdersRequest {
|
|
|
32
34
|
}
|
|
33
35
|
export interface GetOrderRequest {
|
|
34
36
|
account?: string;
|
|
37
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
38
|
+
secretKey?: string;
|
|
35
39
|
id?: number;
|
|
36
40
|
orderId?: number;
|
|
37
41
|
isBrief?: boolean;
|
|
@@ -40,6 +44,8 @@ export interface GetOrderRequest {
|
|
|
40
44
|
}
|
|
41
45
|
export interface OrderTransactionsRequest {
|
|
42
46
|
account?: string;
|
|
47
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
48
|
+
secretKey?: string;
|
|
43
49
|
orderId?: number;
|
|
44
50
|
symbol?: string;
|
|
45
51
|
secType?: string;
|
|
@@ -56,6 +62,8 @@ export interface OrderTransactionsRequest {
|
|
|
56
62
|
}
|
|
57
63
|
export interface PositionsRequest {
|
|
58
64
|
account?: string;
|
|
65
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
66
|
+
secretKey?: string;
|
|
59
67
|
secType?: string;
|
|
60
68
|
currency?: string;
|
|
61
69
|
market?: string;
|
|
@@ -69,6 +77,8 @@ export interface PositionsRequest {
|
|
|
69
77
|
}
|
|
70
78
|
export interface AssetsRequest {
|
|
71
79
|
account?: string;
|
|
80
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
81
|
+
secretKey?: string;
|
|
72
82
|
subAccounts?: string[];
|
|
73
83
|
segment?: boolean;
|
|
74
84
|
marketValue?: boolean;
|
|
@@ -76,10 +86,14 @@ export interface AssetsRequest {
|
|
|
76
86
|
}
|
|
77
87
|
export interface ManagedAccountsRequest {
|
|
78
88
|
account?: string;
|
|
89
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
90
|
+
secretKey?: string;
|
|
79
91
|
lang?: string;
|
|
80
92
|
}
|
|
81
93
|
export interface DerivativeContractsRequest {
|
|
82
94
|
account?: string;
|
|
95
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
96
|
+
secretKey?: string;
|
|
83
97
|
symbols: string[];
|
|
84
98
|
secType: string;
|
|
85
99
|
expiry?: string;
|
|
@@ -87,6 +101,8 @@ export interface DerivativeContractsRequest {
|
|
|
87
101
|
}
|
|
88
102
|
export interface AnalyticsAssetRequest {
|
|
89
103
|
account?: string;
|
|
104
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
105
|
+
secretKey?: string;
|
|
90
106
|
segType?: string;
|
|
91
107
|
/** 格式 "YYYY-MM-DD" */
|
|
92
108
|
startDate?: string;
|
|
@@ -95,12 +111,16 @@ export interface AnalyticsAssetRequest {
|
|
|
95
111
|
}
|
|
96
112
|
export interface AggregateAssetsRequest {
|
|
97
113
|
account?: string;
|
|
114
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
115
|
+
secretKey?: string;
|
|
98
116
|
baseCurrency?: string;
|
|
99
117
|
segType?: string;
|
|
100
118
|
lang?: string;
|
|
101
119
|
}
|
|
102
120
|
export interface EstimateTradableQuantityRequest {
|
|
103
121
|
account?: string;
|
|
122
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
123
|
+
secretKey?: string;
|
|
104
124
|
symbol: string;
|
|
105
125
|
secType: string;
|
|
106
126
|
action: string;
|
|
@@ -115,6 +135,8 @@ export interface EstimateTradableQuantityRequest {
|
|
|
115
135
|
}
|
|
116
136
|
export interface ForexOrderRequest {
|
|
117
137
|
account?: string;
|
|
138
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
139
|
+
secretKey?: string;
|
|
118
140
|
segType?: string;
|
|
119
141
|
sourceCurrency: string;
|
|
120
142
|
targetCurrency: string;
|
|
@@ -125,6 +147,8 @@ export interface ForexOrderRequest {
|
|
|
125
147
|
}
|
|
126
148
|
export interface SegmentFundRequest {
|
|
127
149
|
account?: string;
|
|
150
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
151
|
+
secretKey?: string;
|
|
128
152
|
id?: string;
|
|
129
153
|
fromSegment?: string;
|
|
130
154
|
toSegment?: string;
|
|
@@ -133,21 +157,33 @@ export interface SegmentFundRequest {
|
|
|
133
157
|
limit?: number;
|
|
134
158
|
lang?: string;
|
|
135
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* Fund details request. wire: fund_details
|
|
162
|
+
*
|
|
163
|
+
* **Wire types (breaking):** `startDate` / `endDate` are yyyy-MM-dd date
|
|
164
|
+
* strings, not epoch-ms integers. Java's `FundDetailsModel` exposes them
|
|
165
|
+
* as `String startDate` / `String endDate`; sending epoch-ms causes
|
|
166
|
+
* `parse 'start_date' error, supported format: 'yyyy-MM-dd'`.
|
|
167
|
+
*/
|
|
136
168
|
export interface FundDetailsRequest {
|
|
137
169
|
account?: string;
|
|
170
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
171
|
+
secretKey?: string;
|
|
138
172
|
segTypes?: string[];
|
|
139
173
|
fundType?: string;
|
|
140
174
|
currency?: string;
|
|
141
|
-
/**
|
|
142
|
-
startDate?:
|
|
143
|
-
/**
|
|
144
|
-
endDate?:
|
|
175
|
+
/** yyyy-MM-dd 日期字符串 */
|
|
176
|
+
startDate?: string;
|
|
177
|
+
/** yyyy-MM-dd 日期字符串 */
|
|
178
|
+
endDate?: string;
|
|
145
179
|
limit?: number;
|
|
146
180
|
pageToken?: string;
|
|
147
181
|
lang?: string;
|
|
148
182
|
}
|
|
149
183
|
export interface FundingHistoryRequest {
|
|
150
184
|
account?: string;
|
|
185
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
186
|
+
secretKey?: string;
|
|
151
187
|
segType?: string;
|
|
152
188
|
currency?: string;
|
|
153
189
|
/** 毫秒时间戳 */
|
|
@@ -159,6 +195,8 @@ export interface FundingHistoryRequest {
|
|
|
159
195
|
}
|
|
160
196
|
export interface PositionTransferRequest {
|
|
161
197
|
fromAccount?: string;
|
|
198
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
199
|
+
secretKey?: string;
|
|
162
200
|
toAccount: string;
|
|
163
201
|
market?: string;
|
|
164
202
|
transfers: Array<{
|
|
@@ -174,6 +212,8 @@ export interface PositionTransferRequest {
|
|
|
174
212
|
export interface PositionTransferRecordsRequest {
|
|
175
213
|
/** wire: account_id */
|
|
176
214
|
accountId?: string;
|
|
215
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
216
|
+
secretKey?: string;
|
|
177
217
|
sinceDate?: string;
|
|
178
218
|
toDate?: string;
|
|
179
219
|
market?: string;
|
|
@@ -182,14 +222,88 @@ export interface PositionTransferRecordsRequest {
|
|
|
182
222
|
}
|
|
183
223
|
export interface PositionTransferDetailRequest {
|
|
184
224
|
accountId?: string;
|
|
225
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
226
|
+
secretKey?: string;
|
|
185
227
|
id: string;
|
|
186
228
|
lang?: string;
|
|
187
229
|
}
|
|
188
230
|
export interface PositionTransferExternalRecordsRequest {
|
|
189
231
|
accountId?: string;
|
|
232
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
233
|
+
secretKey?: string;
|
|
190
234
|
sinceDate?: string;
|
|
191
235
|
toDate?: string;
|
|
192
236
|
market?: string;
|
|
193
237
|
limit?: number;
|
|
194
238
|
lang?: string;
|
|
195
239
|
}
|
|
240
|
+
/** 行权检验请求 (wire: option_exercise_check) */
|
|
241
|
+
export interface OptionExerciseCheckRequest {
|
|
242
|
+
account?: string;
|
|
243
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
244
|
+
secretKey?: string;
|
|
245
|
+
/** 期权合约 ID */
|
|
246
|
+
contractId: number;
|
|
247
|
+
/** Exercise | Expire */
|
|
248
|
+
type: string;
|
|
249
|
+
quantity?: number;
|
|
250
|
+
/** yyyy-MM-dd,Exercise 类型建议填 */
|
|
251
|
+
executingDate?: string;
|
|
252
|
+
/** Exercise 类型建议填 */
|
|
253
|
+
isForce?: boolean;
|
|
254
|
+
/** 0–10,Expire 类型专用 */
|
|
255
|
+
itmRate?: number;
|
|
256
|
+
lang?: string;
|
|
257
|
+
}
|
|
258
|
+
/** 查询可行权持仓请求 (wire: option_exercise_position) */
|
|
259
|
+
export interface OptionExercisePositionRequest {
|
|
260
|
+
account?: string;
|
|
261
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
262
|
+
secretKey?: string;
|
|
263
|
+
/** Exercise | Expire */
|
|
264
|
+
type: string;
|
|
265
|
+
lang?: string;
|
|
266
|
+
}
|
|
267
|
+
/** 提交行权申请请求 (wire: option_exercise_submit) */
|
|
268
|
+
export interface OptionExerciseSubmitRequest {
|
|
269
|
+
account?: string;
|
|
270
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
271
|
+
secretKey?: string;
|
|
272
|
+
contractId: number;
|
|
273
|
+
/** Exercise | Expire */
|
|
274
|
+
type: string;
|
|
275
|
+
quantity: number;
|
|
276
|
+
/** Exercise 必填,yyyy-MM-dd */
|
|
277
|
+
executingDate?: string;
|
|
278
|
+
/** Exercise 必填 */
|
|
279
|
+
isForce?: boolean;
|
|
280
|
+
/** 0–10,Expire 专用 */
|
|
281
|
+
itmRate?: number;
|
|
282
|
+
lang?: string;
|
|
283
|
+
}
|
|
284
|
+
/** 分页查询行权记录请求 (wire: option_exercise_record) */
|
|
285
|
+
export interface OptionExerciseRecordsRequest {
|
|
286
|
+
account?: string;
|
|
287
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
288
|
+
secretKey?: string;
|
|
289
|
+
/** 从 1 开始,默认 1 */
|
|
290
|
+
page?: number;
|
|
291
|
+
/** 1–100,默认 20 */
|
|
292
|
+
size?: number;
|
|
293
|
+
/** New | Cancel | Success | Fail */
|
|
294
|
+
status?: string;
|
|
295
|
+
/** Exercise | Expire */
|
|
296
|
+
type?: string;
|
|
297
|
+
symbol?: string;
|
|
298
|
+
/** symbol | expire_date | strike | is_call */
|
|
299
|
+
orderBy?: string;
|
|
300
|
+
lang?: string;
|
|
301
|
+
}
|
|
302
|
+
/** 撤销行权申请请求 (wire: option_exercise_cancel) */
|
|
303
|
+
export interface OptionExerciseCancelRequest {
|
|
304
|
+
account?: string;
|
|
305
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
306
|
+
secretKey?: string;
|
|
307
|
+
id: number;
|
|
308
|
+
lang?: string;
|
|
309
|
+
}
|
|
@@ -84,18 +84,22 @@ export interface PreviewResult {
|
|
|
84
84
|
message?: string;
|
|
85
85
|
}
|
|
86
86
|
export interface PlaceOrderResult {
|
|
87
|
-
|
|
87
|
+
/** int64 order ID — may be a string when it exceeds Number.MAX_SAFE_INTEGER */
|
|
88
|
+
id: number | string;
|
|
88
89
|
/** Account-level order ID; the server returns snake_case `order_id` */
|
|
89
|
-
order_id?: number;
|
|
90
|
-
subIds?: number[];
|
|
90
|
+
order_id?: number | string;
|
|
91
|
+
subIds?: (number | string)[];
|
|
91
92
|
orders?: Order[];
|
|
92
93
|
}
|
|
93
94
|
export interface OrderIdResult {
|
|
94
|
-
|
|
95
|
+
/** int64 order ID — may be a string when it exceeds Number.MAX_SAFE_INTEGER */
|
|
96
|
+
id: number | string;
|
|
95
97
|
}
|
|
96
98
|
export interface Transaction {
|
|
97
99
|
id?: number;
|
|
98
100
|
orderId?: number;
|
|
101
|
+
/** Numeric account ID (wire: accountId). */
|
|
102
|
+
accountId?: number;
|
|
99
103
|
account?: string;
|
|
100
104
|
symbol?: string;
|
|
101
105
|
secType?: string;
|
|
@@ -103,12 +107,24 @@ export interface Transaction {
|
|
|
103
107
|
currency?: string;
|
|
104
108
|
identifier?: string;
|
|
105
109
|
action?: string;
|
|
110
|
+
/** Order/commission price. */
|
|
106
111
|
price?: number;
|
|
112
|
+
/** Fill price (wire: filledPrice). */
|
|
113
|
+
filledPrice?: number;
|
|
107
114
|
quantity?: number;
|
|
108
115
|
filledQuantity?: number;
|
|
116
|
+
/** Scale for filledQuantity (wire: filledQuantityScale). */
|
|
117
|
+
filledQuantityScale?: number;
|
|
118
|
+
/** Order amount. */
|
|
109
119
|
amount?: number;
|
|
120
|
+
/** Fill amount (wire: filledAmount). */
|
|
121
|
+
filledAmount?: number;
|
|
110
122
|
commission?: number;
|
|
111
|
-
|
|
123
|
+
/** Fill timestamp string, format "YYYY-MM-DD HH:MM:SS" (server returns string, not number). */
|
|
124
|
+
transactedAt?: string;
|
|
125
|
+
/** Fill time as Unix millisecond timestamp (wire: transactionTime). */
|
|
126
|
+
transactionTime?: number;
|
|
127
|
+
/** Legacy time field. */
|
|
112
128
|
time?: number;
|
|
113
129
|
}
|
|
114
130
|
export interface ManagedAccount {
|
|
@@ -144,8 +160,18 @@ export interface EstimateTradableQuantity {
|
|
|
144
160
|
cashBuyingPower?: number;
|
|
145
161
|
currency?: string;
|
|
146
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Forex order response.
|
|
165
|
+
*
|
|
166
|
+
* Server returns `id` as a JSON number (matches `PlaceOrderResult.id`).
|
|
167
|
+
* The Rust / Go SDKs confirmed this on live integ — earlier the type here
|
|
168
|
+
* was `string`, which the loose JS typing silently accepted while Rust /
|
|
169
|
+
* Go crashed on the mismatch. Kept as `number | string` for backward
|
|
170
|
+
* compatibility with any caller relying on the old typing.
|
|
171
|
+
*/
|
|
147
172
|
export interface ForexOrderResult {
|
|
148
|
-
|
|
173
|
+
/** int64 forex order ID; may be a string when exceeding Number.MAX_SAFE_INTEGER */
|
|
174
|
+
id?: number | string;
|
|
149
175
|
status?: string;
|
|
150
176
|
sourceCurrency?: string;
|
|
151
177
|
targetCurrency?: string;
|
|
@@ -154,15 +180,25 @@ export interface ForexOrderResult {
|
|
|
154
180
|
rate?: number;
|
|
155
181
|
submitTime?: number;
|
|
156
182
|
}
|
|
183
|
+
/** Segment fund available item (segment_fund_available response). */
|
|
184
|
+
export interface SegmentFundAvailableItem {
|
|
185
|
+
fromSegment?: string;
|
|
186
|
+
currency?: string;
|
|
187
|
+
amount?: number;
|
|
188
|
+
}
|
|
189
|
+
/** Segment fund transfer/cancel response. */
|
|
157
190
|
export interface SegmentFund {
|
|
158
|
-
id?: string;
|
|
159
|
-
status?: string;
|
|
191
|
+
id?: string | number;
|
|
160
192
|
fromSegment?: string;
|
|
161
193
|
toSegment?: string;
|
|
162
194
|
currency?: string;
|
|
163
195
|
amount?: number;
|
|
164
|
-
|
|
165
|
-
|
|
196
|
+
status?: string;
|
|
197
|
+
statusDesc?: string;
|
|
198
|
+
message?: string;
|
|
199
|
+
settledAt?: number;
|
|
200
|
+
createdAt?: number;
|
|
201
|
+
updatedAt?: number;
|
|
166
202
|
}
|
|
167
203
|
export interface SegmentFundHistoryItem {
|
|
168
204
|
id?: number;
|
|
@@ -171,11 +207,14 @@ export interface SegmentFundHistoryItem {
|
|
|
171
207
|
currency?: string;
|
|
172
208
|
amount?: number;
|
|
173
209
|
status?: string;
|
|
174
|
-
|
|
175
|
-
|
|
210
|
+
statusDesc?: string;
|
|
211
|
+
settledAt?: number;
|
|
212
|
+
createdAt?: number;
|
|
213
|
+
updatedAt?: number;
|
|
176
214
|
}
|
|
177
215
|
export interface FundDetails {
|
|
178
|
-
|
|
216
|
+
/** int64 fund-detail ID — server may return as string (e.g. "4733519770"). */
|
|
217
|
+
id?: string | number;
|
|
179
218
|
account?: string;
|
|
180
219
|
segType?: string;
|
|
181
220
|
fundType?: string;
|
|
@@ -187,13 +226,18 @@ export interface FundDetails {
|
|
|
187
226
|
externalId?: string;
|
|
188
227
|
}
|
|
189
228
|
export interface FundingHistoryItem {
|
|
190
|
-
id?:
|
|
191
|
-
|
|
229
|
+
id?: number;
|
|
230
|
+
refId?: string;
|
|
231
|
+
type?: number;
|
|
232
|
+
typeDesc?: string;
|
|
192
233
|
currency?: string;
|
|
193
234
|
amount?: number;
|
|
235
|
+
businessDate?: string;
|
|
194
236
|
status?: string;
|
|
195
|
-
|
|
196
|
-
|
|
237
|
+
statusDesc?: string;
|
|
238
|
+
completedStatus?: boolean;
|
|
239
|
+
createdAt?: number;
|
|
240
|
+
updatedAt?: number;
|
|
197
241
|
}
|
|
198
242
|
export interface TransferItem {
|
|
199
243
|
symbol?: string;
|
|
@@ -233,3 +277,63 @@ export interface PositionTransferExternalRecord {
|
|
|
233
277
|
submitTime?: number;
|
|
234
278
|
updateTime?: number;
|
|
235
279
|
}
|
|
280
|
+
/** 行权检验结果 */
|
|
281
|
+
export interface OptionExerciseCheckResult {
|
|
282
|
+
availableQuantity: number;
|
|
283
|
+
position: number;
|
|
284
|
+
stkPosition: number;
|
|
285
|
+
stkPositionChange: number;
|
|
286
|
+
stkPositionBefore: number;
|
|
287
|
+
stkPositionAfter: number;
|
|
288
|
+
symbol?: string;
|
|
289
|
+
}
|
|
290
|
+
/** 可行权期权持仓条目 */
|
|
291
|
+
export interface OptionExercisePosition {
|
|
292
|
+
contractId?: number;
|
|
293
|
+
symbol?: string;
|
|
294
|
+
stkSymbol?: string;
|
|
295
|
+
expireDate?: string;
|
|
296
|
+
strike?: string;
|
|
297
|
+
callPut?: string;
|
|
298
|
+
market?: string;
|
|
299
|
+
accountId?: number;
|
|
300
|
+
position: number;
|
|
301
|
+
availableQuantity: number;
|
|
302
|
+
}
|
|
303
|
+
/** 可行权持仓分页结果 */
|
|
304
|
+
export interface OptionExercisePositionPageResult {
|
|
305
|
+
pageNum: number;
|
|
306
|
+
pageSize: number;
|
|
307
|
+
itemCount: number;
|
|
308
|
+
pageCount: number;
|
|
309
|
+
items?: OptionExercisePosition[];
|
|
310
|
+
}
|
|
311
|
+
/** 行权申请记录条目 */
|
|
312
|
+
export interface OptionExerciseRecord {
|
|
313
|
+
id?: number;
|
|
314
|
+
contractId?: number;
|
|
315
|
+
symbol?: string;
|
|
316
|
+
stkSymbol?: string;
|
|
317
|
+
expireDate?: string;
|
|
318
|
+
strike?: string;
|
|
319
|
+
callPut?: string;
|
|
320
|
+
/** Exercise | Expire */
|
|
321
|
+
type?: string;
|
|
322
|
+
requestQuantity: number;
|
|
323
|
+
quantity: number;
|
|
324
|
+
/** New | Cancel | Success | Fail */
|
|
325
|
+
status?: string;
|
|
326
|
+
executingDate?: string;
|
|
327
|
+
itmRate: number;
|
|
328
|
+
isForce: boolean;
|
|
329
|
+
reason?: string;
|
|
330
|
+
accountId?: number;
|
|
331
|
+
}
|
|
332
|
+
/** 行权记录分页结果 */
|
|
333
|
+
export interface OptionExerciseRecordPageResult {
|
|
334
|
+
pageNum: number;
|
|
335
|
+
pageSize: number;
|
|
336
|
+
itemCount: number;
|
|
337
|
+
pageCount: number;
|
|
338
|
+
items?: OptionExerciseRecord[];
|
|
339
|
+
}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 推送回调函数类型定义(Protobuf 协议)
|
|
3
|
-
*
|
|
4
|
-
* 每种推送类型独立回调,参数类型为 Protobuf 生成的类型。
|
|
5
|
-
* 连接状态回调独立管理。
|
|
6
|
-
*/
|
|
7
1
|
import type { QuoteData } from './pb/QuoteData';
|
|
8
2
|
import type { QuoteDepthData } from './pb/QuoteDepthData';
|
|
9
3
|
import type { TradeTickData } from './pb/TradeTickData';
|
|
@@ -15,10 +9,11 @@ import type { OrderTransactionData } from './pb/OrderTransactionData';
|
|
|
15
9
|
import type { StockTopData } from './pb/StockTopData';
|
|
16
10
|
import type { OptionTopData } from './pb/OptionTopData';
|
|
17
11
|
import type { KlineData } from './pb/KlineData';
|
|
12
|
+
import type { PushTradeTick } from './tick-util';
|
|
18
13
|
/** 所有回调函数的集合 */
|
|
19
14
|
export interface Callbacks {
|
|
20
15
|
onQuote?: (data: QuoteData) => void;
|
|
21
|
-
onTick?: (data:
|
|
16
|
+
onTick?: (data: PushTradeTick) => void;
|
|
22
17
|
onDepth?: (data: QuoteDepthData) => void;
|
|
23
18
|
onOption?: (data: QuoteData) => void;
|
|
24
19
|
onFuture?: (data: QuoteData) => void;
|
|
@@ -36,3 +31,4 @@ export interface Callbacks {
|
|
|
36
31
|
onError?: (err: Error) => void;
|
|
37
32
|
onKickout?: (message: string) => void;
|
|
38
33
|
}
|
|
34
|
+
export type { TradeTickData };
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
export { SubjectType } from './push-message';
|
|
5
5
|
export * from './callbacks';
|
|
6
6
|
export * from './varint';
|
|
7
|
+
export * from './tick-util';
|
|
7
8
|
export * from './proto-message';
|
|
8
9
|
export { PushClient, ConnectionState } from './push-client';
|
|
9
10
|
export type { PushClientOptions, TLSSocketLike, TLSSocketFactory } from './push-client';
|
|
@@ -44,10 +44,12 @@ export declare class PushClient {
|
|
|
44
44
|
private useFullTick;
|
|
45
45
|
private socket;
|
|
46
46
|
private _state;
|
|
47
|
+
/** Whether this connect attempt already fell back to unverified TLS */
|
|
48
|
+
private tlsFallback;
|
|
47
49
|
private callbacks;
|
|
48
50
|
/** Subscription state: subject -> Set<symbol> */
|
|
49
51
|
private subscriptions;
|
|
50
|
-
/** Account-level subscriptions */
|
|
52
|
+
/** Account-level subscriptions: subject -> account string used at subscribe time */
|
|
51
53
|
private accountSubs;
|
|
52
54
|
private heartbeatTimer;
|
|
53
55
|
private reconnectTimer;
|
|
@@ -166,6 +168,6 @@ export declare class PushClient {
|
|
|
166
168
|
unsubscribeTransaction(): void;
|
|
167
169
|
/** Get current market data subscriptions */
|
|
168
170
|
getSubscriptions(): Map<SubjectType, string[]>;
|
|
169
|
-
/** Get account-level subscriptions */
|
|
170
|
-
getAccountSubscriptions(): SubjectType
|
|
171
|
+
/** Get account-level subscriptions: subject -> account */
|
|
172
|
+
getAccountSubscriptions(): Map<SubjectType, string>;
|
|
171
173
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TradeTickData } from './pb/TradeTickData';
|
|
2
|
+
/** Returns the full exchange name for a partCode letter, or the raw code if unknown. */
|
|
3
|
+
export declare function getPartNameByCode(code: string): string;
|
|
4
|
+
/** Returns the short exchange name for a partCode letter, or the raw code if unknown. */
|
|
5
|
+
export declare function getPartShortNameByCode(code: string): string;
|
|
6
|
+
/** Resolves a raw cond character to a readable string. */
|
|
7
|
+
export declare function getTradeCondByCode(isUs: boolean, ch: string): string;
|
|
8
|
+
/** Reports whether symbol is a US stock (uppercase letters, optional dot suffix). */
|
|
9
|
+
export declare function isUsStockSymbol(symbol: string): boolean;
|
|
10
|
+
/** Single decoded tick from a push message. */
|
|
11
|
+
export interface PushTick {
|
|
12
|
+
sn: number;
|
|
13
|
+
time: number;
|
|
14
|
+
price: number;
|
|
15
|
+
volume: number;
|
|
16
|
+
tickType: string;
|
|
17
|
+
cond: string;
|
|
18
|
+
partCode: string;
|
|
19
|
+
partName: string;
|
|
20
|
+
}
|
|
21
|
+
/** Decoded push trade tick message — equivalent to Java TradeTick. */
|
|
22
|
+
export interface PushTradeTick {
|
|
23
|
+
symbol: string;
|
|
24
|
+
secType: string;
|
|
25
|
+
quoteLevel: string;
|
|
26
|
+
timestamp: number;
|
|
27
|
+
ticks: PushTick[];
|
|
28
|
+
}
|
|
29
|
+
/** Decodes a TradeTickData pb message into a PushTradeTick with resolved partCode/partName. */
|
|
30
|
+
export declare function convertTradeTick(src: TradeTickData): PushTradeTick;
|