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
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Order construction helpers.
|
|
3
3
|
* All helpers return an `OrderRequest` with sensible defaults.
|
|
4
4
|
*/
|
|
5
|
-
import type { OrderRequest, OrderLegRequest, AlgoParamsRequest } from './order';
|
|
5
|
+
import type { OrderRequest, OrderLegRequest, AlgoParamsRequest, ContractLegRequest } from './order';
|
|
6
|
+
import { PriceType } from './enums';
|
|
6
7
|
/** Market order */
|
|
7
8
|
export declare function marketOrder(account: string, symbol: string, secType: string, action: string, quantity: number): OrderRequest;
|
|
8
9
|
/** Limit order */
|
|
@@ -19,5 +20,55 @@ export declare function auctionLimitOrder(account: string, symbol: string, secTy
|
|
|
19
20
|
export declare function auctionMarketOrder(account: string, symbol: string, secType: string, action: string, quantity: number): OrderRequest;
|
|
20
21
|
/** Algo order (TWAP / VWAP) */
|
|
21
22
|
export declare function algoOrder(account: string, symbol: string, secType: string, action: string, quantity: number, limitPrice: number, algoType: string, params: AlgoParamsRequest): OrderRequest;
|
|
23
|
+
/**
|
|
24
|
+
* Iceberg order. `displaySize` is required; all other parameters are optional.
|
|
25
|
+
* Pass `priceType` as empty string to use the server default (LIMIT_PRICE).
|
|
26
|
+
* Pass `startTime` / `endTime` as 0 to omit the time window.
|
|
27
|
+
*/
|
|
28
|
+
export declare function icebergOrder(account: string, symbol: string, secType: string, action: string, quantity: number, limitPrice: number, displaySize: number, minDisplaySize?: number, checkIntervals?: number, priceType?: PriceType | string, startTime?: number, endTime?: number): OrderRequest;
|
|
22
29
|
/** Attached profit / loss leg */
|
|
23
30
|
export declare function orderLeg(legType: string, price: number, timeInForce: string): OrderLegRequest;
|
|
31
|
+
/**
|
|
32
|
+
* Market order by cash amount (instead of quantity).
|
|
33
|
+
* Server uses `isQuantityByAmount=true` + `amount` field.
|
|
34
|
+
*/
|
|
35
|
+
export declare function marketOrderByAmount(account: string, symbol: string, secType: string, action: string, amount: number): OrderRequest;
|
|
36
|
+
/**
|
|
37
|
+
* Limit order by cash amount (instead of quantity).
|
|
38
|
+
*/
|
|
39
|
+
export declare function limitOrderByAmount(account: string, symbol: string, secType: string, action: string, amount: number, limitPrice: number): OrderRequest;
|
|
40
|
+
/**
|
|
41
|
+
* Trailing stop order using a fixed price offset (auxPrice) instead of a percentage.
|
|
42
|
+
* Use `trailOrder()` for percentage-based trailing stops.
|
|
43
|
+
*/
|
|
44
|
+
export declare function trailOrderByPrice(account: string, symbol: string, secType: string, action: string, quantity: number, auxPrice: number): OrderRequest;
|
|
45
|
+
/**
|
|
46
|
+
* Limit order with attached profit/loss legs (bracket order).
|
|
47
|
+
* At most 2 legs are supported.
|
|
48
|
+
*
|
|
49
|
+
* @param orderLegs - Array of `OrderLegRequest` (use `orderLeg()` helper)
|
|
50
|
+
*/
|
|
51
|
+
export declare function limitOrderWithLegs(account: string, symbol: string, secType: string, action: string, quantity: number, limitPrice: number, orderLegs: OrderLegRequest[]): OrderRequest;
|
|
52
|
+
/**
|
|
53
|
+
* Multi-leg (combo/MLEG) order for options combos.
|
|
54
|
+
*
|
|
55
|
+
* @param contractLegs - Array of `ContractLegRequest` (use `contractLeg()` helper)
|
|
56
|
+
* @param comboType - e.g. `'MLEG'`
|
|
57
|
+
*/
|
|
58
|
+
export declare function comboOrder(account: string, action: string, quantity: number, orderType: string, contractLegs: ContractLegRequest[], comboType?: string, limitPrice?: number, auxPrice?: number, trailingPercent?: number): OrderRequest;
|
|
59
|
+
/**
|
|
60
|
+
* OCA (One-Cancels-All) order.
|
|
61
|
+
* Server expects `orderType: 'OCA'` and an `ocaOrders` list.
|
|
62
|
+
*
|
|
63
|
+
* @param ocaOrders - The contained orders (use any order helper to build each)
|
|
64
|
+
*/
|
|
65
|
+
export declare function ocaOrder(account: string, symbol: string, secType: string, action: string, quantity: number, ocaOrders: OrderRequest[]): OrderRequest;
|
|
66
|
+
/**
|
|
67
|
+
* Build a single leg for a multi-leg (MLEG / combo) order.
|
|
68
|
+
*
|
|
69
|
+
* @param symbol - Underlying symbol
|
|
70
|
+
* @param secType - Security type (e.g. `'OPT'`)
|
|
71
|
+
* @param action - `'BUY'` or `'SELL'`
|
|
72
|
+
* @param ratio - Number of contracts for this leg
|
|
73
|
+
*/
|
|
74
|
+
export declare function contractLeg(symbol: string, secType: string, action: string, ratio: number, expiry?: string, strike?: string, right?: string): ContractLegRequest;
|
|
@@ -12,18 +12,36 @@ export interface OrderLeg {
|
|
|
12
12
|
timeInForce?: string;
|
|
13
13
|
quantity?: number;
|
|
14
14
|
}
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Algo order parameters — response side.
|
|
17
|
+
*
|
|
18
|
+
* The response shape flattens the [{tag, value}, ...] wire form into an
|
|
19
|
+
* object, and the server historically emits `startTime` / `endTime` as
|
|
20
|
+
* epoch-ms numbers (matching what the request side sends). Some legacy
|
|
21
|
+
* paths still return the raw string; accept both.
|
|
22
|
+
*
|
|
23
|
+
* Note: `algoStrategy` on the response side is server-echoed; on the
|
|
24
|
+
* request side it lives on `OrderRequest`, not `AlgoParamsRequest`.
|
|
25
|
+
*/
|
|
16
26
|
export interface AlgoParams {
|
|
17
27
|
algoStrategy?: string;
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
/** Epoch-ms; server may echo as string on legacy paths */
|
|
29
|
+
startTime?: number | string;
|
|
30
|
+
/** Epoch-ms; server may echo as string on legacy paths */
|
|
31
|
+
endTime?: number | string;
|
|
32
|
+
/** Whether to minimize trade count (VWAP) */
|
|
33
|
+
noTakeLiq?: boolean;
|
|
34
|
+
/** Whether to allow completion after end_time (TWAP / VWAP) */
|
|
35
|
+
allowPastEndTime?: boolean;
|
|
36
|
+
/** Participation rate 0.01–0.5 (VWAP only) */
|
|
20
37
|
participationRate?: number;
|
|
21
38
|
}
|
|
22
39
|
/** Order response model (returned by order query methods). */
|
|
23
40
|
export interface Order {
|
|
24
41
|
account?: string;
|
|
25
|
-
|
|
26
|
-
|
|
42
|
+
/** int64 order ID — may be a string when it exceeds Number.MAX_SAFE_INTEGER */
|
|
43
|
+
id?: number | string;
|
|
44
|
+
orderId?: number | string;
|
|
27
45
|
externalId?: string;
|
|
28
46
|
action?: string;
|
|
29
47
|
orderType?: string;
|
|
@@ -82,6 +100,8 @@ export interface OrderRequest {
|
|
|
82
100
|
account?: string;
|
|
83
101
|
/** Global order ID (required for modify) */
|
|
84
102
|
id?: number;
|
|
103
|
+
/** Institutional account trading key (client fills it in automatically if set) */
|
|
104
|
+
secretKey?: string;
|
|
85
105
|
/** Account-level order ID */
|
|
86
106
|
orderId?: number;
|
|
87
107
|
/** BUY / SELL */
|
|
@@ -124,18 +144,115 @@ export interface OrderRequest {
|
|
|
124
144
|
remark?: string;
|
|
125
145
|
/** User mark */
|
|
126
146
|
userMark?: string;
|
|
147
|
+
/** 冰山单:展示数量 */
|
|
148
|
+
displaySize?: number;
|
|
149
|
+
/** 冰山单:最小展示数量 */
|
|
150
|
+
minDisplaySize?: number;
|
|
151
|
+
/** 冰山单:价检间隔(秒) */
|
|
152
|
+
checkIntervals?: number;
|
|
153
|
+
/** 冰山单:价格类型(LIMIT_PRICE / ASK_PRICE / BID_PRICE / LATEST_PRICE) */
|
|
154
|
+
priceType?: string;
|
|
155
|
+
/**
|
|
156
|
+
* 冰山单:生效开始时间(epoch ms)。
|
|
157
|
+
* Wire note: the gateway accepts both `number` (epoch ms) and `string`
|
|
158
|
+
* (epoch ms as string) for ICEBERG orders; `number | string` keeps
|
|
159
|
+
* TypeScript callers who pass `String(now)` from hitting a compile error.
|
|
160
|
+
*/
|
|
161
|
+
startTime?: number | string;
|
|
162
|
+
/**
|
|
163
|
+
* 冰山单:生效结束时间(epoch ms)。
|
|
164
|
+
* Same dual-type note as `startTime` above.
|
|
165
|
+
*/
|
|
166
|
+
endTime?: number | string;
|
|
167
|
+
/** GTD 到期时间(epoch ms) */
|
|
168
|
+
expireTime?: number;
|
|
169
|
+
/** 盘后委托价格 */
|
|
170
|
+
afterHoursPrice?: number;
|
|
171
|
+
/** 批次号 */
|
|
172
|
+
batchNo?: number;
|
|
173
|
+
/** 资金类型(CASH / MARGIN) */
|
|
174
|
+
segType?: string;
|
|
175
|
+
/** 按金额下单:委托金额 */
|
|
176
|
+
amount?: number;
|
|
177
|
+
/** 按金额下单:现金金额(wire: cash_amount,与 amount 二选一) */
|
|
178
|
+
cashAmount?: number;
|
|
179
|
+
/**
|
|
180
|
+
* @deprecated 服务端不再需要此字段,by-amount 订单直接设置 `cashAmount`。
|
|
181
|
+
* 保留仅为向前兼容,新代码勿使用。
|
|
182
|
+
*/
|
|
183
|
+
isQuantityByAmount?: boolean;
|
|
184
|
+
/** 账户分配列表(机构账户) */
|
|
185
|
+
allocAccounts?: string[];
|
|
186
|
+
/** 各账户分配份额(与 allocAccounts 一一对应) */
|
|
187
|
+
allocShares?: number[];
|
|
188
|
+
/** 下单来源 */
|
|
189
|
+
source?: string;
|
|
190
|
+
/** 下单渠道 */
|
|
191
|
+
channel?: string;
|
|
192
|
+
/** 虚拟订单类型 */
|
|
193
|
+
virtualOrderType?: string;
|
|
194
|
+
/** 虚拟订单 ID */
|
|
195
|
+
virtualId?: string;
|
|
196
|
+
/** 止盈订单 ID(bracket 关联) */
|
|
197
|
+
profitTakerOrderId?: number;
|
|
198
|
+
/** 止损订单 ID(bracket 关联) */
|
|
199
|
+
stopLossOrderId?: number;
|
|
200
|
+
/** 本地流水号 */
|
|
201
|
+
localNo?: string;
|
|
202
|
+
/** OCA 订单组(One-Cancels-All) */
|
|
203
|
+
ocaOrders?: OrderRequest[];
|
|
204
|
+
/** 多腿期权各腿(MLEG) */
|
|
205
|
+
contractLegs?: ContractLegRequest[];
|
|
206
|
+
/** 组合单类型(如 MLEG) */
|
|
207
|
+
comboType?: string;
|
|
208
|
+
/**
|
|
209
|
+
* Algo strategy name for TWAP / VWAP orders (e.g. `'TWAP'`, `'VWAP'`).
|
|
210
|
+
* Lives on `OrderRequest`, not inside `algoParams` — the Python SDK
|
|
211
|
+
* places it at the top-level order object, and the gateway expects
|
|
212
|
+
* `algo_strategy` as a sibling of `algo_params`.
|
|
213
|
+
*
|
|
214
|
+
* Note: `AlgoParamsRequest` intentionally omits this field (see its
|
|
215
|
+
* doc-comment). Pass `algoStrategy` here and `algoParams` as the
|
|
216
|
+
* companion object.
|
|
217
|
+
*/
|
|
218
|
+
algoStrategy?: string;
|
|
219
|
+
}
|
|
220
|
+
/** Single leg of a multi-leg option order (MLEG) */
|
|
221
|
+
export interface ContractLegRequest {
|
|
222
|
+
symbol?: string;
|
|
223
|
+
secType?: string;
|
|
224
|
+
expiry?: string;
|
|
225
|
+
strike?: string;
|
|
226
|
+
right?: string;
|
|
227
|
+
action?: string;
|
|
228
|
+
ratio?: number;
|
|
127
229
|
}
|
|
128
|
-
/** Attached leg for request side */
|
|
230
|
+
/** Attached profit/loss leg for order request side */
|
|
129
231
|
export interface OrderLegRequest {
|
|
130
232
|
legType: string;
|
|
131
233
|
price?: number;
|
|
132
234
|
timeInForce?: string;
|
|
133
235
|
quantity?: number;
|
|
134
236
|
}
|
|
135
|
-
/**
|
|
237
|
+
/**
|
|
238
|
+
* Algo parameters for request side (TWAP / VWAP).
|
|
239
|
+
*
|
|
240
|
+
* Fields match the Python SDK's AlgoParams. On the wire, the SDK marshals
|
|
241
|
+
* this object into the `[{tag, value}, ...]` array shape the gateway
|
|
242
|
+
* expects — callers should just pass the natural object.
|
|
243
|
+
*
|
|
244
|
+
* `algoStrategy` is intentionally not here: it lives on the parent
|
|
245
|
+
* `OrderRequest`, not inside `algoParams`.
|
|
246
|
+
*/
|
|
136
247
|
export interface AlgoParamsRequest {
|
|
137
|
-
|
|
138
|
-
startTime?:
|
|
139
|
-
|
|
248
|
+
/** Epoch-ms start time (TWAP / VWAP only) */
|
|
249
|
+
startTime?: number;
|
|
250
|
+
/** Epoch-ms end time (TWAP / VWAP only) */
|
|
251
|
+
endTime?: number;
|
|
252
|
+
/** Try to minimize trade count (VWAP only) */
|
|
253
|
+
noTakeLiq?: boolean;
|
|
254
|
+
/** Allow completing after end_time (TWAP / VWAP only) */
|
|
255
|
+
allowPastEndTime?: boolean;
|
|
256
|
+
/** Participation rate 0.01–0.5 (VWAP only) */
|
|
140
257
|
participationRate?: number;
|
|
141
258
|
}
|
|
@@ -27,6 +27,7 @@ export interface TradeTickRequest {
|
|
|
27
27
|
beginIndex?: number;
|
|
28
28
|
endIndex?: number;
|
|
29
29
|
limit?: number;
|
|
30
|
+
tradeSession?: string;
|
|
30
31
|
lang?: string;
|
|
31
32
|
}
|
|
32
33
|
/** Real-time futures quotes. wire: future_brief */
|
|
@@ -58,11 +59,10 @@ export interface StockDelayBriefsRequest {
|
|
|
58
59
|
secType?: string;
|
|
59
60
|
lang?: string;
|
|
60
61
|
}
|
|
61
|
-
/**
|
|
62
|
-
* K-line bars (full options). wire: kline
|
|
62
|
+
/** K-line request. wire: kline
|
|
63
63
|
* BeginTime/EndTime (ms) and BeginIndex/EndIndex are mutually exclusive.
|
|
64
64
|
*/
|
|
65
|
-
export interface
|
|
65
|
+
export interface KlineRequest {
|
|
66
66
|
symbols?: string[];
|
|
67
67
|
period?: string;
|
|
68
68
|
right?: string;
|
|
@@ -79,8 +79,9 @@ export interface BarsRequest {
|
|
|
79
79
|
lang?: string;
|
|
80
80
|
}
|
|
81
81
|
/** K-line client-side pagination wrapper. */
|
|
82
|
-
export interface
|
|
82
|
+
export interface KlineByPageRequest {
|
|
83
83
|
symbol?: string;
|
|
84
|
+
secType?: string;
|
|
84
85
|
period?: string;
|
|
85
86
|
beginTime?: number;
|
|
86
87
|
endTime?: number;
|
|
@@ -90,6 +91,11 @@ export interface BarsByPageRequest {
|
|
|
90
91
|
lang?: string;
|
|
91
92
|
tradeSession?: string;
|
|
92
93
|
}
|
|
94
|
+
/** Intraday timeline request. wire: timeline */
|
|
95
|
+
export interface TimelineRequest {
|
|
96
|
+
symbols?: string[];
|
|
97
|
+
secType?: string;
|
|
98
|
+
}
|
|
93
99
|
/** Historical intraday timeline. wire: history_timeline */
|
|
94
100
|
export interface TimelineHistoryRequest {
|
|
95
101
|
symbols?: string[];
|
|
@@ -135,7 +141,7 @@ export interface KlineQuotaRequest {
|
|
|
135
141
|
withDetails?: boolean;
|
|
136
142
|
lang?: string;
|
|
137
143
|
}
|
|
138
|
-
/**
|
|
144
|
+
/** Market data permission entry request. wire: get_quote_permission */
|
|
139
145
|
export interface QuotePermissionRequest {
|
|
140
146
|
beginDate?: string;
|
|
141
147
|
endDate?: string;
|
|
@@ -155,15 +161,21 @@ export interface OptionQueryItem {
|
|
|
155
161
|
endIndex?: number;
|
|
156
162
|
pageToken?: string;
|
|
157
163
|
}
|
|
158
|
-
/** Option
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
164
|
+
/** Option tick trades. wire: option_trade_tick
|
|
165
|
+
*
|
|
166
|
+
* **Wire contract:** the server expects `biz_content` to be a **top-level
|
|
167
|
+
* JSON array** (`[{symbol, expiry, ...}, ...]`), not `{"contracts": [...]}`.
|
|
168
|
+
* This matches Java (`BatchApiModel.items` serialized directly) and Python
|
|
169
|
+
* (`MultipleContractParams.to_openapi_dict` returns a list).
|
|
170
|
+
*
|
|
171
|
+
* The client unwraps `contracts` before serialization; sending it as an
|
|
172
|
+
* object caused `biz param error(failed to parse parameters in 'biz_content')`.
|
|
173
|
+
* `lang` is retained for API symmetry but is not sent on the wire — the
|
|
174
|
+
* gateway has no `lang` input for this method.
|
|
175
|
+
*/
|
|
165
176
|
export interface OptionTradeTicksRequest {
|
|
166
177
|
contracts?: OptionQueryItem[];
|
|
178
|
+
/** Retained for API symmetry; wire is a top-level array, so `lang` is not sent. */
|
|
167
179
|
lang?: string;
|
|
168
180
|
}
|
|
169
181
|
/** Option intraday timeline. wire: option_timeline */
|
|
@@ -215,8 +227,8 @@ export interface FutureHistoryMainContractRequest {
|
|
|
215
227
|
endTime?: number;
|
|
216
228
|
lang?: string;
|
|
217
229
|
}
|
|
218
|
-
/** Futures K-line
|
|
219
|
-
export interface
|
|
230
|
+
/** Futures K-line request. wire: future_kline */
|
|
231
|
+
export interface FutureKlineRequest {
|
|
220
232
|
contractCodes?: string[];
|
|
221
233
|
contractCode?: string;
|
|
222
234
|
period?: string;
|
|
@@ -229,7 +241,7 @@ export interface FutureBarsRequest {
|
|
|
229
241
|
lang?: string;
|
|
230
242
|
}
|
|
231
243
|
/** Futures K-line client-side pagination wrapper. */
|
|
232
|
-
export interface
|
|
244
|
+
export interface FutureKlineByPageRequest {
|
|
233
245
|
contractCode?: string;
|
|
234
246
|
period?: string;
|
|
235
247
|
beginTime?: number;
|
|
@@ -23,6 +23,7 @@ export interface Brief {
|
|
|
23
23
|
bidPrice?: number;
|
|
24
24
|
bidSize?: number;
|
|
25
25
|
volume?: number;
|
|
26
|
+
amount?: number;
|
|
26
27
|
status?: string;
|
|
27
28
|
adjPreClose?: number;
|
|
28
29
|
change?: number;
|
|
@@ -37,6 +38,7 @@ export interface Brief {
|
|
|
37
38
|
export interface KlineItem {
|
|
38
39
|
time: number;
|
|
39
40
|
volume: number;
|
|
41
|
+
volumeDecimal?: number | null;
|
|
40
42
|
open: number;
|
|
41
43
|
close: number;
|
|
42
44
|
high: number;
|
|
@@ -52,6 +54,7 @@ export interface Kline {
|
|
|
52
54
|
export interface TimelineItem {
|
|
53
55
|
time: number;
|
|
54
56
|
volume: number;
|
|
57
|
+
volumeDecimal?: number | null;
|
|
55
58
|
price: number;
|
|
56
59
|
avgPrice: number;
|
|
57
60
|
}
|
|
@@ -71,6 +74,9 @@ export interface TradeTickItem {
|
|
|
71
74
|
volume: number;
|
|
72
75
|
price: number;
|
|
73
76
|
type: string;
|
|
77
|
+
partCode?: string;
|
|
78
|
+
partName?: string;
|
|
79
|
+
cond?: string;
|
|
74
80
|
}
|
|
75
81
|
export interface TradeTick {
|
|
76
82
|
symbol: string;
|
|
@@ -116,11 +122,37 @@ export interface OptionLeg {
|
|
|
116
122
|
theta?: number;
|
|
117
123
|
vega?: number;
|
|
118
124
|
rho?: number;
|
|
125
|
+
markPrice?: number;
|
|
126
|
+
preMarkPrice?: number;
|
|
127
|
+
markTimestamp?: number;
|
|
128
|
+
midPrice?: number;
|
|
129
|
+
preMidPrice?: number;
|
|
130
|
+
midTimestamp?: number;
|
|
119
131
|
}
|
|
120
132
|
export interface OptionChainRow {
|
|
121
133
|
put?: OptionLeg;
|
|
122
134
|
call?: OptionLeg;
|
|
123
135
|
}
|
|
136
|
+
/** Range filter, serialized as { min, max } — corresponds to Java Range<T> */
|
|
137
|
+
export interface Range {
|
|
138
|
+
min?: number;
|
|
139
|
+
max?: number;
|
|
140
|
+
}
|
|
141
|
+
/** Greeks range filters for option_chain (corresponds to Java OptionChainFilterModel.Greeks) */
|
|
142
|
+
export interface OptionChainFilterGreeks {
|
|
143
|
+
delta?: Range;
|
|
144
|
+
gamma?: Range;
|
|
145
|
+
vega?: Range;
|
|
146
|
+
theta?: Range;
|
|
147
|
+
rho?: Range;
|
|
148
|
+
}
|
|
149
|
+
/** Option chain filter (corresponds to Java OptionChainFilterModel) */
|
|
150
|
+
export interface OptionChainFilter {
|
|
151
|
+
inTheMoney?: boolean;
|
|
152
|
+
impliedVolatility?: Range;
|
|
153
|
+
openInterest?: Range;
|
|
154
|
+
greeks?: OptionChainFilterGreeks;
|
|
155
|
+
}
|
|
124
156
|
export interface OptionChain {
|
|
125
157
|
symbol: string;
|
|
126
158
|
expiry: number;
|
|
@@ -217,6 +249,42 @@ export interface CorporateAction {
|
|
|
217
249
|
fromFactor?: number;
|
|
218
250
|
toFactor?: number;
|
|
219
251
|
}
|
|
252
|
+
export interface CorporateSymbolChange {
|
|
253
|
+
symbol: string;
|
|
254
|
+
market?: string;
|
|
255
|
+
exchange?: string;
|
|
256
|
+
executeDate?: string;
|
|
257
|
+
actionType?: string;
|
|
258
|
+
oldSymbol?: string;
|
|
259
|
+
/** newSymbol is the ticker after the rename; same as symbol. */
|
|
260
|
+
newSymbol?: string;
|
|
261
|
+
}
|
|
262
|
+
export interface CorporateDelisting {
|
|
263
|
+
symbol: string;
|
|
264
|
+
market?: string;
|
|
265
|
+
exchange?: string;
|
|
266
|
+
executeDate?: string;
|
|
267
|
+
actionType?: string;
|
|
268
|
+
announcedDate?: string;
|
|
269
|
+
reason?: string;
|
|
270
|
+
}
|
|
271
|
+
export interface CorporateIPO {
|
|
272
|
+
symbol: string;
|
|
273
|
+
market?: string;
|
|
274
|
+
exchange?: string;
|
|
275
|
+
executeDate?: string;
|
|
276
|
+
actionType?: string;
|
|
277
|
+
ipoName?: string;
|
|
278
|
+
listingDate?: string;
|
|
279
|
+
listingPrice?: number;
|
|
280
|
+
sharesOutstanding?: number;
|
|
281
|
+
sharesFloat?: number;
|
|
282
|
+
offerAmount?: number;
|
|
283
|
+
priceRange?: string;
|
|
284
|
+
currency?: string;
|
|
285
|
+
minPurchaseQuantity?: number;
|
|
286
|
+
leverageRatio?: number;
|
|
287
|
+
}
|
|
220
288
|
export interface CapitalFlowItem {
|
|
221
289
|
time: string;
|
|
222
290
|
timestamp: number;
|
|
@@ -272,20 +340,39 @@ export interface FinancialDailyRequest {
|
|
|
272
340
|
beginDate: string;
|
|
273
341
|
endDate: string;
|
|
274
342
|
}
|
|
343
|
+
/**
|
|
344
|
+
* Financial report request.
|
|
345
|
+
*
|
|
346
|
+
* **Wire types (breaking):** `beginDate` / `endDate` are epoch-ms integers,
|
|
347
|
+
* not date strings. Python SDK converts via `date_str_to_timestamp` before
|
|
348
|
+
* sending; sending raw strings makes the gateway reject with
|
|
349
|
+
* `biz param error(failed to parse parameters in 'biz_content')`.
|
|
350
|
+
*/
|
|
275
351
|
export interface FinancialReportRequest {
|
|
276
352
|
symbols: string[];
|
|
277
353
|
market: string;
|
|
278
354
|
fields: string[];
|
|
279
355
|
periodType: string;
|
|
280
|
-
|
|
281
|
-
|
|
356
|
+
/** epoch-ms start time */
|
|
357
|
+
beginDate?: number;
|
|
358
|
+
/** epoch-ms end time */
|
|
359
|
+
endDate?: number;
|
|
282
360
|
}
|
|
361
|
+
/**
|
|
362
|
+
* Corporate action request.
|
|
363
|
+
*
|
|
364
|
+
* **Wire types (breaking):** `beginDate` / `endDate` are epoch-ms integers,
|
|
365
|
+
* matching `FinancialReportRequest`. Server rejects string dates with
|
|
366
|
+
* `biz param error(failed to parse parameters in 'biz_content')`.
|
|
367
|
+
*/
|
|
283
368
|
export interface CorporateActionRequest {
|
|
284
369
|
symbols: string[];
|
|
285
370
|
market: string;
|
|
286
371
|
actionType: string;
|
|
287
|
-
|
|
288
|
-
|
|
372
|
+
/** epoch-ms start time */
|
|
373
|
+
beginDate?: number;
|
|
374
|
+
/** epoch-ms end time */
|
|
375
|
+
endDate?: number;
|
|
289
376
|
}
|
|
290
377
|
export interface FutureKlineRequest {
|
|
291
378
|
contractCodes: string[];
|
|
@@ -407,16 +494,26 @@ export interface KlineQuota {
|
|
|
407
494
|
}
|
|
408
495
|
/** Option historical-volatility time series point. */
|
|
409
496
|
export interface OptionVolatilityPoint {
|
|
410
|
-
|
|
411
|
-
|
|
497
|
+
impliedVol?: number;
|
|
498
|
+
percentile?: number;
|
|
499
|
+
rank?: number;
|
|
500
|
+
hisVolatility?: number;
|
|
501
|
+
timestamp?: number;
|
|
502
|
+
}
|
|
503
|
+
/** Implied-volatility metric for a specific period. */
|
|
504
|
+
export interface ImpliedVolMetric {
|
|
505
|
+
period?: string;
|
|
506
|
+
percentile?: number;
|
|
507
|
+
rank?: number;
|
|
412
508
|
}
|
|
413
509
|
/** Option analysis (option_analysis). */
|
|
414
510
|
export interface OptionAnalysis {
|
|
415
511
|
symbol?: string;
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
512
|
+
impliedVol30Days?: number;
|
|
513
|
+
hisVolatility?: number;
|
|
514
|
+
ivHisVRatio?: number;
|
|
515
|
+
callPutRatio?: number;
|
|
516
|
+
impliedVolMetric?: ImpliedVolMetric;
|
|
420
517
|
volatilityList?: OptionVolatilityPoint[];
|
|
421
518
|
}
|
|
422
519
|
/** Option symbol listing (option_symbol). */
|
|
@@ -486,10 +583,32 @@ export interface WarrantFilterResult {
|
|
|
486
583
|
pageSize?: number;
|
|
487
584
|
page?: number;
|
|
488
585
|
}
|
|
489
|
-
/**
|
|
586
|
+
/**
|
|
587
|
+
* Industry list row (industry_list).
|
|
588
|
+
*
|
|
589
|
+
* **Wire fields (breaking):** the server returns `nameCN` / `nameEN` /
|
|
590
|
+
* `industryLevel`, not `name` / `level` (matches Python SDK's
|
|
591
|
+
* `IndustryListResponse` which reads `ind.get('nameCN')`,
|
|
592
|
+
* `ind.get('nameEN')`, `ind.get('industryLevel')`).
|
|
593
|
+
* Since responses come back already-camelCase (no snake→camel step) and the
|
|
594
|
+
* server keeps `nameCN` / `nameEN` in mixed case, the fields are exposed
|
|
595
|
+
* exactly as sent.
|
|
596
|
+
*
|
|
597
|
+
* `name` and `level` are backwards-compat aliases populated by
|
|
598
|
+
* `getIndustryList` after the raw response is decoded — `name` mirrors
|
|
599
|
+
* `nameEN || nameCN`, `level` mirrors `industryLevel`.
|
|
600
|
+
*/
|
|
490
601
|
export interface IndustryItem {
|
|
491
602
|
id?: string;
|
|
603
|
+
/** Chinese name. Wire: `nameCN`. */
|
|
604
|
+
nameCN?: string;
|
|
605
|
+
/** English name. Wire: `nameEN`. */
|
|
606
|
+
nameEN?: string;
|
|
607
|
+
/** Industry level. Wire: `industryLevel`. */
|
|
608
|
+
industryLevel?: string;
|
|
609
|
+
/** Convenience alias: `nameEN || nameCN`. Populated by `getIndustryList`. */
|
|
492
610
|
name?: string;
|
|
611
|
+
/** @deprecated Use `industryLevel`. Mirrored by `getIndustryList` for back-compat. */
|
|
493
612
|
level?: string;
|
|
494
613
|
}
|
|
495
614
|
/** Stock belonging to an industry (industry_stock_list). */
|
|
@@ -507,12 +626,15 @@ export interface TradingCalendarItem {
|
|
|
507
626
|
isTrading?: boolean;
|
|
508
627
|
sessionType?: string;
|
|
509
628
|
}
|
|
629
|
+
/** Single day's FX rate value within an ExchangeRate.dailyValueList entry. */
|
|
630
|
+
export interface ExchangeRateDailyValue {
|
|
631
|
+
date?: number;
|
|
632
|
+
value?: number;
|
|
633
|
+
}
|
|
510
634
|
/** FX rate (financial_exchange_rate). */
|
|
511
635
|
export interface ExchangeRate {
|
|
512
636
|
currency?: string;
|
|
513
|
-
|
|
514
|
-
rate?: number;
|
|
515
|
-
baseCurrency?: string;
|
|
637
|
+
dailyValueList?: ExchangeRateDailyValue[];
|
|
516
638
|
}
|
|
517
639
|
/** Financial currency per symbol (financial_currency). */
|
|
518
640
|
export interface FinancialCurrency {
|
|
@@ -523,17 +645,19 @@ export interface FinancialCurrency {
|
|
|
523
645
|
/** Overnight quote (quote_overnight). */
|
|
524
646
|
export interface QuoteOvernight {
|
|
525
647
|
symbol?: string;
|
|
648
|
+
latestPrice?: number;
|
|
649
|
+
askPrice?: number;
|
|
650
|
+
askSize?: number;
|
|
651
|
+
bidPrice?: number;
|
|
652
|
+
bidSize?: number;
|
|
526
653
|
preClose?: number;
|
|
527
|
-
open?: number;
|
|
528
|
-
close?: number;
|
|
529
|
-
high?: number;
|
|
530
|
-
low?: number;
|
|
531
654
|
volume?: number;
|
|
532
655
|
amount?: number;
|
|
656
|
+
timestamp?: number;
|
|
657
|
+
tradingStatus?: number;
|
|
533
658
|
change?: number;
|
|
534
659
|
changeRate?: number;
|
|
535
|
-
|
|
536
|
-
endTime?: number;
|
|
660
|
+
amplitude?: number;
|
|
537
661
|
}
|
|
538
662
|
/** Single market-scanner tag. */
|
|
539
663
|
export interface MarketScannerTag {
|
|
@@ -541,11 +665,14 @@ export interface MarketScannerTag {
|
|
|
541
665
|
name?: string;
|
|
542
666
|
values?: string[];
|
|
543
667
|
}
|
|
544
|
-
/** Market
|
|
545
|
-
export interface
|
|
546
|
-
|
|
547
|
-
|
|
668
|
+
/** Market-scanner tag group (one entry per market). wire: market_scanner_tags returns array of these. */
|
|
669
|
+
export interface MarketScannerTagGroup {
|
|
670
|
+
market?: string;
|
|
671
|
+
multiTagField?: string;
|
|
672
|
+
tagList?: MarketScannerTag[];
|
|
548
673
|
}
|
|
674
|
+
/** @deprecated Use MarketScannerTagGroup[] instead. Kept for backwards compatibility. */
|
|
675
|
+
export type MarketScannerTags = MarketScannerTagGroup;
|
|
549
676
|
/** Fund contract info (fund_contracts). */
|
|
550
677
|
export interface FundContractInfo {
|
|
551
678
|
symbol?: string;
|