@tigeropenapi/tigeropen 0.3.0 → 0.4.5
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/dist/cjs/client/case-convert.js +4 -3
- package/dist/cjs/client/http-client.js +123 -6
- package/dist/cjs/config/client-config.js +56 -12
- package/dist/cjs/config/index.js +3 -1
- package/dist/cjs/config/token-manager.js +54 -4
- package/dist/cjs/index.js +51 -2
- package/dist/cjs/model/enums.js +89 -7
- package/dist/cjs/model/order-status.js +46 -0
- package/dist/cjs/model/quote-requests.js +11 -0
- package/dist/cjs/model/trade-requests.js +13 -0
- package/dist/cjs/push/pb/OrderStatusData.js +24 -0
- package/dist/cjs/push/proto-message.js +6 -0
- package/dist/cjs/push/push-client.js +111 -16
- package/dist/cjs/push/push-message.js +4 -0
- package/dist/cjs/quote/quote-client.js +333 -9
- package/dist/cjs/trade/trade-client.js +204 -25
- package/dist/esm/client/api-request.js +1 -1
- package/dist/esm/client/api-response.js +1 -1
- package/dist/esm/client/case-convert.js +4 -3
- package/dist/esm/client/http-client.js +128 -11
- package/dist/esm/client/index.js +6 -6
- package/dist/esm/config/client-config.js +59 -15
- package/dist/esm/config/index.js +4 -3
- package/dist/esm/config/token-manager.js +55 -5
- package/dist/esm/index.js +15 -1
- package/dist/esm/logger/index.js +1 -1
- package/dist/esm/model/contract-helpers.js +1 -1
- package/dist/esm/model/enums.js +87 -6
- package/dist/esm/model/order-helpers.js +1 -1
- package/dist/esm/model/order-status.js +43 -0
- package/dist/esm/model/quote-requests.js +10 -0
- package/dist/esm/model/trade-requests.js +12 -0
- package/dist/esm/push/index.js +5 -5
- package/dist/esm/push/pb/OrderStatusData.js +24 -0
- package/dist/esm/push/pb/PushData.js +11 -11
- package/dist/esm/push/pb/QuoteBasicData.js +1 -1
- package/dist/esm/push/pb/Response.js +1 -1
- package/dist/esm/push/pb/index.js +17 -17
- package/dist/esm/push/proto-message.js +9 -3
- package/dist/esm/push/push-client.js +118 -23
- package/dist/esm/push/push-message.js +4 -0
- package/dist/esm/quote/index.js +1 -1
- package/dist/esm/quote/quote-client.js +335 -11
- package/dist/esm/signer/index.js +2 -2
- package/dist/esm/trade/index.js +1 -1
- package/dist/esm/trade/trade-client.js +206 -27
- package/dist/types/client/case-convert.d.ts +3 -1
- package/dist/types/client/http-client.d.ts +32 -1
- package/dist/types/config/client-config.d.ts +16 -1
- package/dist/types/config/index.d.ts +2 -0
- package/dist/types/config/token-manager.d.ts +27 -3
- package/dist/types/index.d.ts +22 -1
- package/dist/types/model/enums.d.ts +60 -6
- package/dist/types/model/order-status.d.ts +14 -0
- package/dist/types/model/quote-requests.d.ts +344 -0
- package/dist/types/model/quote.d.ts +261 -0
- package/dist/types/model/trade-requests.d.ts +260 -0
- package/dist/types/model/trade.d.ts +214 -1
- package/dist/types/push/pb/OrderStatusData.d.ts +4 -0
- package/dist/types/push/push-client.d.ts +36 -3
- package/dist/types/push/push-message.d.ts +4 -0
- package/dist/types/quote/quote-client.d.ts +121 -6
- package/dist/types/trade/trade-client.d.ts +95 -12
- package/package.json +2 -2
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* Uses Node.js built-in fetch (Node 18+).
|
|
6
6
|
*/
|
|
7
7
|
import type { ClientConfig } from '../config/client-config';
|
|
8
|
+
import { TokenManager, type TokenManagerOptions } from '../config/token-manager';
|
|
8
9
|
import { RetryPolicy } from './retry';
|
|
9
10
|
import { type ApiResponse } from './api-response';
|
|
10
11
|
import type { ApiRequest } from './api-request';
|
|
@@ -16,9 +17,16 @@ export declare class HttpClient {
|
|
|
16
17
|
private retryPolicy;
|
|
17
18
|
/** Override the target URL (used by quote client to hit quote server) */
|
|
18
19
|
private targetUrl;
|
|
20
|
+
/** non-null when auto-refresh is active */
|
|
21
|
+
private tokenManager;
|
|
19
22
|
constructor(config: ClientConfig, retryPolicy?: RetryPolicy, options?: {
|
|
20
23
|
useQuoteServerUrl?: boolean;
|
|
21
24
|
});
|
|
25
|
+
/**
|
|
26
|
+
* Stop the background token auto-refresh timer.
|
|
27
|
+
* Call this when the HttpClient is no longer needed to avoid timer leaks.
|
|
28
|
+
*/
|
|
29
|
+
close(): void;
|
|
22
30
|
/**
|
|
23
31
|
* Build common request parameters
|
|
24
32
|
*/
|
|
@@ -41,9 +49,32 @@ export declare class HttpClient {
|
|
|
41
49
|
*
|
|
42
50
|
* @param apiMethod - API method name (e.g. "market_state", "place_order")
|
|
43
51
|
* @param requestJson - Raw biz_content JSON string
|
|
52
|
+
* @param version - Optional API version override (default: "2.0")
|
|
44
53
|
* @returns Raw response JSON string, unparsed
|
|
45
54
|
*/
|
|
46
|
-
execute(apiMethod: string, requestJson: string): Promise<string>;
|
|
55
|
+
execute(apiMethod: string, requestJson: string, version?: string): Promise<string>;
|
|
56
|
+
/**
|
|
57
|
+
* 调用 user_token_refresh 接口获取新 token,返回新 token 字符串。
|
|
58
|
+
* 此方法仅查询,不修改 config 中的 token。
|
|
59
|
+
*/
|
|
60
|
+
queryToken(): Promise<string>;
|
|
61
|
+
/**
|
|
62
|
+
* 刷新 token:调用接口获取新 token 后更新 config.token。
|
|
63
|
+
*
|
|
64
|
+
* @param tokenManager - 可选外部 TokenManager;若提供则调用 setToken() 写文件并触发回调。
|
|
65
|
+
* 若 NewHttpClient 已自动启动内部 TokenManager,其内存 token 也会同步更新。
|
|
66
|
+
*/
|
|
67
|
+
refreshToken(tokenManager?: TokenManager | null): Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* 启动后台 token 自动刷新。
|
|
70
|
+
*
|
|
71
|
+
* @param tokenManager - 可为 null:SDK 内部自动创建一个仅内存的 TokenManager,
|
|
72
|
+
* 适合直接通过 token 在代码里设置、不使用文件的场景。
|
|
73
|
+
* @param options - 仅在 tokenManager 为 null 时生效,用于配置内部 TokenManager
|
|
74
|
+
* (refreshDuration / refreshInterval / tokenWriter / tokenLoader)。
|
|
75
|
+
* @returns 使用或创建的 TokenManager 实例
|
|
76
|
+
*/
|
|
77
|
+
startTokenAutoRefresh(tokenManager: TokenManager | null, options?: TokenManagerOptions): TokenManager;
|
|
47
78
|
/** Delay for the specified milliseconds */
|
|
48
79
|
private sleep;
|
|
49
80
|
/**
|
|
@@ -9,6 +9,12 @@ export interface ClientConfig {
|
|
|
9
9
|
timeout: number;
|
|
10
10
|
token?: string;
|
|
11
11
|
tokenRefreshDuration?: number;
|
|
12
|
+
/** 后台 token 检查间隔(毫秒),仅 tokenRefreshDuration > 0 时生效,默认 5 分钟 */
|
|
13
|
+
tokenCheckInterval?: number;
|
|
14
|
+
/** 自定义 token 加载函数,替代默认的文件加载 */
|
|
15
|
+
tokenLoader?: () => Promise<string> | string;
|
|
16
|
+
/** token 刷新写入后的可选回调 */
|
|
17
|
+
tokenWriter?: (token: string) => void;
|
|
12
18
|
serverUrl: string;
|
|
13
19
|
/** Quote server URL for quote-specific requests; falls back to serverUrl */
|
|
14
20
|
quoteServerUrl: string;
|
|
@@ -27,13 +33,22 @@ export interface ClientConfigOptions {
|
|
|
27
33
|
timeout?: number;
|
|
28
34
|
token?: string;
|
|
29
35
|
tokenRefreshDuration?: number;
|
|
36
|
+
/** 后台 token 检查间隔(毫秒),仅 tokenRefreshDuration > 0 时生效,默认 5 分钟 */
|
|
37
|
+
tokenCheckInterval?: number;
|
|
38
|
+
/** 自定义 token 加载函数,替代默认的文件加载 */
|
|
39
|
+
tokenLoader?: () => Promise<string> | string;
|
|
40
|
+
/** token 刷新写入后的可选回调 */
|
|
41
|
+
tokenWriter?: (token: string) => void;
|
|
30
42
|
serverUrl?: string;
|
|
31
43
|
/** Explicit quote server URL; resolved dynamically if not set */
|
|
32
44
|
quoteServerUrl?: string;
|
|
33
45
|
/** Enable dynamic domain resolution (default: true) */
|
|
34
46
|
enableDynamicDomain?: boolean;
|
|
35
|
-
/** Explicit properties file path (synchronous read)
|
|
47
|
+
/** Explicit properties file path or directory (synchronous read).
|
|
48
|
+
* If a directory is given, appends 'tiger_openapi_config.properties' automatically. */
|
|
36
49
|
propertiesFilePath?: string;
|
|
50
|
+
/** Override Tiger public key (e.g. for sandbox/QA environments) */
|
|
51
|
+
tigerPublicKey?: string;
|
|
37
52
|
}
|
|
38
53
|
/**
|
|
39
54
|
* Load and parse a Java-style properties file.
|
|
@@ -4,4 +4,6 @@
|
|
|
4
4
|
export { parsePropertiesFile, parsePropertiesString } from './config-parser';
|
|
5
5
|
export { createClientConfig, loadPropertiesFile } from './client-config';
|
|
6
6
|
export type { ClientConfig, ClientConfigOptions } from './client-config';
|
|
7
|
+
export { TokenManager } from './token-manager';
|
|
8
|
+
export type { TokenManagerOptions, RefreshFn } from './token-manager';
|
|
7
9
|
export { queryDomains, resolveDynamicServerUrl, resolveDynamicQuoteServerUrl } from './domain';
|
|
@@ -4,6 +4,10 @@ export interface TokenManagerOptions {
|
|
|
4
4
|
refreshInterval?: number;
|
|
5
5
|
/** Token 刷新阈值(秒),0 表示不刷新,最小 30 秒 */
|
|
6
6
|
refreshDuration?: number;
|
|
7
|
+
/** 自定义 token 加载函数,优先于文件加载 */
|
|
8
|
+
tokenLoader?: () => Promise<string> | string;
|
|
9
|
+
/** token 写入后的回调(SetToken 成功后触发,SyncToken 不触发) */
|
|
10
|
+
tokenWriter?: (token: string) => void;
|
|
7
11
|
}
|
|
8
12
|
/** Token 刷新函数类型 */
|
|
9
13
|
export type RefreshFn = () => Promise<string>;
|
|
@@ -13,16 +17,36 @@ export type RefreshFn = () => Promise<string>;
|
|
|
13
17
|
export declare class TokenManager {
|
|
14
18
|
private token;
|
|
15
19
|
private filePath;
|
|
20
|
+
/** 仅当显式传入 filePath 时才写文件(fileEnabled = true) */
|
|
21
|
+
private fileEnabled;
|
|
16
22
|
private refreshInterval;
|
|
17
23
|
private refreshDuration;
|
|
18
24
|
private timer;
|
|
25
|
+
private tokenLoader;
|
|
26
|
+
private tokenWriter;
|
|
19
27
|
constructor(options?: TokenManagerOptions);
|
|
20
|
-
/**
|
|
21
|
-
|
|
28
|
+
/**
|
|
29
|
+
* 从 properties 文件(或自定义 tokenLoader)加载 Token。
|
|
30
|
+
* 若设置了 tokenLoader,优先调用;否则从 properties 文件读取。
|
|
31
|
+
*/
|
|
32
|
+
loadToken(): Promise<string>;
|
|
33
|
+
/**
|
|
34
|
+
* 同步版文件加载(仅用于无 tokenLoader 时的兼容入口)。
|
|
35
|
+
* 建议优先使用 loadToken()(异步)。
|
|
36
|
+
*/
|
|
37
|
+
loadTokenSync(): string;
|
|
22
38
|
/** 获取当前 Token */
|
|
23
39
|
getToken(): string;
|
|
24
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* 设置 Token;若启用了文件持久化(显式传入 filePath),则同步写文件。
|
|
42
|
+
* 成功后触发 tokenWriter 回调(如有)。
|
|
43
|
+
*/
|
|
25
44
|
setToken(token: string): void;
|
|
45
|
+
/**
|
|
46
|
+
* 仅更新内存中的 token,不写文件,不触发 tokenWriter 回调。
|
|
47
|
+
* 用于多个组件共享 token 时的内部同步。
|
|
48
|
+
*/
|
|
49
|
+
syncToken(token: string): void;
|
|
26
50
|
/** 将 Token 保存到 properties 文件 */
|
|
27
51
|
private saveTokenToFile;
|
|
28
52
|
/**
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,4 +15,25 @@
|
|
|
15
15
|
* @packageDocumentation
|
|
16
16
|
*/
|
|
17
17
|
/** SDK 版本号 */
|
|
18
|
-
export declare const VERSION = "0.
|
|
18
|
+
export declare const VERSION = "0.4.4";
|
|
19
|
+
export { createClientConfig, loadPropertiesFile } from './config';
|
|
20
|
+
export type { ClientConfig, ClientConfigOptions } from './config';
|
|
21
|
+
export { TokenManager } from './config';
|
|
22
|
+
export type { TokenManagerOptions, RefreshFn } from './config';
|
|
23
|
+
export { HttpClient } from './client';
|
|
24
|
+
export { TigerError, classifyErrorCode } from './client';
|
|
25
|
+
export type { ErrorCategory } from './client';
|
|
26
|
+
export { QuoteClient, parseOptionIdentifier } from './quote';
|
|
27
|
+
export { TradeClient } from './trade';
|
|
28
|
+
export { PushClient, ConnectionState, SubjectType } from './push';
|
|
29
|
+
export type { PushClientOptions } from './push';
|
|
30
|
+
export type { Order, OrderRequest } from './model/order';
|
|
31
|
+
export { marketOrder, limitOrder, stopOrder, stopLimitOrder } from './model/order-helpers';
|
|
32
|
+
export { normalizeOrderStatus } from './model/order-status';
|
|
33
|
+
export type { Contract } from './model/contract';
|
|
34
|
+
export type { Position } from './model/position';
|
|
35
|
+
export type { Asset, AssetSegment, PrimeAsset, PreviewResult, PlaceOrderResult, OrderIdResult, Transaction, ManagedAccount, AnalyticsAsset, AggregateAssets, EstimateTradableQuantity, ForexOrderResult, SegmentFund, SegmentFundAvailableItem, SegmentFundHistoryItem, FundDetails, FundingHistoryItem, PositionTransferRecord, PositionTransferDetail, PositionTransferExternalRecord, OptionExerciseCheckResult, OptionExercisePositionPageResult, OptionExerciseRecordPageResult, } from './model/trade';
|
|
36
|
+
export type { OrdersRequest, GetOrderRequest, OrderTransactionsRequest, PositionsRequest, AssetsRequest, ManagedAccountsRequest, DerivativeContractsRequest, AnalyticsAssetRequest, AggregateAssetsRequest, EstimateTradableQuantityRequest, ForexOrderRequest, SegmentFundRequest, FundDetailsRequest, FundingHistoryRequest, PositionTransferRequest, PositionTransferRecordsRequest, PositionTransferDetailRequest, PositionTransferExternalRecordsRequest, OptionExerciseCheckRequest, OptionExercisePositionRequest, OptionExerciseSubmitRequest, OptionExerciseRecordsRequest, OptionExerciseCancelRequest, } from './model/trade-requests';
|
|
37
|
+
export type { MarketState, Brief, Kline, KlineItem, Timeline, TimelineItem, TradeTick, TradeTickItem, Depth, DepthLevel, OptionExpiration, OptionChain, OptionChainRow, OptionSymbol, FutureExchange, FutureContractInfo, FutureQuote, FutureKline, FutureKlineItem, FutureDepth, FutureTradeTickItem, FutureTradingTime, FinancialDailyItem, FinancialReportItem, CorporateAction, CapitalFlow, CapitalFlowItem, CapitalDistribution, ScannerResult, ScannerResultItem, QuotePermission, SymbolName, TradeMeta, StockDetail, StockBroker, StockBrokerItem, ShortInterest, StockIndustry, IndustryItem, IndustryStock, WarrantBrief, WarrantFilterResult, FundContractInfo, FundQuote, FundHistoryQuote, QuoteOvernight, KlineQuota, MarketScannerTag, MarketScannerTags, OptionAnalysis, OptionLeg, OptionVolatilityPoint, ExchangeRate, FinancialCurrency, BrokerDetail, TradingCalendarItem, FutureMainContractHistory, } from './model/quote';
|
|
38
|
+
export type { BriefRequest, DepthQuoteRequest, TradeTickRequest, BarsRequest, BarsByPageRequest, FutureBriefRequest, FutureBarsRequest, FutureBarsByPageRequest, FutureTradeTicksRequest, FutureDepthRequest, FutureContractSingleRequest, FutureContinuousContractsRequest, FutureHistoryMainContractRequest, FutureTradingTimesRequest, AllFutureContractsRequest, OptionBarsRequest, OptionTradeTicksRequest, OptionTimelineRequest, OptionDepthRequest, OptionSymbolsRequest, OptionAnalysisRequest, OptionQueryItem, ShortInterestRequest, StockBrokerRequest, StockDetailsRequest, StockFundamentalRequest, StockIndustryRequest, StockDelayBriefsRequest, SymbolsRequest, TradeMetasRequest, TradeRankRequest, TimelineHistoryRequest, TradingCalendarRequest, KlineQuotaRequest, QuotePermissionRequest, QuoteOvernightRequest, IndustryListRequest, IndustryStocksRequest, FundSymbolsRequest, FundContractsRequest, FundQuoteRequest, FundHistoryQuoteRequest, WarrantBriefsRequest, WarrantFilterRequest, MarketScannerTagsRequest, FinancialCurrencyRequest, FinancialExchangeRateRequest, } from './model/quote-requests';
|
|
39
|
+
export { OrderStatus, SecurityType, OrderType, TimeInForce, Market, Currency, QuoteRight, SegmentType, OrderSortBy, CorporateActionType, IndustryLevel, SortDirection, OptionAnalysisPeriod, FinancialReportPeriod, Language, License, BarPeriod, orderStatusCode, } from './model/enums';
|
|
@@ -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
|
+
}
|
|
@@ -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;
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quote request interfaces (v0.4.0).
|
|
3
|
+
*
|
|
4
|
+
* 所有字段可选(用户调用时传一个空对象即可);字段名用 camelCase,
|
|
5
|
+
* client 层通过 keysToSnakeCase 转成服务端 wire 真名的 snake_case。
|
|
6
|
+
* **字段名设计规则:camelCase → snake_case 后必须等于服务端 wire 真名。**
|
|
7
|
+
*
|
|
8
|
+
* 参考 Go SDK model/quote_requests.go。
|
|
9
|
+
*/
|
|
10
|
+
/** Real-time stock quotes. wire: quote_real_time */
|
|
11
|
+
export interface BriefRequest {
|
|
12
|
+
symbols?: string[];
|
|
13
|
+
includeHourTrading?: boolean;
|
|
14
|
+
secType?: string;
|
|
15
|
+
lang?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Order-book depth. wire: quote_depth */
|
|
18
|
+
export interface DepthQuoteRequest {
|
|
19
|
+
symbols?: string[];
|
|
20
|
+
market?: string;
|
|
21
|
+
tradeSession?: string;
|
|
22
|
+
lang?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Tick-by-tick trades. wire: trade_tick */
|
|
25
|
+
export interface TradeTickRequest {
|
|
26
|
+
symbols?: string[];
|
|
27
|
+
beginIndex?: number;
|
|
28
|
+
endIndex?: number;
|
|
29
|
+
limit?: number;
|
|
30
|
+
lang?: string;
|
|
31
|
+
}
|
|
32
|
+
/** Real-time futures quotes. wire: future_brief */
|
|
33
|
+
export interface FutureBriefRequest {
|
|
34
|
+
contractCodes?: string[];
|
|
35
|
+
lang?: string;
|
|
36
|
+
}
|
|
37
|
+
/** All symbols / symbol names. wire: all_symbols / all_symbol_names */
|
|
38
|
+
export interface SymbolsRequest {
|
|
39
|
+
market?: string;
|
|
40
|
+
secType?: string;
|
|
41
|
+
includeOtc?: boolean;
|
|
42
|
+
lang?: string;
|
|
43
|
+
}
|
|
44
|
+
/** Trade meta (lot size / tick size / shortable). wire: quote_stock_trade */
|
|
45
|
+
export interface TradeMetasRequest {
|
|
46
|
+
symbols?: string[];
|
|
47
|
+
lang?: string;
|
|
48
|
+
}
|
|
49
|
+
/** Stock details. wire: stock_detail. Server returns {items:[...]}. */
|
|
50
|
+
export interface StockDetailsRequest {
|
|
51
|
+
symbols?: string[];
|
|
52
|
+
secType?: string;
|
|
53
|
+
lang?: string;
|
|
54
|
+
}
|
|
55
|
+
/** Delayed stock briefs. wire: quote_delay */
|
|
56
|
+
export interface StockDelayBriefsRequest {
|
|
57
|
+
symbols?: string[];
|
|
58
|
+
secType?: string;
|
|
59
|
+
lang?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* K-line bars (full options). wire: kline
|
|
63
|
+
* BeginTime/EndTime (ms) and BeginIndex/EndIndex are mutually exclusive.
|
|
64
|
+
*/
|
|
65
|
+
export interface BarsRequest {
|
|
66
|
+
symbols?: string[];
|
|
67
|
+
period?: string;
|
|
68
|
+
right?: string;
|
|
69
|
+
beginTime?: number;
|
|
70
|
+
endTime?: number;
|
|
71
|
+
limit?: number;
|
|
72
|
+
beginIndex?: number;
|
|
73
|
+
endIndex?: number;
|
|
74
|
+
pageToken?: string;
|
|
75
|
+
tradeSession?: string;
|
|
76
|
+
date?: string;
|
|
77
|
+
withFundamental?: boolean;
|
|
78
|
+
secType?: string;
|
|
79
|
+
lang?: string;
|
|
80
|
+
}
|
|
81
|
+
/** K-line client-side pagination wrapper. */
|
|
82
|
+
export interface BarsByPageRequest {
|
|
83
|
+
symbol?: string;
|
|
84
|
+
period?: string;
|
|
85
|
+
beginTime?: number;
|
|
86
|
+
endTime?: number;
|
|
87
|
+
totalSize?: number;
|
|
88
|
+
pageSize?: number;
|
|
89
|
+
right?: string;
|
|
90
|
+
lang?: string;
|
|
91
|
+
tradeSession?: string;
|
|
92
|
+
}
|
|
93
|
+
/** Historical intraday timeline. wire: history_timeline */
|
|
94
|
+
export interface TimelineHistoryRequest {
|
|
95
|
+
symbols?: string[];
|
|
96
|
+
/** yyyy-MM-dd */
|
|
97
|
+
date?: string;
|
|
98
|
+
right?: string;
|
|
99
|
+
tradeSession?: string;
|
|
100
|
+
lang?: string;
|
|
101
|
+
}
|
|
102
|
+
/** Trade rank (top movers / volume). wire: trade_rank */
|
|
103
|
+
export interface TradeRankRequest {
|
|
104
|
+
market?: string;
|
|
105
|
+
lang?: string;
|
|
106
|
+
}
|
|
107
|
+
/** Short interest. wire: quote_shortable_stocks */
|
|
108
|
+
export interface ShortInterestRequest {
|
|
109
|
+
symbols?: string[];
|
|
110
|
+
lang?: string;
|
|
111
|
+
}
|
|
112
|
+
/** Broker queue. wire: stock_broker */
|
|
113
|
+
export interface StockBrokerRequest {
|
|
114
|
+
symbol?: string;
|
|
115
|
+
limit?: number;
|
|
116
|
+
secType?: string;
|
|
117
|
+
lang?: string;
|
|
118
|
+
}
|
|
119
|
+
/** Stock fundamentals. wire: stock_fundamental */
|
|
120
|
+
export interface StockFundamentalRequest {
|
|
121
|
+
symbols?: string[];
|
|
122
|
+
market?: string;
|
|
123
|
+
secType?: string;
|
|
124
|
+
lang?: string;
|
|
125
|
+
}
|
|
126
|
+
/** Stock industry classification. wire: stock_industry */
|
|
127
|
+
export interface StockIndustryRequest {
|
|
128
|
+
symbol?: string;
|
|
129
|
+
market?: string;
|
|
130
|
+
secType?: string;
|
|
131
|
+
lang?: string;
|
|
132
|
+
}
|
|
133
|
+
/** K-line quota. wire: kline_quota */
|
|
134
|
+
export interface KlineQuotaRequest {
|
|
135
|
+
withDetails?: boolean;
|
|
136
|
+
lang?: string;
|
|
137
|
+
}
|
|
138
|
+
/** Quote permission detail. wire: get_quote_permission */
|
|
139
|
+
export interface QuotePermissionRequest {
|
|
140
|
+
beginDate?: string;
|
|
141
|
+
endDate?: string;
|
|
142
|
+
lang?: string;
|
|
143
|
+
}
|
|
144
|
+
/** Nested option query item used by option_query / option_basic / contracts. */
|
|
145
|
+
export interface OptionQueryItem {
|
|
146
|
+
symbol?: string;
|
|
147
|
+
expiry?: number;
|
|
148
|
+
strike?: string;
|
|
149
|
+
right?: string;
|
|
150
|
+
period?: string;
|
|
151
|
+
beginTime?: number;
|
|
152
|
+
endTime?: number;
|
|
153
|
+
limit?: number;
|
|
154
|
+
beginIndex?: number;
|
|
155
|
+
endIndex?: number;
|
|
156
|
+
pageToken?: string;
|
|
157
|
+
}
|
|
158
|
+
/** Option K-line. wire: option_kline (v2.0) */
|
|
159
|
+
export interface OptionBarsRequest {
|
|
160
|
+
optionQuery?: OptionQueryItem[];
|
|
161
|
+
market?: string;
|
|
162
|
+
lang?: string;
|
|
163
|
+
}
|
|
164
|
+
/** Option tick trades. wire: option_trade_tick */
|
|
165
|
+
export interface OptionTradeTicksRequest {
|
|
166
|
+
contracts?: OptionQueryItem[];
|
|
167
|
+
lang?: string;
|
|
168
|
+
}
|
|
169
|
+
/** Option intraday timeline. wire: option_timeline */
|
|
170
|
+
export interface OptionTimelineRequest {
|
|
171
|
+
optionQuery?: OptionQueryItem[];
|
|
172
|
+
market?: string;
|
|
173
|
+
lang?: string;
|
|
174
|
+
}
|
|
175
|
+
/** Option order-book depth. wire: option_depth */
|
|
176
|
+
export interface OptionDepthRequest {
|
|
177
|
+
optionBasic?: OptionQueryItem[];
|
|
178
|
+
market?: string;
|
|
179
|
+
lang?: string;
|
|
180
|
+
}
|
|
181
|
+
/** Available option symbols. wire: option_symbol */
|
|
182
|
+
export interface OptionSymbolsRequest {
|
|
183
|
+
market?: string;
|
|
184
|
+
lang?: string;
|
|
185
|
+
}
|
|
186
|
+
/** Option analysis (volatility). wire: option_analysis */
|
|
187
|
+
export interface OptionAnalysisRequest {
|
|
188
|
+
symbols?: string[];
|
|
189
|
+
market?: string;
|
|
190
|
+
period?: string;
|
|
191
|
+
requireVolatilityList?: boolean;
|
|
192
|
+
lang?: string;
|
|
193
|
+
}
|
|
194
|
+
/** Lookup a futures contract by code. wire: future_contract_by_contract_code / future_current_contract */
|
|
195
|
+
export interface FutureContractSingleRequest {
|
|
196
|
+
contractCode?: string;
|
|
197
|
+
type?: string;
|
|
198
|
+
lang?: string;
|
|
199
|
+
}
|
|
200
|
+
/** List all futures contracts. wire: future_contracts */
|
|
201
|
+
export interface AllFutureContractsRequest {
|
|
202
|
+
type?: string;
|
|
203
|
+
exchange?: string;
|
|
204
|
+
lang?: string;
|
|
205
|
+
}
|
|
206
|
+
/** Continuous main contracts. wire: future_continuous_contracts */
|
|
207
|
+
export interface FutureContinuousContractsRequest {
|
|
208
|
+
type?: string;
|
|
209
|
+
lang?: string;
|
|
210
|
+
}
|
|
211
|
+
/** Historical main contracts. wire: future_main_contract */
|
|
212
|
+
export interface FutureHistoryMainContractRequest {
|
|
213
|
+
contractCodes?: string[];
|
|
214
|
+
beginTime?: number;
|
|
215
|
+
endTime?: number;
|
|
216
|
+
lang?: string;
|
|
217
|
+
}
|
|
218
|
+
/** Futures K-line (index + pagination). wire: future_kline */
|
|
219
|
+
export interface FutureBarsRequest {
|
|
220
|
+
contractCodes?: string[];
|
|
221
|
+
contractCode?: string;
|
|
222
|
+
period?: string;
|
|
223
|
+
beginTime?: number;
|
|
224
|
+
endTime?: number;
|
|
225
|
+
beginIndex?: number;
|
|
226
|
+
endIndex?: number;
|
|
227
|
+
limit?: number;
|
|
228
|
+
pageToken?: string;
|
|
229
|
+
lang?: string;
|
|
230
|
+
}
|
|
231
|
+
/** Futures K-line client-side pagination wrapper. */
|
|
232
|
+
export interface FutureBarsByPageRequest {
|
|
233
|
+
contractCode?: string;
|
|
234
|
+
period?: string;
|
|
235
|
+
beginTime?: number;
|
|
236
|
+
endTime?: number;
|
|
237
|
+
totalSize?: number;
|
|
238
|
+
pageSize?: number;
|
|
239
|
+
lang?: string;
|
|
240
|
+
}
|
|
241
|
+
/** Futures tick trades. wire: future_tick (v3.0) */
|
|
242
|
+
export interface FutureTradeTicksRequest {
|
|
243
|
+
contractCode?: string;
|
|
244
|
+
beginIndex?: number;
|
|
245
|
+
endIndex?: number;
|
|
246
|
+
limit?: number;
|
|
247
|
+
lang?: string;
|
|
248
|
+
}
|
|
249
|
+
/** Futures depth. wire: future_depth */
|
|
250
|
+
export interface FutureDepthRequest {
|
|
251
|
+
contractCodes?: string[];
|
|
252
|
+
lang?: string;
|
|
253
|
+
}
|
|
254
|
+
/** Futures trading session times. wire: future_trading_date */
|
|
255
|
+
export interface FutureTradingTimesRequest {
|
|
256
|
+
contractCode?: string;
|
|
257
|
+
tradingDate?: string;
|
|
258
|
+
lang?: string;
|
|
259
|
+
}
|
|
260
|
+
/** Fund symbols. wire: fund_all_symbols */
|
|
261
|
+
export interface FundSymbolsRequest {
|
|
262
|
+
lang?: string;
|
|
263
|
+
}
|
|
264
|
+
/** Fund contracts. wire: fund_contracts */
|
|
265
|
+
export interface FundContractsRequest {
|
|
266
|
+
symbols?: string[];
|
|
267
|
+
lang?: string;
|
|
268
|
+
}
|
|
269
|
+
/** Fund real-time NAV. wire: fund_quote */
|
|
270
|
+
export interface FundQuoteRequest {
|
|
271
|
+
symbols?: string[];
|
|
272
|
+
lang?: string;
|
|
273
|
+
}
|
|
274
|
+
/** Fund historical NAV. wire: fund_history_quote */
|
|
275
|
+
export interface FundHistoryQuoteRequest {
|
|
276
|
+
symbols?: string[];
|
|
277
|
+
beginTime?: number;
|
|
278
|
+
endTime?: number;
|
|
279
|
+
limit?: number;
|
|
280
|
+
lang?: string;
|
|
281
|
+
}
|
|
282
|
+
/** Warrant briefs. wire: warrant_briefs */
|
|
283
|
+
export interface WarrantBriefsRequest {
|
|
284
|
+
symbols?: string[];
|
|
285
|
+
lang?: string;
|
|
286
|
+
}
|
|
287
|
+
/** Warrant filter (paginated). wire: warrant_filter */
|
|
288
|
+
export interface WarrantFilterRequest {
|
|
289
|
+
symbol?: string;
|
|
290
|
+
page?: number;
|
|
291
|
+
pageSize?: number;
|
|
292
|
+
sortFieldName?: string;
|
|
293
|
+
sortDir?: string;
|
|
294
|
+
issuerName?: string;
|
|
295
|
+
expireYm?: string;
|
|
296
|
+
lang?: string;
|
|
297
|
+
}
|
|
298
|
+
/** Industry list. wire: industry_list */
|
|
299
|
+
export interface IndustryListRequest {
|
|
300
|
+
/** IndustryLevel enum value */
|
|
301
|
+
industryLevel?: string;
|
|
302
|
+
lang?: string;
|
|
303
|
+
}
|
|
304
|
+
/** Stocks in an industry. wire: industry_stock_list */
|
|
305
|
+
export interface IndustryStocksRequest {
|
|
306
|
+
industryId?: string;
|
|
307
|
+
market?: string;
|
|
308
|
+
lang?: string;
|
|
309
|
+
}
|
|
310
|
+
/** Trading calendar. wire: trading_calendar */
|
|
311
|
+
export interface TradingCalendarRequest {
|
|
312
|
+
market?: string;
|
|
313
|
+
/** yyyy-MM-dd */
|
|
314
|
+
beginDate?: string;
|
|
315
|
+
endDate?: string;
|
|
316
|
+
lang?: string;
|
|
317
|
+
}
|
|
318
|
+
/** FX rates. wire: financial_exchange_rate */
|
|
319
|
+
export interface FinancialExchangeRateRequest {
|
|
320
|
+
currencyList?: string[];
|
|
321
|
+
/** yyyyMMdd */
|
|
322
|
+
beginDate?: string;
|
|
323
|
+
endDate?: string;
|
|
324
|
+
timezone?: string;
|
|
325
|
+
lang?: string;
|
|
326
|
+
}
|
|
327
|
+
/** Financial currency per symbol. wire: financial_currency */
|
|
328
|
+
export interface FinancialCurrencyRequest {
|
|
329
|
+
symbols?: string[];
|
|
330
|
+
market?: string;
|
|
331
|
+
lang?: string;
|
|
332
|
+
}
|
|
333
|
+
/** Market scanner tags. wire: market_scanner_tags */
|
|
334
|
+
export interface MarketScannerTagsRequest {
|
|
335
|
+
market?: string;
|
|
336
|
+
/** wire: multi_tag_field_list */
|
|
337
|
+
multiTagFieldList?: string[];
|
|
338
|
+
lang?: string;
|
|
339
|
+
}
|
|
340
|
+
/** Overnight quote. wire: quote_overnight */
|
|
341
|
+
export interface QuoteOvernightRequest {
|
|
342
|
+
symbols?: string[];
|
|
343
|
+
lang?: string;
|
|
344
|
+
}
|