tigeropen 0.4.0 → 0.5.7
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 +82 -2
- package/dist/cjs/auth/authentication.js +74 -0
- package/dist/cjs/auth/index.js +24 -0
- package/dist/cjs/auth/oauth2/client-registration.js +44 -0
- package/dist/cjs/auth/oauth2/device-authorization.js +40 -0
- package/dist/cjs/auth/oauth2/errors.js +64 -0
- package/dist/cjs/auth/oauth2/http-utils.js +112 -0
- package/dist/cjs/auth/oauth2/index.js +42 -0
- package/dist/cjs/auth/oauth2/loopback-receiver.js +215 -0
- package/dist/cjs/auth/oauth2/metadata.js +34 -0
- package/dist/cjs/auth/oauth2/oauth2-authentication.js +74 -0
- package/dist/cjs/auth/oauth2/session-manager.js +762 -0
- package/dist/cjs/auth/oauth2/token-store.js +252 -0
- package/dist/cjs/auth/oauth2/token.js +76 -0
- 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/pb/Request.js +12 -1
- package/dist/cjs/push/proto-message.js +5 -1
- package/dist/cjs/push/push-client.js +69 -25
- 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 +186 -16
- package/dist/cjs/version.js +4 -0
- package/dist/esm/auth/authentication.js +68 -0
- package/dist/esm/auth/index.js +3 -0
- package/dist/esm/auth/oauth2/client-registration.js +40 -0
- package/dist/esm/auth/oauth2/device-authorization.js +36 -0
- package/dist/esm/auth/oauth2/errors.js +59 -0
- package/dist/esm/auth/oauth2/http-utils.js +105 -0
- package/dist/esm/auth/oauth2/index.js +11 -0
- package/dist/esm/auth/oauth2/loopback-receiver.js +178 -0
- package/dist/esm/auth/oauth2/metadata.js +30 -0
- package/dist/esm/auth/oauth2/oauth2-authentication.js +70 -0
- package/dist/esm/auth/oauth2/session-manager.js +725 -0
- package/dist/esm/auth/oauth2/token-store.js +214 -0
- package/dist/esm/auth/oauth2/token.js +71 -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/package.json +3 -0
- 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/Request.js +12 -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 +8 -4
- package/dist/esm/push/push-client.js +76 -32
- 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 +156 -19
- package/dist/esm/version.js +1 -0
- package/dist/types/auth/authentication.d.ts +98 -0
- package/dist/types/auth/index.d.ts +4 -0
- package/dist/types/auth/oauth2/client-registration.d.ts +32 -0
- package/dist/types/auth/oauth2/device-authorization.d.ts +40 -0
- package/dist/types/auth/oauth2/errors.d.ts +46 -0
- package/dist/types/auth/oauth2/http-utils.d.ts +21 -0
- package/dist/types/auth/oauth2/index.d.ts +16 -0
- package/dist/types/auth/oauth2/loopback-receiver.d.ts +29 -0
- package/dist/types/auth/oauth2/metadata.d.ts +32 -0
- package/dist/types/auth/oauth2/oauth2-authentication.d.ts +31 -0
- package/dist/types/auth/oauth2/session-manager.d.ts +241 -0
- package/dist/types/auth/oauth2/token-store.d.ts +49 -0
- package/dist/types/auth/oauth2/token.d.ts +56 -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 +151 -24
- package/dist/types/model/trade-requests.d.ts +123 -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 +2 -1
- package/dist/types/push/pb/Request.d.ts +1 -0
- package/dist/types/push/proto-message.d.ts +4 -1
- package/dist/types/push/push-client.d.ts +38 -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 +69 -14
- package/dist/types/version.d.ts +1 -0
- package/package.json +9 -4
|
@@ -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;
|
|
@@ -64,22 +72,31 @@ export interface PositionsRequest {
|
|
|
64
72
|
expiry?: string;
|
|
65
73
|
strike?: string;
|
|
66
74
|
right?: string;
|
|
75
|
+
/** 资产行情类型枚举名: ETH / RTH / OVERNIGHT (wire: asset_quote_type) */
|
|
67
76
|
assetQuoteType?: string;
|
|
68
77
|
lang?: string;
|
|
69
78
|
}
|
|
70
79
|
export interface AssetsRequest {
|
|
71
80
|
account?: string;
|
|
81
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
82
|
+
secretKey?: string;
|
|
72
83
|
subAccounts?: string[];
|
|
73
84
|
segment?: boolean;
|
|
74
85
|
marketValue?: boolean;
|
|
86
|
+
/** 资产行情类型枚举名: ETH / RTH / OVERNIGHT (wire: asset_quote_type) */
|
|
87
|
+
assetQuoteType?: string;
|
|
75
88
|
lang?: string;
|
|
76
89
|
}
|
|
77
90
|
export interface ManagedAccountsRequest {
|
|
78
91
|
account?: string;
|
|
92
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
93
|
+
secretKey?: string;
|
|
79
94
|
lang?: string;
|
|
80
95
|
}
|
|
81
96
|
export interface DerivativeContractsRequest {
|
|
82
97
|
account?: string;
|
|
98
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
99
|
+
secretKey?: string;
|
|
83
100
|
symbols: string[];
|
|
84
101
|
secType: string;
|
|
85
102
|
expiry?: string;
|
|
@@ -87,6 +104,8 @@ export interface DerivativeContractsRequest {
|
|
|
87
104
|
}
|
|
88
105
|
export interface AnalyticsAssetRequest {
|
|
89
106
|
account?: string;
|
|
107
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
108
|
+
secretKey?: string;
|
|
90
109
|
segType?: string;
|
|
91
110
|
/** 格式 "YYYY-MM-DD" */
|
|
92
111
|
startDate?: string;
|
|
@@ -95,12 +114,18 @@ export interface AnalyticsAssetRequest {
|
|
|
95
114
|
}
|
|
96
115
|
export interface AggregateAssetsRequest {
|
|
97
116
|
account?: string;
|
|
117
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
118
|
+
secretKey?: string;
|
|
98
119
|
baseCurrency?: string;
|
|
99
120
|
segType?: string;
|
|
121
|
+
/** 资产行情类型枚举名: ETH / RTH / OVERNIGHT (wire: asset_quote_type) */
|
|
122
|
+
assetQuoteType?: string;
|
|
100
123
|
lang?: string;
|
|
101
124
|
}
|
|
102
125
|
export interface EstimateTradableQuantityRequest {
|
|
103
126
|
account?: string;
|
|
127
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
128
|
+
secretKey?: string;
|
|
104
129
|
symbol: string;
|
|
105
130
|
secType: string;
|
|
106
131
|
action: string;
|
|
@@ -115,6 +140,8 @@ export interface EstimateTradableQuantityRequest {
|
|
|
115
140
|
}
|
|
116
141
|
export interface ForexOrderRequest {
|
|
117
142
|
account?: string;
|
|
143
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
144
|
+
secretKey?: string;
|
|
118
145
|
segType?: string;
|
|
119
146
|
sourceCurrency: string;
|
|
120
147
|
targetCurrency: string;
|
|
@@ -125,6 +152,8 @@ export interface ForexOrderRequest {
|
|
|
125
152
|
}
|
|
126
153
|
export interface SegmentFundRequest {
|
|
127
154
|
account?: string;
|
|
155
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
156
|
+
secretKey?: string;
|
|
128
157
|
id?: string;
|
|
129
158
|
fromSegment?: string;
|
|
130
159
|
toSegment?: string;
|
|
@@ -133,21 +162,33 @@ export interface SegmentFundRequest {
|
|
|
133
162
|
limit?: number;
|
|
134
163
|
lang?: string;
|
|
135
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* Fund details request. wire: fund_details
|
|
167
|
+
*
|
|
168
|
+
* **Wire types (breaking):** `startDate` / `endDate` are yyyy-MM-dd date
|
|
169
|
+
* strings, not epoch-ms integers. Java's `FundDetailsModel` exposes them
|
|
170
|
+
* as `String startDate` / `String endDate`; sending epoch-ms causes
|
|
171
|
+
* `parse 'start_date' error, supported format: 'yyyy-MM-dd'`.
|
|
172
|
+
*/
|
|
136
173
|
export interface FundDetailsRequest {
|
|
137
174
|
account?: string;
|
|
175
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
176
|
+
secretKey?: string;
|
|
138
177
|
segTypes?: string[];
|
|
139
178
|
fundType?: string;
|
|
140
179
|
currency?: string;
|
|
141
|
-
/**
|
|
142
|
-
startDate?:
|
|
143
|
-
/**
|
|
144
|
-
endDate?:
|
|
180
|
+
/** yyyy-MM-dd 日期字符串 */
|
|
181
|
+
startDate?: string;
|
|
182
|
+
/** yyyy-MM-dd 日期字符串 */
|
|
183
|
+
endDate?: string;
|
|
145
184
|
limit?: number;
|
|
146
185
|
pageToken?: string;
|
|
147
186
|
lang?: string;
|
|
148
187
|
}
|
|
149
188
|
export interface FundingHistoryRequest {
|
|
150
189
|
account?: string;
|
|
190
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
191
|
+
secretKey?: string;
|
|
151
192
|
segType?: string;
|
|
152
193
|
currency?: string;
|
|
153
194
|
/** 毫秒时间戳 */
|
|
@@ -159,6 +200,8 @@ export interface FundingHistoryRequest {
|
|
|
159
200
|
}
|
|
160
201
|
export interface PositionTransferRequest {
|
|
161
202
|
fromAccount?: string;
|
|
203
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
204
|
+
secretKey?: string;
|
|
162
205
|
toAccount: string;
|
|
163
206
|
market?: string;
|
|
164
207
|
transfers: Array<{
|
|
@@ -174,6 +217,8 @@ export interface PositionTransferRequest {
|
|
|
174
217
|
export interface PositionTransferRecordsRequest {
|
|
175
218
|
/** wire: account_id */
|
|
176
219
|
accountId?: string;
|
|
220
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
221
|
+
secretKey?: string;
|
|
177
222
|
sinceDate?: string;
|
|
178
223
|
toDate?: string;
|
|
179
224
|
market?: string;
|
|
@@ -182,14 +227,88 @@ export interface PositionTransferRecordsRequest {
|
|
|
182
227
|
}
|
|
183
228
|
export interface PositionTransferDetailRequest {
|
|
184
229
|
accountId?: string;
|
|
230
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
231
|
+
secretKey?: string;
|
|
185
232
|
id: string;
|
|
186
233
|
lang?: string;
|
|
187
234
|
}
|
|
188
235
|
export interface PositionTransferExternalRecordsRequest {
|
|
189
236
|
accountId?: string;
|
|
237
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
238
|
+
secretKey?: string;
|
|
190
239
|
sinceDate?: string;
|
|
191
240
|
toDate?: string;
|
|
192
241
|
market?: string;
|
|
193
242
|
limit?: number;
|
|
194
243
|
lang?: string;
|
|
195
244
|
}
|
|
245
|
+
/** 行权检验请求 (wire: option_exercise_check) */
|
|
246
|
+
export interface OptionExerciseCheckRequest {
|
|
247
|
+
account?: string;
|
|
248
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
249
|
+
secretKey?: string;
|
|
250
|
+
/** 期权合约 ID */
|
|
251
|
+
contractId: number;
|
|
252
|
+
/** Exercise | Expire */
|
|
253
|
+
type: string;
|
|
254
|
+
quantity?: number;
|
|
255
|
+
/** yyyy-MM-dd,Exercise 类型建议填 */
|
|
256
|
+
executingDate?: string;
|
|
257
|
+
/** Exercise 类型建议填 */
|
|
258
|
+
isForce?: boolean;
|
|
259
|
+
/** 0–10,Expire 类型专用 */
|
|
260
|
+
itmRate?: number;
|
|
261
|
+
lang?: string;
|
|
262
|
+
}
|
|
263
|
+
/** 查询可行权持仓请求 (wire: option_exercise_position) */
|
|
264
|
+
export interface OptionExercisePositionRequest {
|
|
265
|
+
account?: string;
|
|
266
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
267
|
+
secretKey?: string;
|
|
268
|
+
/** Exercise | Expire */
|
|
269
|
+
type: string;
|
|
270
|
+
lang?: string;
|
|
271
|
+
}
|
|
272
|
+
/** 提交行权申请请求 (wire: option_exercise_submit) */
|
|
273
|
+
export interface OptionExerciseSubmitRequest {
|
|
274
|
+
account?: string;
|
|
275
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
276
|
+
secretKey?: string;
|
|
277
|
+
contractId: number;
|
|
278
|
+
/** Exercise | Expire */
|
|
279
|
+
type: string;
|
|
280
|
+
quantity: number;
|
|
281
|
+
/** Exercise 必填,yyyy-MM-dd */
|
|
282
|
+
executingDate?: string;
|
|
283
|
+
/** Exercise 必填 */
|
|
284
|
+
isForce?: boolean;
|
|
285
|
+
/** 0–10,Expire 专用 */
|
|
286
|
+
itmRate?: number;
|
|
287
|
+
lang?: string;
|
|
288
|
+
}
|
|
289
|
+
/** 分页查询行权记录请求 (wire: option_exercise_record) */
|
|
290
|
+
export interface OptionExerciseRecordsRequest {
|
|
291
|
+
account?: string;
|
|
292
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
293
|
+
secretKey?: string;
|
|
294
|
+
/** 从 1 开始,默认 1 */
|
|
295
|
+
page?: number;
|
|
296
|
+
/** 1–100,默认 20 */
|
|
297
|
+
size?: number;
|
|
298
|
+
/** New | Cancel | Success | Fail */
|
|
299
|
+
status?: string;
|
|
300
|
+
/** Exercise | Expire */
|
|
301
|
+
type?: string;
|
|
302
|
+
symbol?: string;
|
|
303
|
+
/** symbol | expire_date | strike | is_call */
|
|
304
|
+
orderBy?: string;
|
|
305
|
+
lang?: string;
|
|
306
|
+
}
|
|
307
|
+
/** 撤销行权申请请求 (wire: option_exercise_cancel) */
|
|
308
|
+
export interface OptionExerciseCancelRequest {
|
|
309
|
+
account?: string;
|
|
310
|
+
/** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
|
|
311
|
+
secretKey?: string;
|
|
312
|
+
id: number;
|
|
313
|
+
lang?: string;
|
|
314
|
+
}
|
|
@@ -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
|
-
export type { PushClientOptions, TLSSocketLike, TLSSocketFactory } from './push-client';
|
|
10
|
+
export type { PushClientOptions, AccountSubscribeOptions, TLSSocketLike, TLSSocketFactory, } from './push-client';
|
|
@@ -21,6 +21,7 @@ export interface Request_Subscribe {
|
|
|
21
21
|
symbols?: string | undefined;
|
|
22
22
|
account?: string | undefined;
|
|
23
23
|
market?: string | undefined;
|
|
24
|
+
assetQuoteType?: string | undefined;
|
|
24
25
|
}
|
|
25
26
|
export declare const Request: MessageFns<Request>;
|
|
26
27
|
export declare const Request_Connect: MessageFns<Request_Connect>;
|
|
@@ -17,8 +17,11 @@ export declare function buildConnectMessage(tigerId: string, sign: string, sdkVe
|
|
|
17
17
|
export declare function buildHeartBeatMessage(): Request;
|
|
18
18
|
/**
|
|
19
19
|
* 构建 SUBSCRIBE 请求消息
|
|
20
|
+
*
|
|
21
|
+
* @param assetQuoteType 资产行情类型枚举名(ETH / RTH / OVERNIGHT),
|
|
22
|
+
* 仅对 Asset / Position 两种订阅有意义,其余场景传 undefined
|
|
20
23
|
*/
|
|
21
|
-
export declare function buildSubscribeMessage(dataType: SocketCommon_DataType, symbols?: string, account?: string, market?: string): Request;
|
|
24
|
+
export declare function buildSubscribeMessage(dataType: SocketCommon_DataType, symbols?: string, account?: string, market?: string, assetQuoteType?: string): Request;
|
|
22
25
|
/**
|
|
23
26
|
* 构建 UNSUBSCRIBE 请求消息
|
|
24
27
|
*/
|
|
@@ -7,6 +7,18 @@ export declare enum ConnectionState {
|
|
|
7
7
|
Connecting = 1,
|
|
8
8
|
Connected = 2
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* Options for account-level subscriptions (asset / position).
|
|
12
|
+
*
|
|
13
|
+
* `assetQuoteType` 用于选择资产/持仓推送的行情口径,通过重载传入,
|
|
14
|
+
* 老的 `subscribeAsset(account?)` / `subscribePosition(account?)` 签名保持不变。
|
|
15
|
+
*/
|
|
16
|
+
export interface AccountSubscribeOptions {
|
|
17
|
+
/** Account to subscribe; omit to use the account from ClientConfig. */
|
|
18
|
+
account?: string;
|
|
19
|
+
/** 资产行情类型枚举名: ETH / RTH / OVERNIGHT,省略则由服务端取默认值 */
|
|
20
|
+
assetQuoteType?: string;
|
|
21
|
+
}
|
|
10
22
|
/** PushClient configuration options */
|
|
11
23
|
export interface PushClientOptions {
|
|
12
24
|
pushHost?: string;
|
|
@@ -44,11 +56,15 @@ export declare class PushClient {
|
|
|
44
56
|
private useFullTick;
|
|
45
57
|
private socket;
|
|
46
58
|
private _state;
|
|
59
|
+
/** Whether this connect attempt already fell back to unverified TLS */
|
|
60
|
+
private tlsFallback;
|
|
47
61
|
private callbacks;
|
|
48
62
|
/** Subscription state: subject -> Set<symbol> */
|
|
49
63
|
private subscriptions;
|
|
50
|
-
/** Account-level subscriptions */
|
|
64
|
+
/** Account-level subscriptions: subject -> account string used at subscribe time */
|
|
51
65
|
private accountSubs;
|
|
66
|
+
/** Account-level subscriptions: subject -> assetQuoteType used at subscribe time (reconnect replay) */
|
|
67
|
+
private accountSubQuoteTypes;
|
|
52
68
|
private heartbeatTimer;
|
|
53
69
|
private reconnectTimer;
|
|
54
70
|
private stopped;
|
|
@@ -148,12 +164,31 @@ export declare class PushClient {
|
|
|
148
164
|
subscribeMarket(market: string): void;
|
|
149
165
|
/** Unsubscribe from market status (v0.4.0). */
|
|
150
166
|
unsubscribeMarket(market: string): void;
|
|
167
|
+
/**
|
|
168
|
+
* Shared implementation for the account/options overloads of
|
|
169
|
+
* subscribeAsset / subscribePosition.
|
|
170
|
+
*/
|
|
171
|
+
private subscribeAccount;
|
|
151
172
|
/** Subscribe to asset changes */
|
|
152
173
|
subscribeAsset(account?: string): void;
|
|
174
|
+
/**
|
|
175
|
+
* Subscribe to asset changes with extra options.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* client.subscribeAsset({ assetQuoteType: 'OVERNIGHT' });
|
|
179
|
+
*/
|
|
180
|
+
subscribeAsset(options: AccountSubscribeOptions): void;
|
|
153
181
|
/** Unsubscribe from asset changes */
|
|
154
182
|
unsubscribeAsset(): void;
|
|
155
183
|
/** Subscribe to position changes */
|
|
156
184
|
subscribePosition(account?: string): void;
|
|
185
|
+
/**
|
|
186
|
+
* Subscribe to position changes with extra options.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* client.subscribePosition({ assetQuoteType: 'OVERNIGHT' });
|
|
190
|
+
*/
|
|
191
|
+
subscribePosition(options: AccountSubscribeOptions): void;
|
|
157
192
|
/** Unsubscribe from position changes */
|
|
158
193
|
unsubscribePosition(): void;
|
|
159
194
|
/** Subscribe to order status */
|
|
@@ -166,6 +201,6 @@ export declare class PushClient {
|
|
|
166
201
|
unsubscribeTransaction(): void;
|
|
167
202
|
/** Get current market data subscriptions */
|
|
168
203
|
getSubscriptions(): Map<SubjectType, string[]>;
|
|
169
|
-
/** Get account-level subscriptions */
|
|
170
|
-
getAccountSubscriptions(): SubjectType
|
|
204
|
+
/** Get account-level subscriptions: subject -> account */
|
|
205
|
+
getAccountSubscriptions(): Map<SubjectType, string>;
|
|
171
206
|
}
|
|
@@ -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;
|