@tigeropenapi/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 +475 -104
- package/dist/cjs/client/api-request.js +16 -10
- package/dist/cjs/client/api-response.js +23 -3
- package/dist/cjs/client/case-convert.js +35 -0
- package/dist/cjs/client/http-client.js +47 -21
- package/dist/cjs/client/index.js +6 -2
- package/dist/cjs/config/client-config.js +130 -49
- package/dist/cjs/config/domain.js +21 -2
- package/dist/cjs/config/index.js +3 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/model/contract.js +1 -2
- package/dist/cjs/model/enums.js +89 -7
- package/dist/cjs/model/order-helpers.js +9 -9
- package/dist/cjs/model/order-status.js +46 -0
- package/dist/cjs/model/order.js +5 -2
- package/dist/cjs/model/position.js +1 -2
- 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/index.js +6 -3
- 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 -163
- package/dist/cjs/push/push-message.js +8 -60
- package/dist/cjs/push/varint.js +76 -0
- package/dist/cjs/quote/index.js +3 -2
- package/dist/cjs/quote/quote-client.js +440 -94
- package/dist/cjs/signer/signer.js +10 -10
- package/dist/cjs/trade/trade-client.js +197 -62
- package/dist/esm/client/api-request.js +14 -8
- package/dist/esm/client/api-response.js +22 -3
- package/dist/esm/client/case-convert.js +31 -0
- package/dist/esm/client/http-client.js +48 -22
- package/dist/esm/client/index.js +3 -2
- package/dist/esm/config/client-config.js +131 -51
- package/dist/esm/config/domain.js +20 -2
- package/dist/esm/config/index.js +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/model/contract.js +1 -2
- package/dist/esm/model/enums.js +87 -6
- package/dist/esm/model/order-helpers.js +9 -9
- package/dist/esm/model/order-status.js +43 -0
- package/dist/esm/model/order.js +5 -2
- package/dist/esm/model/position.js +1 -2
- 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/index.js +4 -2
- 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 -164
- package/dist/esm/push/push-message.js +7 -56
- package/dist/esm/push/varint.js +72 -0
- package/dist/esm/quote/index.js +2 -2
- package/dist/esm/quote/quote-client.js +439 -94
- package/dist/esm/signer/signer.js +10 -10
- package/dist/esm/trade/trade-client.js +197 -62
- package/dist/types/client/api-request.d.ts +12 -11
- package/dist/types/client/api-response.d.ts +15 -7
- package/dist/types/client/case-convert.d.ts +16 -0
- package/dist/types/client/http-client.d.ts +26 -14
- package/dist/types/client/index.d.ts +3 -2
- package/dist/types/config/client-config.d.ts +29 -13
- package/dist/types/config/domain.d.ts +9 -0
- package/dist/types/config/index.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/model/contract.d.ts +13 -29
- package/dist/types/model/enums.d.ts +60 -6
- package/dist/types/model/order-helpers.d.ts +21 -20
- package/dist/types/model/order-status.d.ts +14 -0
- package/dist/types/model/order.d.ts +101 -55
- package/dist/types/model/position.d.ts +26 -24
- 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 -51
- package/dist/types/push/index.d.ts +5 -3
- 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 -68
- package/dist/types/push/push-message.d.ts +7 -147
- package/dist/types/push/varint.d.ts +23 -0
- package/dist/types/quote/index.d.ts +2 -2
- package/dist/types/quote/quote-client.d.ts +154 -47
- package/dist/types/signer/signer.d.ts +6 -6
- package/dist/types/trade/trade-client.d.ts +106 -38
- package/package.json +11 -6
|
@@ -44,18 +44,28 @@ export declare enum OrderType {
|
|
|
44
44
|
VWAP = "VWAP",
|
|
45
45
|
OCA = "OCA"
|
|
46
46
|
}
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* 订单状态枚举。对齐 Java SDK OrderStatus 定义。
|
|
49
|
+
*
|
|
50
|
+
* 服务端 wire 返回的值同时可能是:
|
|
51
|
+
* - 数字: -2 / -1 / 3 / 4 / 5 / 6 / 7 / 8
|
|
52
|
+
* - 字符串: "Invalid" / "Initial" / "PendingCancel" / "Cancelled" /
|
|
53
|
+
* "Submitted" / "Filled" / "Inactive" / "PendingSubmit"
|
|
54
|
+
*
|
|
55
|
+
* Client 层通过 normalizeOrderStatus() 做数字→字符串归一,不做跨别名合并。
|
|
56
|
+
*/
|
|
48
57
|
export declare enum OrderStatus {
|
|
49
|
-
|
|
58
|
+
Invalid = "Invalid",
|
|
50
59
|
Initial = "Initial",
|
|
60
|
+
PendingCancel = "PendingCancel",
|
|
61
|
+
Cancelled = "Cancelled",
|
|
51
62
|
Submitted = "Submitted",
|
|
52
|
-
PartiallyFilled = "PartiallyFilled",
|
|
53
63
|
Filled = "Filled",
|
|
54
|
-
Cancelled = "Cancelled",
|
|
55
|
-
PendingCancel = "PendingCancel",
|
|
56
64
|
Inactive = "Inactive",
|
|
57
|
-
|
|
65
|
+
PendingSubmit = "PendingSubmit"
|
|
58
66
|
}
|
|
67
|
+
/** 返回订单状态对应的服务端数字码,未知返回 0。 */
|
|
68
|
+
export declare function orderStatusCode(status: OrderStatus | string): number;
|
|
59
69
|
/** K 线周期枚举 */
|
|
60
70
|
export declare enum BarPeriod {
|
|
61
71
|
Day = "day",
|
|
@@ -95,3 +105,47 @@ export declare enum TimeInForce {
|
|
|
95
105
|
GTC = "GTC",
|
|
96
106
|
OPG = "OPG"
|
|
97
107
|
}
|
|
108
|
+
/** 订单排序字段 */
|
|
109
|
+
export declare enum OrderSortBy {
|
|
110
|
+
LatestCreated = "LATEST_CREATED",
|
|
111
|
+
LatestStatusUpdated = "LATEST_STATUS_UPDATED"
|
|
112
|
+
}
|
|
113
|
+
/** 账户分部类型 */
|
|
114
|
+
export declare enum SegmentType {
|
|
115
|
+
All = "ALL",
|
|
116
|
+
Sec = "SEC",
|
|
117
|
+
Fut = "FUT",
|
|
118
|
+
Fund = "FUND"
|
|
119
|
+
}
|
|
120
|
+
/** 公司行动类型 */
|
|
121
|
+
export declare enum CorporateActionType {
|
|
122
|
+
Split = "split",
|
|
123
|
+
Dividend = "dividend",
|
|
124
|
+
Earning = "earning"
|
|
125
|
+
}
|
|
126
|
+
/** 行业级别 (1~4 级) */
|
|
127
|
+
export declare enum IndustryLevel {
|
|
128
|
+
GSector = "GSECTOR",
|
|
129
|
+
GGroup = "GGROUP",
|
|
130
|
+
GInd = "GIND",
|
|
131
|
+
GSubInd = "GSUBIND"
|
|
132
|
+
}
|
|
133
|
+
/** 排序方向 */
|
|
134
|
+
export declare enum SortDirection {
|
|
135
|
+
No = "SortDir_No",
|
|
136
|
+
Ascend = "SortDir_Ascend",
|
|
137
|
+
Descend = "SortDir_Descend"
|
|
138
|
+
}
|
|
139
|
+
/** 期权分析周期 */
|
|
140
|
+
export declare enum OptionAnalysisPeriod {
|
|
141
|
+
ThreeYear = "3year",
|
|
142
|
+
FiftyTwoWeek = "52week",
|
|
143
|
+
TwentySixWeek = "26week",
|
|
144
|
+
ThirteenWeek = "13week"
|
|
145
|
+
}
|
|
146
|
+
/** 财报类型 */
|
|
147
|
+
export declare enum FinancialReportPeriod {
|
|
148
|
+
Annual = "Annual",
|
|
149
|
+
Quarterly = "Quarterly",
|
|
150
|
+
LTM = "LTM"
|
|
151
|
+
}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Order construction helpers.
|
|
3
|
+
* All helpers return an `OrderRequest` with sensible defaults.
|
|
3
4
|
*/
|
|
4
|
-
import type {
|
|
5
|
-
/**
|
|
6
|
-
export declare function marketOrder(account: string, symbol: string, secType: string, action: string, quantity: number):
|
|
7
|
-
/**
|
|
8
|
-
export declare function limitOrder(account: string, symbol: string, secType: string, action: string, quantity: number, limitPrice: number):
|
|
9
|
-
/**
|
|
10
|
-
export declare function stopOrder(account: string, symbol: string, secType: string, action: string, quantity: number, auxPrice: number):
|
|
11
|
-
/**
|
|
12
|
-
export declare function stopLimitOrder(account: string, symbol: string, secType: string, action: string, quantity: number, limitPrice: number, auxPrice: number):
|
|
13
|
-
/**
|
|
14
|
-
export declare function trailOrder(account: string, symbol: string, secType: string, action: string, quantity: number, trailingPercent: number):
|
|
15
|
-
/**
|
|
16
|
-
export declare function auctionLimitOrder(account: string, symbol: string, secType: string, action: string, quantity: number, limitPrice: number):
|
|
17
|
-
/**
|
|
18
|
-
export declare function auctionMarketOrder(account: string, symbol: string, secType: string, action: string, quantity: number):
|
|
19
|
-
/**
|
|
20
|
-
export declare function algoOrder(account: string, symbol: string, secType: string, action: string, quantity: number, limitPrice: number, algoType: string, params:
|
|
21
|
-
/**
|
|
22
|
-
export declare function orderLeg(legType: string, price: number, timeInForce: string):
|
|
5
|
+
import type { OrderRequest, OrderLegRequest, AlgoParamsRequest } from './order';
|
|
6
|
+
/** Market order */
|
|
7
|
+
export declare function marketOrder(account: string, symbol: string, secType: string, action: string, quantity: number): OrderRequest;
|
|
8
|
+
/** Limit order */
|
|
9
|
+
export declare function limitOrder(account: string, symbol: string, secType: string, action: string, quantity: number, limitPrice: number): OrderRequest;
|
|
10
|
+
/** Stop order */
|
|
11
|
+
export declare function stopOrder(account: string, symbol: string, secType: string, action: string, quantity: number, auxPrice: number): OrderRequest;
|
|
12
|
+
/** Stop limit order */
|
|
13
|
+
export declare function stopLimitOrder(account: string, symbol: string, secType: string, action: string, quantity: number, limitPrice: number, auxPrice: number): OrderRequest;
|
|
14
|
+
/** Trailing stop order */
|
|
15
|
+
export declare function trailOrder(account: string, symbol: string, secType: string, action: string, quantity: number, trailingPercent: number): OrderRequest;
|
|
16
|
+
/** Auction limit order */
|
|
17
|
+
export declare function auctionLimitOrder(account: string, symbol: string, secType: string, action: string, quantity: number, limitPrice: number): OrderRequest;
|
|
18
|
+
/** Auction market order */
|
|
19
|
+
export declare function auctionMarketOrder(account: string, symbol: string, secType: string, action: string, quantity: number): OrderRequest;
|
|
20
|
+
/** Algo order (TWAP / VWAP) */
|
|
21
|
+
export declare function algoOrder(account: string, symbol: string, secType: string, action: string, quantity: number, limitPrice: number, algoType: string, params: AlgoParamsRequest): OrderRequest;
|
|
22
|
+
/** Attached profit / loss leg */
|
|
23
|
+
export declare function orderLeg(legType: string, price: number, timeInForce: string): OrderLegRequest;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Order status normalization.
|
|
3
|
+
*
|
|
4
|
+
* 服务端返回的订单状态有时是整数(-2/-1/3/4/5/6/7/8),有时是字符串
|
|
5
|
+
* ("Invalid"/"Submitted"/...)。本模块把二者统一为 Java SDK OrderStatus 的
|
|
6
|
+
* 字符串值。不做跨别名合并。
|
|
7
|
+
*
|
|
8
|
+
* 对齐 Java SDK OrderStatus.java。
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* 把服务端可能返回的 string/number 订单状态归一为字符串。
|
|
12
|
+
* 字符串原样透传;数字按映射表转换;其他输入返回空串。
|
|
13
|
+
*/
|
|
14
|
+
export declare function normalizeOrderStatus(raw: unknown): string;
|
|
@@ -1,95 +1,141 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Order
|
|
3
|
-
*
|
|
2
|
+
* Order response / request models.
|
|
3
|
+
*
|
|
4
|
+
* TypeScript uses camelCase field names idiomatically. The client layer
|
|
5
|
+
* transparently converts request camelCase to snake_case before sending;
|
|
6
|
+
* server responses are already camelCase so they decode directly.
|
|
4
7
|
*/
|
|
5
|
-
/**
|
|
8
|
+
/** Attached leg order (profit / loss) — response side */
|
|
6
9
|
export interface OrderLeg {
|
|
7
|
-
/** 附加订单类型(PROFIT/LOSS) */
|
|
8
10
|
legType?: string;
|
|
9
|
-
/** 价格 */
|
|
10
11
|
price?: number;
|
|
11
|
-
/** 有效期 */
|
|
12
12
|
timeInForce?: string;
|
|
13
|
-
/** 数量 */
|
|
14
13
|
quantity?: number;
|
|
15
14
|
}
|
|
16
|
-
/**
|
|
15
|
+
/** Algo order parameters — response side */
|
|
17
16
|
export interface AlgoParams {
|
|
18
|
-
/** 算法策略(TWAP/VWAP) */
|
|
19
17
|
algoStrategy?: string;
|
|
20
|
-
/** 开始时间 */
|
|
21
18
|
startTime?: string;
|
|
22
|
-
/** 结束时间 */
|
|
23
19
|
endTime?: string;
|
|
24
|
-
/** 参与率 */
|
|
25
20
|
participationRate?: number;
|
|
26
21
|
}
|
|
27
|
-
/**
|
|
22
|
+
/** Order response model (returned by order query methods). */
|
|
28
23
|
export interface Order {
|
|
29
|
-
|
|
30
|
-
account: string;
|
|
31
|
-
/** 全局订单 ID */
|
|
24
|
+
account?: string;
|
|
32
25
|
id?: number;
|
|
33
|
-
/** 账户自增订单号 */
|
|
34
26
|
orderId?: number;
|
|
35
|
-
|
|
36
|
-
action
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
externalId?: string;
|
|
28
|
+
action?: string;
|
|
29
|
+
orderType?: string;
|
|
30
|
+
totalQuantity?: number;
|
|
31
|
+
totalQuantityScale?: number;
|
|
32
|
+
filledQuantity?: number;
|
|
33
|
+
filledQuantityScale?: number;
|
|
34
|
+
filledCashAmount?: number;
|
|
42
35
|
limitPrice?: number;
|
|
43
|
-
/** 辅助价格(止损价) */
|
|
44
36
|
auxPrice?: number;
|
|
45
|
-
/** 跟踪止损百分比 */
|
|
46
37
|
trailingPercent?: number;
|
|
47
|
-
/** 订单状态 */
|
|
48
38
|
status?: string;
|
|
49
|
-
/** 已成交数量(API 返回字段名为 filledQuantity) */
|
|
50
|
-
filledQuantity?: number;
|
|
51
|
-
/** 平均成交价 */
|
|
52
39
|
avgFillPrice?: number;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/** 是否允许盘前盘后 */
|
|
56
|
-
outsideRth: boolean;
|
|
57
|
-
/** 附加订单(止盈/止损) */
|
|
40
|
+
timeInForce?: string;
|
|
41
|
+
outsideRth?: boolean;
|
|
58
42
|
orderLegs?: OrderLeg[];
|
|
59
|
-
/** 算法参数 */
|
|
60
43
|
algoParams?: AlgoParams;
|
|
61
|
-
|
|
62
|
-
symbol
|
|
63
|
-
|
|
64
|
-
secType: string;
|
|
65
|
-
/** 市场 */
|
|
44
|
+
algoStrategy?: string;
|
|
45
|
+
symbol?: string;
|
|
46
|
+
secType?: string;
|
|
66
47
|
market?: string;
|
|
67
|
-
/** 货币 */
|
|
68
48
|
currency?: string;
|
|
69
|
-
/** 到期日(期权/期货) */
|
|
70
49
|
expiry?: string;
|
|
71
|
-
/** 行权价(期权),API 返回为字符串 */
|
|
72
50
|
strike?: string;
|
|
73
|
-
/** 看涨/看跌(PUT/CALL),保持 API 原始名 right */
|
|
74
51
|
right?: string;
|
|
75
|
-
/** 合约标识符 */
|
|
76
52
|
identifier?: string;
|
|
77
|
-
/** 合约名称 */
|
|
78
53
|
name?: string;
|
|
79
|
-
/** 佣金 */
|
|
80
54
|
commission?: number;
|
|
81
|
-
|
|
55
|
+
gst?: number;
|
|
82
56
|
realizedPnl?: number;
|
|
83
|
-
/** 开仓时间(毫秒时间戳) */
|
|
84
57
|
openTime?: number;
|
|
85
|
-
/** 更新时间(毫秒时间戳) */
|
|
86
58
|
updateTime?: number;
|
|
87
|
-
/** 最新时间(毫秒时间戳) */
|
|
88
59
|
latestTime?: number;
|
|
89
|
-
|
|
60
|
+
latestPrice?: number;
|
|
90
61
|
remark?: string;
|
|
91
|
-
/** 订单来源 */
|
|
92
62
|
source?: string;
|
|
93
|
-
/** 用户标记 */
|
|
94
63
|
userMark?: string;
|
|
64
|
+
liquidation?: boolean;
|
|
65
|
+
discount?: number;
|
|
66
|
+
replaceStatus?: string;
|
|
67
|
+
cancelStatus?: string;
|
|
68
|
+
canModify?: boolean;
|
|
69
|
+
canCancel?: boolean;
|
|
70
|
+
isOpen?: boolean;
|
|
71
|
+
orderDiscount?: number;
|
|
72
|
+
tradingSessionType?: string;
|
|
73
|
+
attrDesc?: string;
|
|
74
|
+
attrList?: string[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* OrderRequest — order request model used by placeOrder / previewOrder / modifyOrder.
|
|
78
|
+
* Fields are camelCase in TypeScript; the client converts them to snake_case on the wire.
|
|
79
|
+
*/
|
|
80
|
+
export interface OrderRequest {
|
|
81
|
+
/** Account ID (client fills it in automatically) */
|
|
82
|
+
account?: string;
|
|
83
|
+
/** Global order ID (required for modify) */
|
|
84
|
+
id?: number;
|
|
85
|
+
/** Account-level order ID */
|
|
86
|
+
orderId?: number;
|
|
87
|
+
/** BUY / SELL */
|
|
88
|
+
action: string;
|
|
89
|
+
/** Order type: MKT / LMT / STP / STP_LMT / TRAIL / AM / AL / TWAP / VWAP / OCA */
|
|
90
|
+
orderType: string;
|
|
91
|
+
/** Total quantity */
|
|
92
|
+
totalQuantity: number;
|
|
93
|
+
/** Limit price (required for LMT / STP_LMT) */
|
|
94
|
+
limitPrice?: number;
|
|
95
|
+
/** Stop / trigger price (required for STP / STP_LMT / TRAIL) */
|
|
96
|
+
auxPrice?: number;
|
|
97
|
+
/** Trailing stop percent */
|
|
98
|
+
trailingPercent?: number;
|
|
99
|
+
/** DAY / GTC / GTD / OPG */
|
|
100
|
+
timeInForce: string;
|
|
101
|
+
/** Allow extended-hours trading */
|
|
102
|
+
outsideRth?: boolean;
|
|
103
|
+
/** Attached legs (profit / loss) */
|
|
104
|
+
orderLegs?: OrderLegRequest[];
|
|
105
|
+
/** Algo parameters */
|
|
106
|
+
algoParams?: AlgoParamsRequest;
|
|
107
|
+
/** Contract symbol */
|
|
108
|
+
symbol: string;
|
|
109
|
+
/** STK / OPT / FUT / WAR / IOPT */
|
|
110
|
+
secType: string;
|
|
111
|
+
/** Market */
|
|
112
|
+
market?: string;
|
|
113
|
+
/** Currency */
|
|
114
|
+
currency?: string;
|
|
115
|
+
/** Option expiry */
|
|
116
|
+
expiry?: string;
|
|
117
|
+
/** Option strike */
|
|
118
|
+
strike?: string;
|
|
119
|
+
/** CALL / PUT */
|
|
120
|
+
right?: string;
|
|
121
|
+
/** Contract identifier */
|
|
122
|
+
identifier?: string;
|
|
123
|
+
/** Remark */
|
|
124
|
+
remark?: string;
|
|
125
|
+
/** User mark */
|
|
126
|
+
userMark?: string;
|
|
127
|
+
}
|
|
128
|
+
/** Attached leg for request side */
|
|
129
|
+
export interface OrderLegRequest {
|
|
130
|
+
legType: string;
|
|
131
|
+
price?: number;
|
|
132
|
+
timeInForce?: string;
|
|
133
|
+
quantity?: number;
|
|
134
|
+
}
|
|
135
|
+
/** Algo parameters for request side */
|
|
136
|
+
export interface AlgoParamsRequest {
|
|
137
|
+
algoStrategy?: string;
|
|
138
|
+
startTime?: string;
|
|
139
|
+
endTime?: string;
|
|
140
|
+
participationRate?: number;
|
|
95
141
|
}
|
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Position
|
|
3
|
-
* 字段名 camelCase 与 API JSON 天然一致,不改名、不加封装层
|
|
2
|
+
* Position model.
|
|
4
3
|
*/
|
|
5
|
-
/**
|
|
4
|
+
/** Position (returned by positions query) */
|
|
6
5
|
export interface Position {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
symbol: string;
|
|
11
|
-
/** 证券类型 */
|
|
12
|
-
secType: string;
|
|
13
|
-
/** 市场 */
|
|
6
|
+
account?: string;
|
|
7
|
+
symbol?: string;
|
|
8
|
+
secType?: string;
|
|
14
9
|
market?: string;
|
|
15
|
-
/** 货币 */
|
|
16
10
|
currency?: string;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
position?: number;
|
|
12
|
+
positionScale?: number;
|
|
13
|
+
positionQty?: number;
|
|
14
|
+
salableQty?: number;
|
|
15
|
+
averageCost?: number;
|
|
16
|
+
averageCostByAverage?: number;
|
|
17
|
+
averageCostOfCarry?: number;
|
|
22
18
|
marketValue?: number;
|
|
23
|
-
/** 已实现盈亏 */
|
|
24
19
|
realizedPnl?: number;
|
|
25
|
-
|
|
20
|
+
realizedPnlByAverage?: number;
|
|
26
21
|
unrealizedPnl?: number;
|
|
27
|
-
|
|
22
|
+
unrealizedPnlByAverage?: number;
|
|
23
|
+
unrealizedPnlByCostOfCarry?: number;
|
|
28
24
|
unrealizedPnlPercent?: number;
|
|
29
|
-
|
|
25
|
+
unrealizedPnlPercentByAverage?: number;
|
|
26
|
+
unrealizedPnlPercentByCostOfCarry?: number;
|
|
30
27
|
contractId?: number;
|
|
31
|
-
/** 合约标识符 */
|
|
32
28
|
identifier?: string;
|
|
33
|
-
/** 合约名称 */
|
|
34
29
|
name?: string;
|
|
35
|
-
/** 最新价格 */
|
|
36
30
|
latestPrice?: number;
|
|
37
|
-
|
|
31
|
+
lastClosePrice?: number;
|
|
38
32
|
multiplier?: number;
|
|
33
|
+
status?: number;
|
|
34
|
+
updateTimestamp?: number;
|
|
35
|
+
mmPercent?: number;
|
|
36
|
+
mmValue?: number;
|
|
37
|
+
todayPnl?: number;
|
|
38
|
+
todayPnlPercent?: number;
|
|
39
|
+
comboTypes?: string[];
|
|
40
|
+
categories?: string[];
|
|
39
41
|
}
|