tigeropen 0.1.0 → 0.4.0
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 +489 -118
- package/dist/cjs/client/api-request.js +16 -11
- package/dist/cjs/client/api-response.js +23 -4
- package/dist/cjs/client/case-convert.js +35 -0
- package/dist/cjs/client/errors.js +0 -1
- package/dist/cjs/client/http-client.js +47 -22
- package/dist/cjs/client/index.js +6 -3
- package/dist/cjs/client/retry.js +0 -1
- package/dist/cjs/config/client-config.js +130 -50
- package/dist/cjs/config/config-parser.js +0 -1
- package/dist/cjs/config/domain.js +21 -3
- package/dist/cjs/config/index.js +3 -2
- package/dist/cjs/config/token-manager.js +0 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/logger/index.js +0 -1
- package/dist/cjs/logger/logger.js +0 -1
- package/dist/cjs/model/contract-helpers.js +0 -1
- package/dist/cjs/model/contract.js +1 -3
- package/dist/cjs/model/enums.js +89 -8
- package/dist/cjs/model/order-helpers.js +9 -10
- package/dist/cjs/model/order-status.js +46 -0
- package/dist/cjs/model/order.js +5 -3
- package/dist/cjs/model/position.js +1 -3
- package/dist/cjs/model/quote-requests.js +11 -0
- package/dist/cjs/model/quote.js +7 -0
- package/dist/cjs/model/trade-requests.js +13 -0
- package/dist/cjs/model/trade.js +2 -0
- package/dist/cjs/push/callbacks.js +0 -1
- package/dist/cjs/push/index.js +6 -4
- package/dist/cjs/push/pb/AssetData.js +208 -0
- package/dist/cjs/push/pb/KlineData.js +184 -0
- package/dist/cjs/push/pb/OptionTopData.js +427 -0
- package/dist/cjs/push/pb/OrderStatusData.js +592 -0
- package/dist/cjs/push/pb/OrderTransactionData.js +256 -0
- package/dist/cjs/push/pb/PositionData.js +316 -0
- package/dist/cjs/push/pb/PushData.js +219 -0
- package/dist/cjs/push/pb/QuoteBBOData.js +160 -0
- package/dist/cjs/push/pb/QuoteBasicData.js +329 -0
- package/dist/cjs/push/pb/QuoteData.js +507 -0
- package/dist/cjs/push/pb/QuoteDepthData.js +220 -0
- package/dist/cjs/push/pb/Request.js +278 -0
- package/dist/cjs/push/pb/Response.js +97 -0
- package/dist/cjs/push/pb/SocketCommon.js +86 -0
- package/dist/cjs/push/pb/StockTopData.js +199 -0
- package/dist/cjs/push/pb/TickData.js +202 -0
- package/dist/cjs/push/pb/TradeTickData.js +308 -0
- package/dist/cjs/push/pb/index.js +49 -0
- package/dist/cjs/push/proto-message.js +135 -0
- package/dist/cjs/push/push-client.js +361 -164
- package/dist/cjs/push/push-message.js +8 -61
- package/dist/cjs/push/varint.js +76 -0
- package/dist/cjs/quote/index.js +3 -3
- package/dist/cjs/quote/quote-client.js +440 -95
- package/dist/cjs/signer/index.js +0 -1
- package/dist/cjs/signer/sign-content.js +0 -1
- package/dist/cjs/signer/signer.js +10 -11
- package/dist/cjs/trade/index.js +0 -1
- package/dist/cjs/trade/trade-client.js +197 -63
- package/dist/esm/client/api-request.js +14 -9
- package/dist/esm/client/api-response.js +22 -4
- package/dist/esm/client/case-convert.js +31 -0
- package/dist/esm/client/errors.js +0 -1
- package/dist/esm/client/http-client.js +48 -23
- package/dist/esm/client/index.js +3 -3
- package/dist/esm/client/retry.js +0 -1
- package/dist/esm/config/client-config.js +131 -52
- package/dist/esm/config/config-parser.js +0 -1
- package/dist/esm/config/domain.js +20 -3
- package/dist/esm/config/index.js +2 -3
- package/dist/esm/config/token-manager.js +0 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/logger/index.js +0 -1
- package/dist/esm/logger/logger.js +0 -1
- package/dist/esm/model/contract-helpers.js +0 -1
- package/dist/esm/model/contract.js +1 -3
- package/dist/esm/model/enums.js +87 -7
- package/dist/esm/model/order-helpers.js +9 -10
- package/dist/esm/model/order-status.js +43 -0
- package/dist/esm/model/order.js +5 -3
- package/dist/esm/model/position.js +1 -3
- package/dist/esm/model/quote-requests.js +10 -0
- package/dist/esm/model/quote.js +6 -0
- package/dist/esm/model/trade-requests.js +12 -0
- package/dist/esm/model/trade.js +1 -0
- package/dist/esm/push/callbacks.js +0 -1
- package/dist/esm/push/index.js +4 -3
- package/dist/esm/push/pb/AssetData.js +205 -0
- package/dist/esm/push/pb/KlineData.js +181 -0
- package/dist/esm/push/pb/OptionTopData.js +424 -0
- package/dist/esm/push/pb/OrderStatusData.js +589 -0
- package/dist/esm/push/pb/OrderTransactionData.js +253 -0
- package/dist/esm/push/pb/PositionData.js +313 -0
- package/dist/esm/push/pb/PushData.js +216 -0
- package/dist/esm/push/pb/QuoteBBOData.js +157 -0
- package/dist/esm/push/pb/QuoteBasicData.js +326 -0
- package/dist/esm/push/pb/QuoteData.js +504 -0
- package/dist/esm/push/pb/QuoteDepthData.js +217 -0
- package/dist/esm/push/pb/Request.js +275 -0
- package/dist/esm/push/pb/Response.js +94 -0
- package/dist/esm/push/pb/SocketCommon.js +83 -0
- package/dist/esm/push/pb/StockTopData.js +196 -0
- package/dist/esm/push/pb/TickData.js +199 -0
- package/dist/esm/push/pb/TradeTickData.js +305 -0
- package/dist/esm/push/pb/index.js +25 -0
- package/dist/esm/push/proto-message.js +127 -0
- package/dist/esm/push/push-client.js +329 -165
- package/dist/esm/push/push-message.js +7 -57
- package/dist/esm/push/varint.js +72 -0
- package/dist/esm/quote/index.js +2 -3
- package/dist/esm/quote/quote-client.js +439 -95
- package/dist/esm/signer/index.js +0 -1
- package/dist/esm/signer/sign-content.js +0 -1
- package/dist/esm/signer/signer.js +10 -11
- package/dist/esm/trade/index.js +0 -1
- package/dist/esm/trade/trade-client.js +197 -63
- package/dist/types/client/api-request.d.ts +12 -12
- package/dist/types/client/api-response.d.ts +15 -8
- package/dist/types/client/case-convert.d.ts +16 -0
- package/dist/types/client/errors.d.ts +0 -1
- package/dist/types/client/http-client.d.ts +26 -15
- package/dist/types/client/index.d.ts +3 -3
- package/dist/types/client/retry.d.ts +0 -1
- package/dist/types/config/client-config.d.ts +29 -14
- package/dist/types/config/config-parser.d.ts +0 -1
- package/dist/types/config/domain.d.ts +9 -1
- package/dist/types/config/index.d.ts +2 -3
- package/dist/types/config/token-manager.d.ts +0 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/logger/index.d.ts +0 -1
- package/dist/types/logger/logger.d.ts +0 -1
- package/dist/types/model/contract-helpers.d.ts +0 -1
- package/dist/types/model/contract.d.ts +13 -30
- package/dist/types/model/enums.d.ts +60 -7
- package/dist/types/model/order-helpers.d.ts +21 -21
- package/dist/types/model/order-status.d.ts +14 -0
- package/dist/types/model/order.d.ts +101 -56
- package/dist/types/model/position.d.ts +26 -25
- package/dist/types/model/quote-requests.d.ts +344 -0
- package/dist/types/model/quote.d.ts +572 -0
- package/dist/types/model/trade-requests.d.ts +195 -0
- package/dist/types/model/trade.d.ts +235 -0
- package/dist/types/push/callbacks.d.ts +32 -52
- package/dist/types/push/index.d.ts +5 -4
- package/dist/types/push/pb/AssetData.d.ts +47 -0
- package/dist/types/push/pb/KlineData.d.ts +43 -0
- package/dist/types/push/pb/OptionTopData.d.ts +76 -0
- package/dist/types/push/pb/OrderStatusData.d.ts +100 -0
- package/dist/types/push/pb/OrderTransactionData.d.ts +51 -0
- package/dist/types/push/pb/PositionData.d.ts +63 -0
- package/dist/types/push/pb/PushData.d.ts +46 -0
- package/dist/types/push/pb/QuoteBBOData.d.ts +35 -0
- package/dist/types/push/pb/QuoteBasicData.d.ts +66 -0
- package/dist/types/push/pb/QuoteData.d.ts +94 -0
- package/dist/types/push/pb/QuoteDepthData.d.ts +37 -0
- package/dist/types/push/pb/Request.d.ts +44 -0
- package/dist/types/push/pb/Response.d.ts +30 -0
- package/dist/types/push/pb/SocketCommon.d.ts +64 -0
- package/dist/types/push/pb/StockTopData.d.ts +37 -0
- package/dist/types/push/pb/TickData.d.ts +44 -0
- package/dist/types/push/pb/TradeTickData.d.ts +53 -0
- package/dist/types/push/pb/index.d.ts +39 -0
- package/dist/types/push/proto-message.d.ts +33 -0
- package/dist/types/push/push-client.d.ts +100 -69
- package/dist/types/push/push-message.d.ts +7 -148
- package/dist/types/push/varint.d.ts +23 -0
- package/dist/types/quote/index.d.ts +2 -3
- package/dist/types/quote/quote-client.d.ts +154 -48
- package/dist/types/signer/index.d.ts +0 -1
- package/dist/types/signer/sign-content.d.ts +0 -1
- package/dist/types/signer/signer.d.ts +6 -7
- package/dist/types/trade/index.d.ts +0 -1
- package/dist/types/trade/trade-client.d.ts +106 -39
- package/package.json +12 -7
- package/dist/cjs/client/api-request.js.map +0 -1
- package/dist/cjs/client/api-response.js.map +0 -1
- package/dist/cjs/client/errors.js.map +0 -1
- package/dist/cjs/client/http-client.js.map +0 -1
- package/dist/cjs/client/index.js.map +0 -1
- package/dist/cjs/client/retry.js.map +0 -1
- package/dist/cjs/config/client-config.js.map +0 -1
- package/dist/cjs/config/config-parser.js.map +0 -1
- package/dist/cjs/config/domain.js.map +0 -1
- package/dist/cjs/config/index.js.map +0 -1
- package/dist/cjs/config/token-manager.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/logger/index.js.map +0 -1
- package/dist/cjs/logger/logger.js.map +0 -1
- package/dist/cjs/model/contract-helpers.js.map +0 -1
- package/dist/cjs/model/contract.js.map +0 -1
- package/dist/cjs/model/enums.js.map +0 -1
- package/dist/cjs/model/order-helpers.js.map +0 -1
- package/dist/cjs/model/order.js.map +0 -1
- package/dist/cjs/model/position.js.map +0 -1
- package/dist/cjs/push/callbacks.js.map +0 -1
- package/dist/cjs/push/index.js.map +0 -1
- package/dist/cjs/push/push-client.js.map +0 -1
- package/dist/cjs/push/push-message.js.map +0 -1
- package/dist/cjs/quote/index.js.map +0 -1
- package/dist/cjs/quote/quote-client.js.map +0 -1
- package/dist/cjs/signer/index.js.map +0 -1
- package/dist/cjs/signer/sign-content.js.map +0 -1
- package/dist/cjs/signer/signer.js.map +0 -1
- package/dist/cjs/trade/index.js.map +0 -1
- package/dist/cjs/trade/trade-client.js.map +0 -1
- package/dist/esm/client/api-request.js.map +0 -1
- package/dist/esm/client/api-response.js.map +0 -1
- package/dist/esm/client/errors.js.map +0 -1
- package/dist/esm/client/http-client.js.map +0 -1
- package/dist/esm/client/index.js.map +0 -1
- package/dist/esm/client/retry.js.map +0 -1
- package/dist/esm/config/client-config.js.map +0 -1
- package/dist/esm/config/config-parser.js.map +0 -1
- package/dist/esm/config/domain.js.map +0 -1
- package/dist/esm/config/index.js.map +0 -1
- package/dist/esm/config/token-manager.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/logger/index.js.map +0 -1
- package/dist/esm/logger/logger.js.map +0 -1
- package/dist/esm/model/contract-helpers.js.map +0 -1
- package/dist/esm/model/contract.js.map +0 -1
- package/dist/esm/model/enums.js.map +0 -1
- package/dist/esm/model/order-helpers.js.map +0 -1
- package/dist/esm/model/order.js.map +0 -1
- package/dist/esm/model/position.js.map +0 -1
- package/dist/esm/push/callbacks.js.map +0 -1
- package/dist/esm/push/index.js.map +0 -1
- package/dist/esm/push/push-client.js.map +0 -1
- package/dist/esm/push/push-message.js.map +0 -1
- package/dist/esm/quote/index.js.map +0 -1
- package/dist/esm/quote/quote-client.js.map +0 -1
- package/dist/esm/signer/index.js.map +0 -1
- package/dist/esm/signer/sign-content.js.map +0 -1
- package/dist/esm/signer/signer.js.map +0 -1
- package/dist/esm/trade/index.js.map +0 -1
- package/dist/esm/trade/trade-client.js.map +0 -1
- package/dist/types/client/api-request.d.ts.map +0 -1
- package/dist/types/client/api-response.d.ts.map +0 -1
- package/dist/types/client/errors.d.ts.map +0 -1
- package/dist/types/client/http-client.d.ts.map +0 -1
- package/dist/types/client/index.d.ts.map +0 -1
- package/dist/types/client/retry.d.ts.map +0 -1
- package/dist/types/config/client-config.d.ts.map +0 -1
- package/dist/types/config/config-parser.d.ts.map +0 -1
- package/dist/types/config/domain.d.ts.map +0 -1
- package/dist/types/config/index.d.ts.map +0 -1
- package/dist/types/config/token-manager.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/logger/index.d.ts.map +0 -1
- package/dist/types/logger/logger.d.ts.map +0 -1
- package/dist/types/model/contract-helpers.d.ts.map +0 -1
- package/dist/types/model/contract.d.ts.map +0 -1
- package/dist/types/model/enums.d.ts.map +0 -1
- package/dist/types/model/order-helpers.d.ts.map +0 -1
- package/dist/types/model/order.d.ts.map +0 -1
- package/dist/types/model/position.d.ts.map +0 -1
- package/dist/types/push/callbacks.d.ts.map +0 -1
- package/dist/types/push/index.d.ts.map +0 -1
- package/dist/types/push/push-client.d.ts.map +0 -1
- package/dist/types/push/push-message.d.ts.map +0 -1
- package/dist/types/quote/index.d.ts.map +0 -1
- package/dist/types/quote/quote-client.d.ts.map +0 -1
- package/dist/types/signer/index.d.ts.map +0 -1
- package/dist/types/signer/sign-content.d.ts.map +0 -1
- package/dist/types/signer/signer.d.ts.map +0 -1
- package/dist/types/trade/index.d.ts.map +0 -1
- package/dist/types/trade/trade-client.d.ts.map +0 -1
|
@@ -1,34 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 推送消息类型定义
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* 仅保留 SubjectType 枚举,用于订阅/退订 API。
|
|
5
|
+
* JSON 消息类型定义和序列化函数已移除,改用 Protobuf 协议。
|
|
6
6
|
*/
|
|
7
|
-
/** 推送消息类型 */
|
|
8
|
-
export declare enum MessageType {
|
|
9
|
-
Connect = "connect",
|
|
10
|
-
Connected = "connected",
|
|
11
|
-
Disconnect = "disconnect",
|
|
12
|
-
Heartbeat = "heartbeat",
|
|
13
|
-
Kickout = "kickout",
|
|
14
|
-
Error = "error",
|
|
15
|
-
Subscribe = "subscribe",
|
|
16
|
-
Unsubscribe = "unsubscribe",
|
|
17
|
-
Quote = "quote",
|
|
18
|
-
Tick = "tick",
|
|
19
|
-
Depth = "depth",
|
|
20
|
-
Option = "option",
|
|
21
|
-
Future = "future",
|
|
22
|
-
Kline = "kline",
|
|
23
|
-
StockTop = "stock_top",
|
|
24
|
-
OptionTop = "option_top",
|
|
25
|
-
FullTick = "full_tick",
|
|
26
|
-
QuoteBBO = "quote_bbo",
|
|
27
|
-
Asset = "asset",
|
|
28
|
-
Position = "position",
|
|
29
|
-
Order = "order",
|
|
30
|
-
Transaction = "transaction"
|
|
31
|
-
}
|
|
32
7
|
/** 订阅主题类型 */
|
|
33
8
|
export declare enum SubjectType {
|
|
34
9
|
Quote = "quote",
|
|
@@ -41,128 +16,12 @@ export declare enum SubjectType {
|
|
|
41
16
|
OptionTop = "option_top",
|
|
42
17
|
FullTick = "full_tick",
|
|
43
18
|
QuoteBBO = "quote_bbo",
|
|
19
|
+
/** 加密货币实时行情 (v0.4.0) */
|
|
20
|
+
Cc = "cc",
|
|
21
|
+
/** 市场状态 (v0.4.0) */
|
|
22
|
+
Market = "market",
|
|
44
23
|
Asset = "asset",
|
|
45
24
|
Position = "position",
|
|
46
25
|
Order = "order",
|
|
47
26
|
Transaction = "transaction"
|
|
48
27
|
}
|
|
49
|
-
/** 推送消息通用结构 */
|
|
50
|
-
export interface PushMessage {
|
|
51
|
-
type: MessageType;
|
|
52
|
-
subject?: SubjectType | string;
|
|
53
|
-
data?: unknown;
|
|
54
|
-
}
|
|
55
|
-
/** 连接认证请求 */
|
|
56
|
-
export interface ConnectRequest {
|
|
57
|
-
tigerId: string;
|
|
58
|
-
sign: string;
|
|
59
|
-
timestamp: string;
|
|
60
|
-
version: string;
|
|
61
|
-
}
|
|
62
|
-
/** 订阅/退订请求 */
|
|
63
|
-
export interface SubscribeRequest {
|
|
64
|
-
subject: SubjectType;
|
|
65
|
-
symbols?: string[];
|
|
66
|
-
account?: string;
|
|
67
|
-
market?: string;
|
|
68
|
-
}
|
|
69
|
-
/** 行情推送数据 */
|
|
70
|
-
export interface QuoteData {
|
|
71
|
-
symbol: string;
|
|
72
|
-
latestPrice?: number;
|
|
73
|
-
preClose?: number;
|
|
74
|
-
open?: number;
|
|
75
|
-
high?: number;
|
|
76
|
-
low?: number;
|
|
77
|
-
volume?: number;
|
|
78
|
-
amount?: number;
|
|
79
|
-
timestamp?: number;
|
|
80
|
-
}
|
|
81
|
-
/** 逐笔成交推送数据 */
|
|
82
|
-
export interface TickData {
|
|
83
|
-
symbol: string;
|
|
84
|
-
price: number;
|
|
85
|
-
volume: number;
|
|
86
|
-
type?: string;
|
|
87
|
-
timestamp?: number;
|
|
88
|
-
}
|
|
89
|
-
/** 价格档位 */
|
|
90
|
-
export interface PriceLevel {
|
|
91
|
-
price: number;
|
|
92
|
-
volume: number;
|
|
93
|
-
count?: number;
|
|
94
|
-
}
|
|
95
|
-
/** 深度行情推送数据 */
|
|
96
|
-
export interface DepthData {
|
|
97
|
-
symbol: string;
|
|
98
|
-
asks?: PriceLevel[];
|
|
99
|
-
bids?: PriceLevel[];
|
|
100
|
-
}
|
|
101
|
-
/** K 线推送数据 */
|
|
102
|
-
export interface KlineData {
|
|
103
|
-
symbol: string;
|
|
104
|
-
open: number;
|
|
105
|
-
high: number;
|
|
106
|
-
low: number;
|
|
107
|
-
close: number;
|
|
108
|
-
volume: number;
|
|
109
|
-
timestamp?: number;
|
|
110
|
-
}
|
|
111
|
-
/** 资产推送数据 */
|
|
112
|
-
export interface AssetData {
|
|
113
|
-
account: string;
|
|
114
|
-
netLiquidation?: number;
|
|
115
|
-
equityWithLoan?: number;
|
|
116
|
-
cashBalance?: number;
|
|
117
|
-
buyingPower?: number;
|
|
118
|
-
currency?: string;
|
|
119
|
-
}
|
|
120
|
-
/** 持仓推送数据 */
|
|
121
|
-
export interface PositionData {
|
|
122
|
-
account: string;
|
|
123
|
-
symbol: string;
|
|
124
|
-
secType?: string;
|
|
125
|
-
quantity: number;
|
|
126
|
-
averageCost?: number;
|
|
127
|
-
marketPrice?: number;
|
|
128
|
-
marketValue?: number;
|
|
129
|
-
unrealizedPnl?: number;
|
|
130
|
-
}
|
|
131
|
-
/** 订单推送数据 */
|
|
132
|
-
export interface OrderData {
|
|
133
|
-
account: string;
|
|
134
|
-
id?: number;
|
|
135
|
-
orderId?: number;
|
|
136
|
-
symbol: string;
|
|
137
|
-
action?: string;
|
|
138
|
-
orderType?: string;
|
|
139
|
-
quantity?: number;
|
|
140
|
-
limitPrice?: number;
|
|
141
|
-
status?: string;
|
|
142
|
-
filled?: number;
|
|
143
|
-
avgFillPrice?: number;
|
|
144
|
-
}
|
|
145
|
-
/** 成交推送数据 */
|
|
146
|
-
export interface TransactionData {
|
|
147
|
-
account: string;
|
|
148
|
-
id?: number;
|
|
149
|
-
orderId?: number;
|
|
150
|
-
symbol: string;
|
|
151
|
-
action?: string;
|
|
152
|
-
price?: number;
|
|
153
|
-
quantity?: number;
|
|
154
|
-
timestamp?: number;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* 创建推送消息
|
|
158
|
-
*/
|
|
159
|
-
export declare function createPushMessage(type: MessageType, subject?: SubjectType | string, data?: unknown): PushMessage;
|
|
160
|
-
/**
|
|
161
|
-
* 序列化推送消息为 JSON 字符串
|
|
162
|
-
*/
|
|
163
|
-
export declare function serializeMessage(msg: PushMessage): string;
|
|
164
|
-
/**
|
|
165
|
-
* 反序列化 JSON 字符串为推送消息
|
|
166
|
-
*/
|
|
167
|
-
export declare function deserializeMessage(data: string): PushMessage;
|
|
168
|
-
//# sourceMappingURL=push-message.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Varint32 帧编解码器
|
|
3
|
+
*
|
|
4
|
+
* 兼容 Netty 的 ProtobufVarint32FrameDecoder / ProtobufVarint32LengthFieldPrepender。
|
|
5
|
+
* 每个字节低 7 位存数据,最高位为延续标志(1=后续还有字节,0=最后一个字节),最大 5 字节。
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 在 protobuf 字节前添加 varint32 长度前缀
|
|
9
|
+
*
|
|
10
|
+
* @param data - 待编码的 protobuf 二进制数据
|
|
11
|
+
* @returns varint32 长度前缀 + 原始数据
|
|
12
|
+
*/
|
|
13
|
+
export declare function encodeVarint32(data: Uint8Array): Uint8Array;
|
|
14
|
+
/**
|
|
15
|
+
* 从缓冲区解码一个 varint32 帧
|
|
16
|
+
*
|
|
17
|
+
* @param buffer - 包含 varint32 长度前缀 + protobuf 数据的缓冲区
|
|
18
|
+
* @returns 解码结果 `{ message, remaining }`,数据不足时返回 `null`
|
|
19
|
+
*/
|
|
20
|
+
export declare function decodeVarint32(buffer: Uint8Array): {
|
|
21
|
+
message: Uint8Array;
|
|
22
|
+
remaining: Uint8Array;
|
|
23
|
+
} | null;
|
|
@@ -1,59 +1,165 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* QuoteClient
|
|
3
|
-
*
|
|
2
|
+
* QuoteClient — market-data client.
|
|
3
|
+
*
|
|
4
|
+
* All methods return strongly-typed responses from the `model` package.
|
|
5
|
+
* Request parameters are written in camelCase in TypeScript and are
|
|
6
|
+
* converted to snake_case on the wire automatically.
|
|
4
7
|
*/
|
|
5
8
|
import type { HttpClient } from '../client/http-client';
|
|
9
|
+
import type { MarketState, Brief, Kline, KlineItem, Timeline, TradeTick, Depth, OptionExpiration, OptionChain, FutureExchange, FutureContractInfo, FutureQuote, FutureKline, FutureKlineItem, FinancialDailyItem, FinancialReportItem, CorporateAction, CapitalFlow, CapitalDistribution, ScannerResult, QuotePermission, FinancialDailyRequest, FinancialReportRequest, CorporateActionRequest, FutureKlineRequest, MarketScannerRequest, SymbolName, TradeMeta, StockDetail, StockBroker, StockIndustry, TradeRankItem, ShortInterest, KlineQuota, OptionAnalysis, OptionSymbol, FutureMainContractHistory, FutureTradingTime, FutureTradeTickItem, FutureDepth, WarrantBrief, WarrantFilterResult, IndustryItem, IndustryStock, TradingCalendarItem, ExchangeRate, FinancialCurrency, QuoteOvernight, MarketScannerTags, FundContractInfo, FundQuote, FundHistoryQuote } from '../model/quote';
|
|
10
|
+
import type { BriefRequest, DepthQuoteRequest, TradeTickRequest, FutureBriefRequest, SymbolsRequest, TradeMetasRequest, StockDetailsRequest, StockDelayBriefsRequest, BarsRequest, BarsByPageRequest, TimelineHistoryRequest, TradeRankRequest, ShortInterestRequest, StockBrokerRequest, StockFundamentalRequest, StockIndustryRequest, KlineQuotaRequest, QuotePermissionRequest, OptionBarsRequest, OptionTradeTicksRequest, OptionTimelineRequest, OptionDepthRequest, OptionSymbolsRequest, OptionAnalysisRequest, FutureContractSingleRequest, AllFutureContractsRequest, FutureContinuousContractsRequest, FutureHistoryMainContractRequest, FutureBarsRequest, FutureBarsByPageRequest, FutureTradeTicksRequest, FutureDepthRequest, FutureTradingTimesRequest, FundSymbolsRequest, FundContractsRequest, FundQuoteRequest, FundHistoryQuoteRequest, WarrantBriefsRequest, WarrantFilterRequest, IndustryListRequest, IndustryStocksRequest, TradingCalendarRequest, FinancialExchangeRateRequest, FinancialCurrencyRequest, MarketScannerTagsRequest, QuoteOvernightRequest } from '../model/quote-requests';
|
|
6
11
|
/**
|
|
7
|
-
*
|
|
12
|
+
* Parse an OCC-style option identifier like "AAPL 260619C00150000"
|
|
13
|
+
* into its component parts.
|
|
8
14
|
*/
|
|
15
|
+
export declare function parseOptionIdentifier(identifier: string): {
|
|
16
|
+
symbol: string;
|
|
17
|
+
expiryMs: number;
|
|
18
|
+
right: string;
|
|
19
|
+
strike: number;
|
|
20
|
+
};
|
|
21
|
+
/** Market data client wrapping all quote-related APIs. */
|
|
9
22
|
export declare class QuoteClient {
|
|
10
23
|
private httpClient;
|
|
11
24
|
constructor(httpClient: HttpClient);
|
|
25
|
+
private callInto;
|
|
12
26
|
/**
|
|
13
|
-
*
|
|
27
|
+
* Some endpoints return either a list or a single object depending on the
|
|
28
|
+
* server response shape (future_contract_by_contract_code /
|
|
29
|
+
* future_continuous_contracts). Unify into an array.
|
|
14
30
|
*/
|
|
15
|
-
private
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
|
|
31
|
+
private callIntoListOrObject;
|
|
32
|
+
/** Unwrap server {"items":[...]} envelope. */
|
|
33
|
+
private callIntoItems;
|
|
34
|
+
getMarketState(market: string): Promise<MarketState[]>;
|
|
35
|
+
/** Real-time stock briefs. wire: quote_real_time */
|
|
36
|
+
getBrief(req: BriefRequest): Promise<Brief[]>;
|
|
37
|
+
getKline(symbol: string, period: string): Promise<Kline[]>;
|
|
38
|
+
getTimeline(symbols: string[]): Promise<Timeline[]>;
|
|
39
|
+
/** Tick-by-tick trades. wire: trade_tick */
|
|
40
|
+
getTradeTick(req: TradeTickRequest): Promise<TradeTick[]>;
|
|
41
|
+
/** Depth snapshot. wire: quote_depth */
|
|
42
|
+
getQuoteDepth(req: DepthQuoteRequest): Promise<Depth[]>;
|
|
43
|
+
getOptionExpiration(symbol: string): Promise<OptionExpiration[]>;
|
|
44
|
+
/** Option chain; `expiry` is "YYYY-MM-DD". */
|
|
45
|
+
getOptionChain(symbol: string, expiry: string): Promise<OptionChain[]>;
|
|
46
|
+
getOptionBrief(identifiers: string[]): Promise<Brief[]>;
|
|
47
|
+
getOptionKline(identifier: string, period: string): Promise<Kline[]>;
|
|
48
|
+
getFutureExchange(): Promise<FutureExchange[]>;
|
|
49
|
+
getFutureContracts(exchange: string): Promise<FutureContractInfo[]>;
|
|
50
|
+
/** Real-time futures quotes. wire: future_real_time_quote */
|
|
51
|
+
getFutureRealTimeQuote(req: FutureBriefRequest): Promise<FutureQuote[]>;
|
|
52
|
+
/** Futures K-line; use -1 for unbounded beginTime / endTime. */
|
|
53
|
+
getFutureKline(req: FutureKlineRequest): Promise<FutureKline[]>;
|
|
54
|
+
getFinancialDaily(req: FinancialDailyRequest): Promise<FinancialDailyItem[]>;
|
|
55
|
+
getFinancialReport(req: FinancialReportRequest): Promise<FinancialReportItem[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Corporate actions. Server returns {symbol: [...]}, this method flattens into a single list.
|
|
58
|
+
*/
|
|
59
|
+
getCorporateAction(req: CorporateActionRequest): Promise<CorporateAction[]>;
|
|
60
|
+
getCapitalFlow(symbol: string, market: string, period: string): Promise<CapitalFlow | undefined>;
|
|
61
|
+
getCapitalDistribution(symbol: string, market: string): Promise<CapitalDistribution | undefined>;
|
|
62
|
+
marketScanner(req: MarketScannerRequest): Promise<ScannerResult | undefined>;
|
|
63
|
+
grabQuotePermission(): Promise<QuotePermission[]>;
|
|
64
|
+
/** All symbol codes (string list). wire: all_symbols */
|
|
65
|
+
getSymbols(req: SymbolsRequest): Promise<string[]>;
|
|
66
|
+
/** All symbols with names. wire: all_symbol_names */
|
|
67
|
+
getSymbolNames(req: SymbolsRequest): Promise<SymbolName[]>;
|
|
68
|
+
/** Trade meta (lot size / tick size). wire: quote_stock_trade */
|
|
69
|
+
getTradeMetas(req: TradeMetasRequest): Promise<TradeMeta[]>;
|
|
70
|
+
/** Stock details. wire: stock_detail. Server returns {items:[...]}. */
|
|
71
|
+
getStockDetails(req: StockDetailsRequest): Promise<StockDetail[]>;
|
|
72
|
+
/** Delayed stock briefs. wire: quote_delay */
|
|
73
|
+
getStockDelayBriefs(req: StockDelayBriefsRequest): Promise<Brief[]>;
|
|
74
|
+
/** K-line bars (full request). wire: kline */
|
|
75
|
+
getBars(req: BarsRequest): Promise<Kline[]>;
|
|
76
|
+
/**
|
|
77
|
+
* Client-side paginated K-line fetch — loops over getBars until TotalSize
|
|
78
|
+
* bars are collected. Items are returned oldest-first, matching
|
|
79
|
+
* Python/Go get_bars_by_page behaviour.
|
|
80
|
+
*/
|
|
81
|
+
getBarsByPage(req: BarsByPageRequest): Promise<KlineItem[]>;
|
|
82
|
+
/** Historical intraday timeline. wire: history_timeline */
|
|
83
|
+
getTimelineHistory(req: TimelineHistoryRequest): Promise<Timeline[]>;
|
|
84
|
+
/** Trade rank (top movers / volume). wire: trade_rank */
|
|
85
|
+
getTradeRank(req: TradeRankRequest): Promise<TradeRankItem[]>;
|
|
86
|
+
/** Short interest / shortable. wire: quote_shortable_stocks */
|
|
87
|
+
getShortInterest(req: ShortInterestRequest): Promise<ShortInterest[]>;
|
|
88
|
+
/** Broker queue. wire: stock_broker */
|
|
89
|
+
getStockBroker(req: StockBrokerRequest): Promise<StockBroker | undefined>;
|
|
90
|
+
/** Stock fundamentals (server returns grouped map). wire: stock_fundamental */
|
|
91
|
+
getStockFundamental(req: StockFundamentalRequest): Promise<Record<string, unknown>>;
|
|
92
|
+
/** Stock industry classification (array). wire: stock_industry */
|
|
93
|
+
getStockIndustry(req: StockIndustryRequest): Promise<StockIndustry[]>;
|
|
94
|
+
/** Quote permission detail. wire: get_quote_permission */
|
|
95
|
+
getQuotePermission(req: QuotePermissionRequest): Promise<QuotePermission[]>;
|
|
96
|
+
/** K-line quota usage. wire: kline_quota */
|
|
97
|
+
getKlineQuota(req: KlineQuotaRequest): Promise<KlineQuota[]>;
|
|
98
|
+
/** Option K-line. wire: option_kline (v2.0) */
|
|
99
|
+
getOptionBars(req: OptionBarsRequest): Promise<Kline[]>;
|
|
100
|
+
/** Option tick trades. wire: option_trade_tick */
|
|
101
|
+
getOptionTradeTicks(req: OptionTradeTicksRequest): Promise<TradeTick[]>;
|
|
102
|
+
/** Option intraday timeline. wire: option_timeline */
|
|
103
|
+
getOptionTimeline(req: OptionTimelineRequest): Promise<Timeline[]>;
|
|
104
|
+
/** Option depth. wire: option_depth */
|
|
105
|
+
getOptionDepth(req: OptionDepthRequest): Promise<Depth[]>;
|
|
106
|
+
/** Available option symbols. wire: option_symbol */
|
|
107
|
+
getOptionSymbols(req: OptionSymbolsRequest): Promise<OptionSymbol[]>;
|
|
108
|
+
/** Option analysis (volatility). wire: option_analysis */
|
|
109
|
+
getOptionAnalysis(req: OptionAnalysisRequest): Promise<OptionAnalysis[]>;
|
|
110
|
+
/** Single futures contract by code. wire: future_contract_by_contract_code */
|
|
111
|
+
getFutureContract(req: FutureContractSingleRequest): Promise<FutureContractInfo[]>;
|
|
112
|
+
/** All futures contracts. wire: future_contracts */
|
|
113
|
+
getAllFutureContracts(req: AllFutureContractsRequest): Promise<FutureContractInfo[]>;
|
|
114
|
+
/** Current main contract. wire: future_current_contract */
|
|
115
|
+
getCurrentFutureContract(req: FutureContractSingleRequest): Promise<FutureContractInfo | undefined>;
|
|
116
|
+
/** Continuous main contracts. wire: future_continuous_contracts */
|
|
117
|
+
getFutureContinuousContracts(req: FutureContinuousContractsRequest): Promise<FutureContractInfo[]>;
|
|
118
|
+
/** Historical main contracts. wire: future_main_contract */
|
|
119
|
+
getFutureHistoryMainContract(req: FutureHistoryMainContractRequest): Promise<FutureMainContractHistory[]>;
|
|
120
|
+
/**
|
|
121
|
+
* Futures K-line (full request with index pagination). wire: future_kline
|
|
122
|
+
* begin_time / end_time default to -1 when unset (server requires them present).
|
|
123
|
+
*/
|
|
124
|
+
getFutureBars(req: FutureBarsRequest): Promise<FutureKline[]>;
|
|
125
|
+
/** Client-side paginated futures K-line fetch. */
|
|
126
|
+
getFutureBarsByPage(req: FutureBarsByPageRequest): Promise<FutureKlineItem[]>;
|
|
127
|
+
/** Futures tick trades. wire: future_tick (API v3.0) */
|
|
128
|
+
getFutureTradeTicks(req: FutureTradeTicksRequest): Promise<FutureTradeTickItem[]>;
|
|
129
|
+
/** Futures depth. wire: future_depth */
|
|
130
|
+
getFutureDepth(req: FutureDepthRequest): Promise<FutureDepth[]>;
|
|
131
|
+
/** Futures trading times (single-object response). wire: future_trading_date */
|
|
132
|
+
getFutureTradingTimes(req: FutureTradingTimesRequest): Promise<FutureTradingTime | undefined>;
|
|
133
|
+
/** Fund symbols. wire: fund_all_symbols */
|
|
134
|
+
getFundSymbols(req: FundSymbolsRequest): Promise<string[]>;
|
|
135
|
+
/** Fund contracts. wire: fund_contracts */
|
|
136
|
+
getFundContracts(req: FundContractsRequest): Promise<FundContractInfo[]>;
|
|
137
|
+
/** Fund real-time NAV. wire: fund_quote */
|
|
138
|
+
getFundQuote(req: FundQuoteRequest): Promise<FundQuote[]>;
|
|
139
|
+
/** Fund historical NAV. wire: fund_history_quote */
|
|
140
|
+
getFundHistoryQuote(req: FundHistoryQuoteRequest): Promise<FundHistoryQuote[]>;
|
|
141
|
+
/** Warrant briefs. wire: warrant_briefs */
|
|
142
|
+
getWarrantBriefs(req: WarrantBriefsRequest): Promise<WarrantBrief[]>;
|
|
143
|
+
/** Warrant filter (paged). wire: warrant_filter */
|
|
144
|
+
getWarrantFilter(req: WarrantFilterRequest): Promise<WarrantFilterResult | undefined>;
|
|
145
|
+
/** Industry list. wire: industry_list */
|
|
146
|
+
getIndustryList(req: IndustryListRequest): Promise<IndustryItem[]>;
|
|
147
|
+
/** Stocks inside an industry. wire: industry_stock_list */
|
|
148
|
+
getIndustryStocks(req: IndustryStocksRequest): Promise<IndustryStock[]>;
|
|
149
|
+
/** Corporate split (flattened). wire: corporate_action (action_type=split) */
|
|
150
|
+
getCorporateSplit(req: CorporateActionRequest): Promise<CorporateAction[]>;
|
|
151
|
+
/** Corporate dividend (flattened). wire: corporate_action (action_type=dividend) */
|
|
152
|
+
getCorporateDividend(req: CorporateActionRequest): Promise<CorporateAction[]>;
|
|
153
|
+
/** Corporate earnings calendar (flattened). wire: corporate_action (action_type=earning) */
|
|
154
|
+
getCorporateEarningsCalendar(req: CorporateActionRequest): Promise<CorporateAction[]>;
|
|
155
|
+
/** Financial currency per symbol. wire: financial_currency */
|
|
156
|
+
getFinancialCurrency(req: FinancialCurrencyRequest): Promise<FinancialCurrency[]>;
|
|
157
|
+
/** FX rates. wire: financial_exchange_rate */
|
|
158
|
+
getFinancialExchangeRate(req: FinancialExchangeRateRequest): Promise<ExchangeRate[]>;
|
|
159
|
+
/** Trading calendar. wire: trading_calendar */
|
|
160
|
+
getTradingCalendar(req: TradingCalendarRequest): Promise<TradingCalendarItem[]>;
|
|
161
|
+
/** Available market-scanner tags. wire: market_scanner_tags */
|
|
162
|
+
getMarketScannerTags(req: MarketScannerTagsRequest): Promise<MarketScannerTags | undefined>;
|
|
163
|
+
/** Overnight quote. wire: quote_overnight */
|
|
164
|
+
getQuoteOvernight(req: QuoteOvernightRequest): Promise<QuoteOvernight[]>;
|
|
58
165
|
}
|
|
59
|
-
//# sourceMappingURL=quote-client.d.ts.map
|
|
@@ -26,12 +26,11 @@ export declare function loadPrivateKey(keyStr: string): KeyObject;
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function signWithRSA(privateKeyStr: string, content: string): string;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Verify a SHA1WithRSA signature using an RSA public key.
|
|
30
30
|
*
|
|
31
|
-
* @param
|
|
32
|
-
* @param content -
|
|
33
|
-
* @param
|
|
34
|
-
* @returns
|
|
31
|
+
* @param publicKeyBase64 - Base64-encoded public key (DER / PKCS#1 or SPKI)
|
|
32
|
+
* @param content - Original content that was signed
|
|
33
|
+
* @param signatureBase64 - Base64-encoded signature
|
|
34
|
+
* @returns Whether the signature is valid
|
|
35
35
|
*/
|
|
36
|
-
export declare function verifyWithRSA(
|
|
37
|
-
//# sourceMappingURL=signer.d.ts.map
|
|
36
|
+
export declare function verifyWithRSA(publicKeyBase64: string, content: string, signatureBase64: string): boolean;
|
|
@@ -1,49 +1,116 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* TradeClient
|
|
3
|
-
*
|
|
2
|
+
* TradeClient — trading client.
|
|
3
|
+
*
|
|
4
|
+
* All methods return strongly-typed responses; request parameters are
|
|
5
|
+
* written in camelCase in TypeScript and converted to snake_case on the wire.
|
|
6
|
+
*
|
|
7
|
+
* v0.4.0: 所有查询类方法改为 Request 对象签名(OrdersRequest 等),补齐 17
|
|
8
|
+
* 个新方法(账户管理 / 资产分析 / 资金调拨 / 持仓划转等)。
|
|
4
9
|
*/
|
|
5
10
|
import type { HttpClient } from '../client/http-client';
|
|
6
|
-
import type { Order } from '../model/order';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
import type { OrderRequest, Order } from '../model/order';
|
|
12
|
+
import type { Contract } from '../model/contract';
|
|
13
|
+
import type { Position } from '../model/position';
|
|
14
|
+
import type { Asset, PrimeAsset, PreviewResult, PlaceOrderResult, OrderIdResult, Transaction, ManagedAccount, AnalyticsAsset, AggregateAssets, EstimateTradableQuantity, ForexOrderResult, SegmentFund, SegmentFundHistoryItem, FundDetails, FundingHistoryItem, PositionTransferRecord, PositionTransferDetail, PositionTransferExternalRecord } from '../model/trade';
|
|
15
|
+
import type { OrdersRequest, GetOrderRequest, OrderTransactionsRequest, PositionsRequest, AssetsRequest, ManagedAccountsRequest, DerivativeContractsRequest, AnalyticsAssetRequest, AggregateAssetsRequest, EstimateTradableQuantityRequest, ForexOrderRequest, SegmentFundRequest, FundDetailsRequest, FundingHistoryRequest, PositionTransferRequest, PositionTransferRecordsRequest, PositionTransferDetailRequest, PositionTransferExternalRecordsRequest } from '../model/trade-requests';
|
|
16
|
+
/** Trading client wrapping all trade-related APIs. */
|
|
10
17
|
export declare class TradeClient {
|
|
11
18
|
private httpClient;
|
|
12
19
|
private account;
|
|
13
20
|
constructor(httpClient: HttpClient, account: string);
|
|
21
|
+
private callInto;
|
|
22
|
+
/** Strip `{items: [...]}` envelope used by most trade read endpoints. */
|
|
23
|
+
private callIntoItems;
|
|
24
|
+
getContract(symbol: string, secType: string): Promise<Contract[]>;
|
|
25
|
+
getContracts(symbols: string[], secType: string): Promise<Contract[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Derivative contracts (OPT / WAR / IOPT only).
|
|
28
|
+
* `symbol` is the underlying (e.g. "AAPL"); `expiry` is "YYYYMMDD".
|
|
29
|
+
*/
|
|
30
|
+
getQuoteContract(symbol: string, secType: string, expiry: string): Promise<Contract[]>;
|
|
31
|
+
placeOrder(order: OrderRequest): Promise<PlaceOrderResult | undefined>;
|
|
32
|
+
previewOrder(order: OrderRequest): Promise<PreviewResult | undefined>;
|
|
33
|
+
modifyOrder(id: number, order: OrderRequest): Promise<OrderIdResult | undefined>;
|
|
34
|
+
cancelOrder(id: number): Promise<OrderIdResult | undefined>;
|
|
35
|
+
/**
|
|
36
|
+
* Query all historical orders. v0.4.0: optional OrdersRequest for filtering.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Default (unfiltered)
|
|
40
|
+
* await tc.getOrders();
|
|
41
|
+
* // Filter by status
|
|
42
|
+
* await tc.getOrders({ states: ['Filled'], limit: 100 });
|
|
43
|
+
*/
|
|
44
|
+
getOrders(req?: OrdersRequest): Promise<Order[]>;
|
|
45
|
+
/** Query active (open) orders. v0.4.0: supports ParentId to filter attached legs. */
|
|
46
|
+
getActiveOrders(req?: OrdersRequest): Promise<Order[]>;
|
|
47
|
+
/** Query inactive/cancelled orders. */
|
|
48
|
+
getInactiveOrders(req?: OrdersRequest): Promise<Order[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Query filled orders. v0.4.0 BREAKING: signature changed from positional
|
|
51
|
+
* (startDateMs, endDateMs) to OrdersRequest object.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* // Last 30 days
|
|
55
|
+
* const now = Date.now();
|
|
56
|
+
* await tc.getFilledOrders({ startDate: now - 30*24*3600*1000, endDate: now });
|
|
57
|
+
*/
|
|
58
|
+
getFilledOrders(req?: OrdersRequest): Promise<Order[]>;
|
|
59
|
+
/**
|
|
60
|
+
* Get a single order by ID (v0.4.0 new).
|
|
61
|
+
* Wire method: `orders` with id/order_id param; server returns a single Order object
|
|
62
|
+
* (not `{items:[]}` envelope).
|
|
63
|
+
*
|
|
64
|
+
* Returns `undefined` if no match.
|
|
65
|
+
*/
|
|
66
|
+
getOrder(req: GetOrderRequest): Promise<Order | undefined>;
|
|
67
|
+
/**
|
|
68
|
+
* Query order transaction details. v0.4.0 BREAKING: all fields now optional
|
|
69
|
+
* (previously symbol/secType required).
|
|
70
|
+
*/
|
|
71
|
+
getOrderTransactions(req: OrderTransactionsRequest): Promise<Transaction[]>;
|
|
72
|
+
/** Query positions. v0.4.0: supports Symbol / SecType / Currency / Market filters. */
|
|
73
|
+
getPositions(req?: PositionsRequest): Promise<Position[]>;
|
|
74
|
+
/** Query assets. v0.4.0: supports sub-account list and aggregation options. */
|
|
75
|
+
getAssets(req?: AssetsRequest): Promise<Asset[]>;
|
|
76
|
+
/** Query prime assets. v0.4.0: takes AssetsRequest for filters. */
|
|
77
|
+
getPrimeAssets(req?: AssetsRequest): Promise<PrimeAsset | undefined>;
|
|
78
|
+
/** Query managed sub-accounts (institutional). */
|
|
79
|
+
getManagedAccounts(req?: ManagedAccountsRequest): Promise<ManagedAccount[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Query derivative contracts list. Same wire as getQuoteContract but accepts
|
|
82
|
+
* full request struct. Python: `get_derivative_contracts`.
|
|
83
|
+
*/
|
|
84
|
+
getDerivativeContracts(req: DerivativeContractsRequest): Promise<Contract[]>;
|
|
85
|
+
/** Daily P&L / net-value / holding-value analytics. */
|
|
86
|
+
getAnalyticsAsset(req: AnalyticsAssetRequest): Promise<AnalyticsAsset[]>;
|
|
87
|
+
/** Aggregate assets (prime) by base currency. */
|
|
88
|
+
getAggregateAssets(req?: AggregateAssetsRequest): Promise<AggregateAssets | undefined>;
|
|
89
|
+
/** Estimate tradable quantity given order parameters. */
|
|
90
|
+
getEstimateTradableQuantity(req: EstimateTradableQuantityRequest): Promise<EstimateTradableQuantity | undefined>;
|
|
91
|
+
/** Place forex order (sub-account base-currency swap). */
|
|
92
|
+
placeForexOrder(req: ForexOrderRequest): Promise<ForexOrderResult | undefined>;
|
|
93
|
+
/** Query amount available for inter-segment transfer. Returns array. */
|
|
94
|
+
getSegmentFundAvailable(req: SegmentFundRequest): Promise<SegmentFund[]>;
|
|
95
|
+
/** Query segment fund transfer history. Server returns plain array (no items wrapper). */
|
|
96
|
+
getSegmentFundHistory(req: SegmentFundRequest): Promise<SegmentFundHistoryItem[]>;
|
|
97
|
+
/** Execute an inter-segment fund transfer. */
|
|
98
|
+
transferSegmentFund(req: SegmentFundRequest): Promise<SegmentFund | undefined>;
|
|
99
|
+
/** Cancel a pending inter-segment transfer. */
|
|
100
|
+
cancelSegmentFund(req: SegmentFundRequest): Promise<SegmentFund | undefined>;
|
|
101
|
+
/** Fund-movement details (by segment / currency / fund-type). */
|
|
102
|
+
getFundDetails(req: FundDetailsRequest): Promise<FundDetails[]>;
|
|
103
|
+
/** Funding history (wire method: `transfer_fund`). */
|
|
104
|
+
getFundingHistory(req: FundingHistoryRequest): Promise<FundingHistoryItem[]>;
|
|
14
105
|
/**
|
|
15
|
-
*
|
|
106
|
+
* Internal position transfer (cross sub-account).
|
|
107
|
+
* @note Uses `fromAccount` / `toAccount` (not `account`).
|
|
16
108
|
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
|
|
24
|
-
/** 下单 */
|
|
25
|
-
placeOrder(order: Order): Promise<unknown>;
|
|
26
|
-
/** 预览订单 */
|
|
27
|
-
previewOrder(order: Order): Promise<unknown>;
|
|
28
|
-
/** 修改订单 */
|
|
29
|
-
modifyOrder(id: number, order: Order): Promise<unknown>;
|
|
30
|
-
/** 取消订单 */
|
|
31
|
-
cancelOrder(id: number): Promise<unknown>;
|
|
32
|
-
/** 查询全部订单 */
|
|
33
|
-
orders(): Promise<unknown>;
|
|
34
|
-
/** 查询待成交订单 */
|
|
35
|
-
activeOrders(): Promise<unknown>;
|
|
36
|
-
/** 查询已撤销订单 */
|
|
37
|
-
inactiveOrders(): Promise<unknown>;
|
|
38
|
-
/** 查询已成交订单 */
|
|
39
|
-
filledOrders(): Promise<unknown>;
|
|
40
|
-
/** 查询持仓 */
|
|
41
|
-
positions(): Promise<unknown>;
|
|
42
|
-
/** 查询资产 */
|
|
43
|
-
assets(): Promise<unknown>;
|
|
44
|
-
/** 查询综合账户资产 */
|
|
45
|
-
primeAssets(): Promise<unknown>;
|
|
46
|
-
/** 查询订单成交明细 */
|
|
47
|
-
orderTransactions(id: number): Promise<unknown>;
|
|
109
|
+
transferPosition(req: PositionTransferRequest): Promise<PositionTransferRecord | undefined>;
|
|
110
|
+
/** Query internal position transfer records. Uses `accountId` (wire: `account_id`). */
|
|
111
|
+
getPositionTransferRecords(req: PositionTransferRecordsRequest): Promise<PositionTransferRecord[]>;
|
|
112
|
+
/** Query single internal position transfer detail by ID. */
|
|
113
|
+
getPositionTransferDetail(req: PositionTransferDetailRequest): Promise<PositionTransferDetail | undefined>;
|
|
114
|
+
/** Query external position transfer records (DWAC / FOP / etc.). */
|
|
115
|
+
getPositionTransferExternalRecords(req: PositionTransferExternalRecordsRequest): Promise<PositionTransferExternalRecord[]>;
|
|
48
116
|
}
|
|
49
|
-
//# sourceMappingURL=trade-client.d.ts.map
|