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
package/dist/cjs/model/enums.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* 所有枚举值与 API JSON 保持一致
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.TimeInForce = exports.License = exports.QuoteRight = exports.Language = exports.BarPeriod = exports.OrderStatus = exports.OrderType = exports.Currency = exports.SecurityType = exports.Market = void 0;
|
|
7
|
+
exports.FinancialReportPeriod = exports.OptionAnalysisPeriod = exports.SortDirection = exports.IndustryLevel = exports.CorporateActionType = exports.SegmentType = exports.OrderSortBy = exports.TimeInForce = exports.License = exports.QuoteRight = exports.Language = exports.BarPeriod = exports.OrderStatus = exports.OrderType = exports.Currency = exports.SecurityType = exports.Market = void 0;
|
|
8
|
+
exports.orderStatusCode = orderStatusCode;
|
|
8
9
|
/** 市场枚举 */
|
|
9
10
|
var Market;
|
|
10
11
|
(function (Market) {
|
|
@@ -51,19 +52,49 @@ var OrderType;
|
|
|
51
52
|
OrderType["VWAP"] = "VWAP";
|
|
52
53
|
OrderType["OCA"] = "OCA";
|
|
53
54
|
})(OrderType || (exports.OrderType = OrderType = {}));
|
|
54
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* 订单状态枚举。对齐 Java SDK OrderStatus 定义。
|
|
57
|
+
*
|
|
58
|
+
* 服务端 wire 返回的值同时可能是:
|
|
59
|
+
* - 数字: -2 / -1 / 3 / 4 / 5 / 6 / 7 / 8
|
|
60
|
+
* - 字符串: "Invalid" / "Initial" / "PendingCancel" / "Cancelled" /
|
|
61
|
+
* "Submitted" / "Filled" / "Inactive" / "PendingSubmit"
|
|
62
|
+
*
|
|
63
|
+
* Client 层通过 normalizeOrderStatus() 做数字→字符串归一,不做跨别名合并。
|
|
64
|
+
*/
|
|
55
65
|
var OrderStatus;
|
|
56
66
|
(function (OrderStatus) {
|
|
57
|
-
OrderStatus["
|
|
67
|
+
OrderStatus["Invalid"] = "Invalid";
|
|
58
68
|
OrderStatus["Initial"] = "Initial";
|
|
69
|
+
OrderStatus["PendingCancel"] = "PendingCancel";
|
|
70
|
+
OrderStatus["Cancelled"] = "Cancelled";
|
|
59
71
|
OrderStatus["Submitted"] = "Submitted";
|
|
60
|
-
OrderStatus["PartiallyFilled"] = "PartiallyFilled";
|
|
61
72
|
OrderStatus["Filled"] = "Filled";
|
|
62
|
-
OrderStatus["Cancelled"] = "Cancelled";
|
|
63
|
-
OrderStatus["PendingCancel"] = "PendingCancel";
|
|
64
73
|
OrderStatus["Inactive"] = "Inactive";
|
|
65
|
-
OrderStatus["
|
|
74
|
+
OrderStatus["PendingSubmit"] = "PendingSubmit";
|
|
66
75
|
})(OrderStatus || (exports.OrderStatus = OrderStatus = {}));
|
|
76
|
+
/** 返回订单状态对应的服务端数字码,未知返回 0。 */
|
|
77
|
+
function orderStatusCode(status) {
|
|
78
|
+
switch (status) {
|
|
79
|
+
case OrderStatus.Invalid:
|
|
80
|
+
return -2;
|
|
81
|
+
case OrderStatus.Initial:
|
|
82
|
+
return -1;
|
|
83
|
+
case OrderStatus.PendingCancel:
|
|
84
|
+
return 3;
|
|
85
|
+
case OrderStatus.Cancelled:
|
|
86
|
+
return 4;
|
|
87
|
+
case OrderStatus.Submitted:
|
|
88
|
+
return 5;
|
|
89
|
+
case OrderStatus.Filled:
|
|
90
|
+
return 6;
|
|
91
|
+
case OrderStatus.Inactive:
|
|
92
|
+
return 7;
|
|
93
|
+
case OrderStatus.PendingSubmit:
|
|
94
|
+
return 8;
|
|
95
|
+
}
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
67
98
|
/** K 线周期枚举 */
|
|
68
99
|
var BarPeriod;
|
|
69
100
|
(function (BarPeriod) {
|
|
@@ -108,4 +139,54 @@ var TimeInForce;
|
|
|
108
139
|
TimeInForce["GTC"] = "GTC";
|
|
109
140
|
TimeInForce["OPG"] = "OPG";
|
|
110
141
|
})(TimeInForce || (exports.TimeInForce = TimeInForce = {}));
|
|
111
|
-
|
|
142
|
+
/** 订单排序字段 */
|
|
143
|
+
var OrderSortBy;
|
|
144
|
+
(function (OrderSortBy) {
|
|
145
|
+
OrderSortBy["LatestCreated"] = "LATEST_CREATED";
|
|
146
|
+
OrderSortBy["LatestStatusUpdated"] = "LATEST_STATUS_UPDATED";
|
|
147
|
+
})(OrderSortBy || (exports.OrderSortBy = OrderSortBy = {}));
|
|
148
|
+
/** 账户分部类型 */
|
|
149
|
+
var SegmentType;
|
|
150
|
+
(function (SegmentType) {
|
|
151
|
+
SegmentType["All"] = "ALL";
|
|
152
|
+
SegmentType["Sec"] = "SEC";
|
|
153
|
+
SegmentType["Fut"] = "FUT";
|
|
154
|
+
SegmentType["Fund"] = "FUND";
|
|
155
|
+
})(SegmentType || (exports.SegmentType = SegmentType = {}));
|
|
156
|
+
/** 公司行动类型 */
|
|
157
|
+
var CorporateActionType;
|
|
158
|
+
(function (CorporateActionType) {
|
|
159
|
+
CorporateActionType["Split"] = "split";
|
|
160
|
+
CorporateActionType["Dividend"] = "dividend";
|
|
161
|
+
CorporateActionType["Earning"] = "earning";
|
|
162
|
+
})(CorporateActionType || (exports.CorporateActionType = CorporateActionType = {}));
|
|
163
|
+
/** 行业级别 (1~4 级) */
|
|
164
|
+
var IndustryLevel;
|
|
165
|
+
(function (IndustryLevel) {
|
|
166
|
+
IndustryLevel["GSector"] = "GSECTOR";
|
|
167
|
+
IndustryLevel["GGroup"] = "GGROUP";
|
|
168
|
+
IndustryLevel["GInd"] = "GIND";
|
|
169
|
+
IndustryLevel["GSubInd"] = "GSUBIND";
|
|
170
|
+
})(IndustryLevel || (exports.IndustryLevel = IndustryLevel = {}));
|
|
171
|
+
/** 排序方向 */
|
|
172
|
+
var SortDirection;
|
|
173
|
+
(function (SortDirection) {
|
|
174
|
+
SortDirection["No"] = "SortDir_No";
|
|
175
|
+
SortDirection["Ascend"] = "SortDir_Ascend";
|
|
176
|
+
SortDirection["Descend"] = "SortDir_Descend";
|
|
177
|
+
})(SortDirection || (exports.SortDirection = SortDirection = {}));
|
|
178
|
+
/** 期权分析周期 */
|
|
179
|
+
var OptionAnalysisPeriod;
|
|
180
|
+
(function (OptionAnalysisPeriod) {
|
|
181
|
+
OptionAnalysisPeriod["ThreeYear"] = "3year";
|
|
182
|
+
OptionAnalysisPeriod["FiftyTwoWeek"] = "52week";
|
|
183
|
+
OptionAnalysisPeriod["TwentySixWeek"] = "26week";
|
|
184
|
+
OptionAnalysisPeriod["ThirteenWeek"] = "13week";
|
|
185
|
+
})(OptionAnalysisPeriod || (exports.OptionAnalysisPeriod = OptionAnalysisPeriod = {}));
|
|
186
|
+
/** 财报类型 */
|
|
187
|
+
var FinancialReportPeriod;
|
|
188
|
+
(function (FinancialReportPeriod) {
|
|
189
|
+
FinancialReportPeriod["Annual"] = "Annual";
|
|
190
|
+
FinancialReportPeriod["Quarterly"] = "Quarterly";
|
|
191
|
+
FinancialReportPeriod["LTM"] = "LTM";
|
|
192
|
+
})(FinancialReportPeriod || (exports.FinancialReportPeriod = FinancialReportPeriod = {}));
|
|
@@ -10,7 +10,7 @@ exports.auctionMarketOrder = auctionMarketOrder;
|
|
|
10
10
|
exports.algoOrder = algoOrder;
|
|
11
11
|
exports.orderLeg = orderLeg;
|
|
12
12
|
const enums_1 = require("./enums");
|
|
13
|
-
/**
|
|
13
|
+
/** Market order */
|
|
14
14
|
function marketOrder(account, symbol, secType, action, quantity) {
|
|
15
15
|
return {
|
|
16
16
|
account, symbol, secType, action,
|
|
@@ -20,7 +20,7 @@ function marketOrder(account, symbol, secType, action, quantity) {
|
|
|
20
20
|
outsideRth: false,
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
23
|
+
/** Limit order */
|
|
24
24
|
function limitOrder(account, symbol, secType, action, quantity, limitPrice) {
|
|
25
25
|
return {
|
|
26
26
|
account, symbol, secType, action,
|
|
@@ -31,7 +31,7 @@ function limitOrder(account, symbol, secType, action, quantity, limitPrice) {
|
|
|
31
31
|
outsideRth: false,
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
/**
|
|
34
|
+
/** Stop order */
|
|
35
35
|
function stopOrder(account, symbol, secType, action, quantity, auxPrice) {
|
|
36
36
|
return {
|
|
37
37
|
account, symbol, secType, action,
|
|
@@ -42,7 +42,7 @@ function stopOrder(account, symbol, secType, action, quantity, auxPrice) {
|
|
|
42
42
|
outsideRth: false,
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
/**
|
|
45
|
+
/** Stop limit order */
|
|
46
46
|
function stopLimitOrder(account, symbol, secType, action, quantity, limitPrice, auxPrice) {
|
|
47
47
|
return {
|
|
48
48
|
account, symbol, secType, action,
|
|
@@ -54,7 +54,7 @@ function stopLimitOrder(account, symbol, secType, action, quantity, limitPrice,
|
|
|
54
54
|
outsideRth: false,
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
/**
|
|
57
|
+
/** Trailing stop order */
|
|
58
58
|
function trailOrder(account, symbol, secType, action, quantity, trailingPercent) {
|
|
59
59
|
return {
|
|
60
60
|
account, symbol, secType, action,
|
|
@@ -65,7 +65,7 @@ function trailOrder(account, symbol, secType, action, quantity, trailingPercent)
|
|
|
65
65
|
outsideRth: false,
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
/**
|
|
68
|
+
/** Auction limit order */
|
|
69
69
|
function auctionLimitOrder(account, symbol, secType, action, quantity, limitPrice) {
|
|
70
70
|
return {
|
|
71
71
|
account, symbol, secType, action,
|
|
@@ -76,7 +76,7 @@ function auctionLimitOrder(account, symbol, secType, action, quantity, limitPric
|
|
|
76
76
|
outsideRth: false,
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
/**
|
|
79
|
+
/** Auction market order */
|
|
80
80
|
function auctionMarketOrder(account, symbol, secType, action, quantity) {
|
|
81
81
|
return {
|
|
82
82
|
account, symbol, secType, action,
|
|
@@ -86,7 +86,7 @@ function auctionMarketOrder(account, symbol, secType, action, quantity) {
|
|
|
86
86
|
outsideRth: false,
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
/**
|
|
89
|
+
/** Algo order (TWAP / VWAP) */
|
|
90
90
|
function algoOrder(account, symbol, secType, action, quantity, limitPrice, algoType, params) {
|
|
91
91
|
return {
|
|
92
92
|
account, symbol, secType, action,
|
|
@@ -98,8 +98,7 @@ function algoOrder(account, symbol, secType, action, quantity, limitPrice, algoT
|
|
|
98
98
|
outsideRth: false,
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
|
-
/**
|
|
101
|
+
/** Attached profit / loss leg */
|
|
102
102
|
function orderLeg(legType, price, timeInForce) {
|
|
103
103
|
return { legType, price, timeInForce };
|
|
104
104
|
}
|
|
105
|
-
//# sourceMappingURL=order-helpers.js.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Order status normalization.
|
|
4
|
+
*
|
|
5
|
+
* 服务端返回的订单状态有时是整数(-2/-1/3/4/5/6/7/8),有时是字符串
|
|
6
|
+
* ("Invalid"/"Submitted"/...)。本模块把二者统一为 Java SDK OrderStatus 的
|
|
7
|
+
* 字符串值。不做跨别名合并。
|
|
8
|
+
*
|
|
9
|
+
* 对齐 Java SDK OrderStatus.java。
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.normalizeOrderStatus = normalizeOrderStatus;
|
|
13
|
+
const enums_1 = require("./enums");
|
|
14
|
+
/** 把数字状态码映射到字符串,未识别返回空串。 */
|
|
15
|
+
function statusIntToString(n) {
|
|
16
|
+
switch (n) {
|
|
17
|
+
case -2:
|
|
18
|
+
return enums_1.OrderStatus.Invalid;
|
|
19
|
+
case -1:
|
|
20
|
+
return enums_1.OrderStatus.Initial;
|
|
21
|
+
case 3:
|
|
22
|
+
return enums_1.OrderStatus.PendingCancel;
|
|
23
|
+
case 4:
|
|
24
|
+
return enums_1.OrderStatus.Cancelled;
|
|
25
|
+
case 5:
|
|
26
|
+
return enums_1.OrderStatus.Submitted;
|
|
27
|
+
case 6:
|
|
28
|
+
return enums_1.OrderStatus.Filled;
|
|
29
|
+
case 7:
|
|
30
|
+
return enums_1.OrderStatus.Inactive;
|
|
31
|
+
case 8:
|
|
32
|
+
return enums_1.OrderStatus.PendingSubmit;
|
|
33
|
+
}
|
|
34
|
+
return '';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* 把服务端可能返回的 string/number 订单状态归一为字符串。
|
|
38
|
+
* 字符串原样透传;数字按映射表转换;其他输入返回空串。
|
|
39
|
+
*/
|
|
40
|
+
function normalizeOrderStatus(raw) {
|
|
41
|
+
if (typeof raw === 'string')
|
|
42
|
+
return raw;
|
|
43
|
+
if (typeof raw === 'number')
|
|
44
|
+
return statusIntToString(raw);
|
|
45
|
+
return '';
|
|
46
|
+
}
|
package/dist/cjs/model/order.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Order
|
|
4
|
-
*
|
|
3
|
+
* Order response / request models.
|
|
4
|
+
*
|
|
5
|
+
* TypeScript uses camelCase field names idiomatically. The client layer
|
|
6
|
+
* transparently converts request camelCase to snake_case before sending;
|
|
7
|
+
* server responses are already camelCase so they decode directly.
|
|
5
8
|
*/
|
|
6
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
//# sourceMappingURL=order.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Quote request interfaces (v0.4.0).
|
|
4
|
+
*
|
|
5
|
+
* 所有字段可选(用户调用时传一个空对象即可);字段名用 camelCase,
|
|
6
|
+
* client 层通过 keysToSnakeCase 转成服务端 wire 真名的 snake_case。
|
|
7
|
+
* **字段名设计规则:camelCase → snake_case 后必须等于服务端 wire 真名。**
|
|
8
|
+
*
|
|
9
|
+
* 参考 Go SDK model/quote_requests.go。
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Trade request interfaces (v0.4.0).
|
|
4
|
+
*
|
|
5
|
+
* 所有字段可选(用户调用时传一个空对象即可);字段名用 camelCase,
|
|
6
|
+
* client 层通过 keysToSnakeCase 转成服务端 wire 真名的 snake_case。
|
|
7
|
+
* **字段名设计规则:camelCase → snake_case 后必须等于服务端 wire 真名。**
|
|
8
|
+
* 比如 Trade 用 `startDate`/`endDate`(wire `start_date`/`end_date`),
|
|
9
|
+
* 不用 `startTime`/`endTime`(会被转成 `start_time`/`end_time`,与 wire 不符)。
|
|
10
|
+
*
|
|
11
|
+
* 参考 Go SDK model/trade_requests.go。
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/cjs/push/index.js
CHANGED
|
@@ -14,13 +14,15 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ConnectionState = exports.PushClient = void 0;
|
|
17
|
+
exports.ConnectionState = exports.PushClient = exports.SubjectType = void 0;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Push module exports
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
var push_message_1 = require("./push-message");
|
|
22
|
+
Object.defineProperty(exports, "SubjectType", { enumerable: true, get: function () { return push_message_1.SubjectType; } });
|
|
22
23
|
__exportStar(require("./callbacks"), exports);
|
|
24
|
+
__exportStar(require("./varint"), exports);
|
|
25
|
+
__exportStar(require("./proto-message"), exports);
|
|
23
26
|
var push_client_1 = require("./push-client");
|
|
24
27
|
Object.defineProperty(exports, "PushClient", { enumerable: true, get: function () { return push_client_1.PushClient; } });
|
|
25
28
|
Object.defineProperty(exports, "ConnectionState", { enumerable: true, get: function () { return push_client_1.ConnectionState; } });
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
3
|
+
// versions:
|
|
4
|
+
// protoc-gen-ts_proto v2.11.6
|
|
5
|
+
// protoc v5.28.3
|
|
6
|
+
// source: AssetData.proto
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.AssetData = exports.protobufPackage = void 0;
|
|
9
|
+
/* eslint-disable */
|
|
10
|
+
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
11
|
+
exports.protobufPackage = "com.tigerbrokers.stock.openapi.client.socket.data.pb";
|
|
12
|
+
function createBaseAssetData() {
|
|
13
|
+
return {
|
|
14
|
+
account: "",
|
|
15
|
+
currency: "",
|
|
16
|
+
segType: "",
|
|
17
|
+
availableFunds: 0,
|
|
18
|
+
excessLiquidity: 0,
|
|
19
|
+
netLiquidation: 0,
|
|
20
|
+
equityWithLoan: 0,
|
|
21
|
+
buyingPower: 0,
|
|
22
|
+
cashBalance: 0,
|
|
23
|
+
grossPositionValue: 0,
|
|
24
|
+
initMarginReq: 0,
|
|
25
|
+
maintMarginReq: 0,
|
|
26
|
+
timestamp: 0,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.AssetData = {
|
|
30
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
31
|
+
if (message.account !== "") {
|
|
32
|
+
writer.uint32(10).string(message.account);
|
|
33
|
+
}
|
|
34
|
+
if (message.currency !== "") {
|
|
35
|
+
writer.uint32(18).string(message.currency);
|
|
36
|
+
}
|
|
37
|
+
if (message.segType !== "") {
|
|
38
|
+
writer.uint32(26).string(message.segType);
|
|
39
|
+
}
|
|
40
|
+
if (message.availableFunds !== 0) {
|
|
41
|
+
writer.uint32(33).double(message.availableFunds);
|
|
42
|
+
}
|
|
43
|
+
if (message.excessLiquidity !== 0) {
|
|
44
|
+
writer.uint32(41).double(message.excessLiquidity);
|
|
45
|
+
}
|
|
46
|
+
if (message.netLiquidation !== 0) {
|
|
47
|
+
writer.uint32(49).double(message.netLiquidation);
|
|
48
|
+
}
|
|
49
|
+
if (message.equityWithLoan !== 0) {
|
|
50
|
+
writer.uint32(57).double(message.equityWithLoan);
|
|
51
|
+
}
|
|
52
|
+
if (message.buyingPower !== 0) {
|
|
53
|
+
writer.uint32(65).double(message.buyingPower);
|
|
54
|
+
}
|
|
55
|
+
if (message.cashBalance !== 0) {
|
|
56
|
+
writer.uint32(73).double(message.cashBalance);
|
|
57
|
+
}
|
|
58
|
+
if (message.grossPositionValue !== 0) {
|
|
59
|
+
writer.uint32(81).double(message.grossPositionValue);
|
|
60
|
+
}
|
|
61
|
+
if (message.initMarginReq !== 0) {
|
|
62
|
+
writer.uint32(89).double(message.initMarginReq);
|
|
63
|
+
}
|
|
64
|
+
if (message.maintMarginReq !== 0) {
|
|
65
|
+
writer.uint32(97).double(message.maintMarginReq);
|
|
66
|
+
}
|
|
67
|
+
if (message.timestamp !== 0) {
|
|
68
|
+
writer.uint32(104).uint64(message.timestamp);
|
|
69
|
+
}
|
|
70
|
+
return writer;
|
|
71
|
+
},
|
|
72
|
+
decode(input, length) {
|
|
73
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
74
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
75
|
+
const message = createBaseAssetData();
|
|
76
|
+
while (reader.pos < end) {
|
|
77
|
+
const tag = reader.uint32();
|
|
78
|
+
switch (tag >>> 3) {
|
|
79
|
+
case 1: {
|
|
80
|
+
if (tag !== 10) {
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
message.account = reader.string();
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
case 2: {
|
|
87
|
+
if (tag !== 18) {
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
message.currency = reader.string();
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
case 3: {
|
|
94
|
+
if (tag !== 26) {
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
message.segType = reader.string();
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
case 4: {
|
|
101
|
+
if (tag !== 33) {
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
message.availableFunds = reader.double();
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
case 5: {
|
|
108
|
+
if (tag !== 41) {
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
message.excessLiquidity = reader.double();
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
case 6: {
|
|
115
|
+
if (tag !== 49) {
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
message.netLiquidation = reader.double();
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
case 7: {
|
|
122
|
+
if (tag !== 57) {
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
message.equityWithLoan = reader.double();
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
case 8: {
|
|
129
|
+
if (tag !== 65) {
|
|
130
|
+
break;
|
|
131
|
+
}
|
|
132
|
+
message.buyingPower = reader.double();
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
case 9: {
|
|
136
|
+
if (tag !== 73) {
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
message.cashBalance = reader.double();
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
case 10: {
|
|
143
|
+
if (tag !== 81) {
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
message.grossPositionValue = reader.double();
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
case 11: {
|
|
150
|
+
if (tag !== 89) {
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
message.initMarginReq = reader.double();
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
case 12: {
|
|
157
|
+
if (tag !== 97) {
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
message.maintMarginReq = reader.double();
|
|
161
|
+
continue;
|
|
162
|
+
}
|
|
163
|
+
case 13: {
|
|
164
|
+
if (tag !== 104) {
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
message.timestamp = longToNumber(reader.uint64());
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
reader.skip(tag & 7);
|
|
175
|
+
}
|
|
176
|
+
return message;
|
|
177
|
+
},
|
|
178
|
+
create(base) {
|
|
179
|
+
return exports.AssetData.fromPartial(base ?? {});
|
|
180
|
+
},
|
|
181
|
+
fromPartial(object) {
|
|
182
|
+
const message = createBaseAssetData();
|
|
183
|
+
message.account = object.account ?? "";
|
|
184
|
+
message.currency = object.currency ?? "";
|
|
185
|
+
message.segType = object.segType ?? "";
|
|
186
|
+
message.availableFunds = object.availableFunds ?? 0;
|
|
187
|
+
message.excessLiquidity = object.excessLiquidity ?? 0;
|
|
188
|
+
message.netLiquidation = object.netLiquidation ?? 0;
|
|
189
|
+
message.equityWithLoan = object.equityWithLoan ?? 0;
|
|
190
|
+
message.buyingPower = object.buyingPower ?? 0;
|
|
191
|
+
message.cashBalance = object.cashBalance ?? 0;
|
|
192
|
+
message.grossPositionValue = object.grossPositionValue ?? 0;
|
|
193
|
+
message.initMarginReq = object.initMarginReq ?? 0;
|
|
194
|
+
message.maintMarginReq = object.maintMarginReq ?? 0;
|
|
195
|
+
message.timestamp = object.timestamp ?? 0;
|
|
196
|
+
return message;
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
function longToNumber(int64) {
|
|
200
|
+
const num = globalThis.Number(int64.toString());
|
|
201
|
+
if (num > globalThis.Number.MAX_SAFE_INTEGER) {
|
|
202
|
+
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
|
|
203
|
+
}
|
|
204
|
+
if (num < globalThis.Number.MIN_SAFE_INTEGER) {
|
|
205
|
+
throw new globalThis.Error("Value is smaller than Number.MIN_SAFE_INTEGER");
|
|
206
|
+
}
|
|
207
|
+
return num;
|
|
208
|
+
}
|