tigeropen 0.5.5 → 0.5.8

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.
Files changed (47) hide show
  1. package/README.md +173 -0
  2. package/dist/cjs/client/api-response.js +6 -5
  3. package/dist/cjs/index.js +4 -2
  4. package/dist/cjs/model/news-requests.js +9 -0
  5. package/dist/cjs/model/news.js +8 -0
  6. package/dist/cjs/news/index.js +8 -0
  7. package/dist/cjs/news/news-client.js +84 -0
  8. package/dist/cjs/push/pb/QuoteBasicData.js +37 -1
  9. package/dist/cjs/push/pb/QuoteData.js +37 -1
  10. package/dist/cjs/push/pb/Request.js +12 -1
  11. package/dist/cjs/push/proto-message.js +5 -1
  12. package/dist/cjs/push/push-client.js +29 -13
  13. package/dist/cjs/quote/quote-client.js +4 -1
  14. package/dist/cjs/trade/trade-client.js +26 -5
  15. package/dist/cjs/version.js +1 -1
  16. package/dist/esm/client/api-response.js +6 -5
  17. package/dist/esm/index.js +2 -1
  18. package/dist/esm/model/news-requests.js +8 -0
  19. package/dist/esm/model/news.js +7 -0
  20. package/dist/esm/news/index.js +4 -0
  21. package/dist/esm/news/news-client.js +80 -0
  22. package/dist/esm/package.json +3 -0
  23. package/dist/esm/push/pb/QuoteBasicData.js +37 -1
  24. package/dist/esm/push/pb/QuoteData.js +37 -1
  25. package/dist/esm/push/pb/Request.js +12 -1
  26. package/dist/esm/push/proto-message.js +5 -1
  27. package/dist/esm/push/push-client.js +29 -13
  28. package/dist/esm/quote/quote-client.js +4 -1
  29. package/dist/esm/trade/trade-client.js +26 -5
  30. package/dist/esm/version.js +1 -1
  31. package/dist/types/index.d.ts +7 -3
  32. package/dist/types/model/news-requests.d.ts +39 -0
  33. package/dist/types/model/news.d.ts +38 -0
  34. package/dist/types/model/quote.d.ts +17 -0
  35. package/dist/types/model/trade-requests.d.ts +7 -1
  36. package/dist/types/news/index.d.ts +5 -0
  37. package/dist/types/news/news-client.d.ts +60 -0
  38. package/dist/types/push/index.d.ts +1 -1
  39. package/dist/types/push/pb/QuoteBasicData.d.ts +14 -5
  40. package/dist/types/push/pb/QuoteData.d.ts +14 -5
  41. package/dist/types/push/pb/Request.d.ts +1 -0
  42. package/dist/types/push/proto-message.d.ts +4 -1
  43. package/dist/types/push/push-client.d.ts +33 -0
  44. package/dist/types/quote/quote-client.d.ts +2 -1
  45. package/dist/types/trade/trade-client.d.ts +14 -4
  46. package/dist/types/version.d.ts +1 -1
  47. package/package.json +6 -4
@@ -199,11 +199,23 @@ export class TradeClient {
199
199
  }
200
200
  /**
201
201
  * Get a single order by ID (v0.4.0 new).
202
- * Returns `undefined` if no match.
202
+ * Wire method: `orders` with `id` / `order_id` parameters.
203
+ * Returns `undefined` if no match or the result contains multiple orders.
203
204
  */
204
205
  async getOrder(req) {
205
206
  const merged = withAccount(req, this.account);
206
- const out = await this.callInto('order_no', merged);
207
+ const data = await this.callInto('orders', merged);
208
+ let out;
209
+ if (Array.isArray(data)) {
210
+ out = data.length === 1 ? data[0] : undefined;
211
+ }
212
+ else if (data && typeof data === 'object' && 'items' in data) {
213
+ const items = data.items;
214
+ out = Array.isArray(items) && items.length === 1 ? items[0] : undefined;
215
+ }
216
+ else {
217
+ out = data;
218
+ }
207
219
  if (!out || (!out.id && !out.orderId))
208
220
  return undefined;
209
221
  normalizeOrderInPlace(out);
@@ -221,11 +233,17 @@ export class TradeClient {
221
233
  async getPositions(req) {
222
234
  return this.callIntoItems('positions', withAccount(req, this.account));
223
235
  }
224
- /** Query assets. v0.4.0: supports sub-account list and aggregation options. */
236
+ /**
237
+ * Query assets. v0.4.0: supports sub-account list and aggregation options.
238
+ * `assetQuoteType`(ETH / RTH / OVERNIGHT) 选择资产行情口径。
239
+ */
225
240
  async getAssets(req) {
226
241
  return this.callIntoItems('assets', withAccount(req, this.account));
227
242
  }
228
- /** Query prime assets. v0.4.0: takes AssetsRequest for filters. */
243
+ /**
244
+ * Query prime assets. v0.4.0: takes AssetsRequest for filters.
245
+ * `assetQuoteType`(ETH / RTH / OVERNIGHT) 选择资产行情口径。
246
+ */
229
247
  async getPrimeAssets(req) {
230
248
  return this.callInto('prime_assets', withAccount(req, this.account));
231
249
  }
@@ -246,7 +264,10 @@ export class TradeClient {
246
264
  async getAnalyticsAsset(req) {
247
265
  return this.callIntoItems('analytics_asset', withAccount(req, this.account));
248
266
  }
249
- /** Aggregate assets (prime) by base currency. */
267
+ /**
268
+ * Aggregate assets (prime) by base currency.
269
+ * `assetQuoteType`(ETH / RTH / OVERNIGHT) 选择资产行情口径。
270
+ */
250
271
  async getAggregateAssets(req) {
251
272
  return this.callInto('aggregate_assets', withAccount(req, this.account));
252
273
  }
@@ -1 +1 @@
1
- export const SDK_VERSION = '0.4.8';
1
+ export const SDK_VERSION = '0.5.8';
@@ -9,7 +9,7 @@
9
9
  * - 配置层(config):ClientConfig、ConfigParser
10
10
  * - 认证层(signer):RSA 签名
11
11
  * - 传输层(client):HttpClient、重试策略
12
- * - 业务层(quote/trade):QuoteClient、TradeClient
12
+ * - 业务层(quote/trade/news):QuoteClient、TradeClient、NewsClient
13
13
  * - 推送层(push):PushClient
14
14
  *
15
15
  * @packageDocumentation
@@ -25,8 +25,10 @@ export { TigerError, classifyErrorCode } from './client';
25
25
  export type { ErrorCategory } from './client';
26
26
  export { QuoteClient, parseOptionIdentifier } from './quote';
27
27
  export { TradeClient } from './trade';
28
+ export { NewsClient } from './news';
29
+ export type { NewsClientOptions } from './news';
28
30
  export { PushClient, ConnectionState, SubjectType } from './push';
29
- export type { PushClientOptions } from './push';
31
+ export type { PushClientOptions, AccountSubscribeOptions } from './push';
30
32
  export type { Order, OrderRequest, ContractLegRequest } from './model/order';
31
33
  export { marketOrder, limitOrder, stopOrder, stopLimitOrder } from './model/order-helpers';
32
34
  export { normalizeOrderStatus } from './model/order-status';
@@ -34,6 +36,8 @@ export type { Contract } from './model/contract';
34
36
  export type { Position } from './model/position';
35
37
  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
38
  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, OptionChainFilter, OptionChainFilterGreeks, Range, FutureExchange, FutureContractInfo, FutureQuote, FutureKline, FutureKlineItem, FutureDepth, FutureTradeTickItem, FutureTradingTime, FinancialDailyItem, FinancialReportItem, CorporateAction, CorporateSymbolChange, CorporateDelisting, CorporateIPO, 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';
39
+ export type { MarketState, Brief, Kline, KlineItem, Timeline, TimelineItem, TradeTick, TradeTickItem, Depth, DepthLevel, OptionExpiration, OptionHourTrading, OptionChain, OptionChainRow, OptionSymbol, OptionChainFilter, OptionChainFilterGreeks, Range, FutureExchange, FutureContractInfo, FutureQuote, FutureKline, FutureKlineItem, FutureDepth, FutureTradeTickItem, FutureTradingTime, FinancialDailyItem, FinancialReportItem, CorporateAction, CorporateSymbolChange, CorporateDelisting, CorporateIPO, 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
40
  export type { BriefRequest, DepthQuoteRequest, TradeTickRequest, KlineRequest, KlineByPageRequest, TimelineRequest, FutureBriefRequest, FutureKlineRequest, FutureKlineByPageRequest, FutureTradeTicksRequest, FutureDepthRequest, FutureContractSingleRequest, FutureContinuousContractsRequest, FutureHistoryMainContractRequest, FutureTradingTimesRequest, AllFutureContractsRequest, 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';
41
+ export type { NewsItem, NewsPage } from './model/news';
42
+ export type { NewsStockListRequest, NewsHighlightListRequest } from './model/news-requests';
39
43
  export { OrderStatus, SecurityType, OrderType, TimeInForce, Market, Currency, QuoteRight, SegmentType, OrderSortBy, CorporateActionType, IndustryLevel, SortDirection, OptionAnalysisPeriod, FinancialReportPeriod, Language, License, BarPeriod, orderStatusCode, } from './model/enums';
@@ -0,0 +1,39 @@
1
+ /**
2
+ * 资讯请求参数模型(wire: news_stock_list / news_highlight_list)。
3
+ *
4
+ * TypeScript 侧使用 camelCase,序列化时由 createApiRequest 自动转为
5
+ * snake_case(契约决策 #13:入参 snake_case)。可选字段不传时不出现在
6
+ * biz_content 中,由服务端取缺省值。
7
+ */
8
+ /**
9
+ * 个股新闻列表请求。wire: news_stock_list
10
+ *
11
+ * symbol 单标的必填(下游资讯服务实际不支持批量查询,契约决策 #5);
12
+ * pageCount / pageSize 缺省时服务端默认 1 / 20(决策 #6);
13
+ * lang 可选('zh_CN' / 'zh_TW' / 'en_US')。
14
+ */
15
+ export interface NewsStockListRequest {
16
+ /** 股票代码,必填、单标的(如 "AAPL",该接口不支持批量查询) */
17
+ symbol: string;
18
+ /** 页码,缺省 = 1;显式传值须 >= 1(越界由服务端报参数错误) */
19
+ pageCount?: number;
20
+ /** 每页条数,缺省 = 20;显式传值须 1-50(闭区间) */
21
+ pageSize?: number;
22
+ /** 内容语言:'zh_CN' / 'zh_TW' / 'en_US' */
23
+ lang?: string;
24
+ }
25
+ /**
26
+ * 市场要闻列表请求。wire: news_highlight_list
27
+ *
28
+ * 翻页只走 lastId 游标(契约决策 #14,该接口无 page_count / page_size);
29
+ * lang 语义同 NewsStockListRequest。
30
+ */
31
+ export interface NewsHighlightListRequest {
32
+ /**
33
+ * 游标翻页:取上一页 items 最后一条的 id;不传从最新开始。
34
+ * 这是本接口唯一的翻页方式。
35
+ */
36
+ lastId?: string;
37
+ /** 内容语言:'zh_CN' / 'zh_TW' / 'en_US' */
38
+ lang?: string;
39
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * 资讯数据模型(news_stock_list / news_highlight_list 共用)。
3
+ *
4
+ * 服务端响应出参为 camelCase(契约决策 #13),与 TypeScript 字段名一致,
5
+ * 响应侧无需命名转换。
6
+ */
7
+ /**
8
+ * 资讯条目(news_stock_list 与 news_highlight_list 共用,契约 §3.3)。
9
+ */
10
+ export interface NewsItem {
11
+ /** 资讯 ID(同时是 highlight 游标翻页 last_id 的取值来源) */
12
+ id?: string;
13
+ /** 标题 */
14
+ title?: string;
15
+ /** 摘要 */
16
+ summary?: string;
17
+ /** 发布时间戳(秒级) */
18
+ pubTimestamp?: number;
19
+ /** 原文链接 */
20
+ url?: string;
21
+ }
22
+ /**
23
+ * 资讯列表分页信封(news_stock_list 与 news_highlight_list 共用,契约 §3.3)。
24
+ *
25
+ * news_highlight_list 仅支持 last_id 游标翻页(决策 #14),其 pageCount 恒为 1。
26
+ */
27
+ export interface NewsPage {
28
+ /** 当前页资讯列表(下游返回空 items 属正常成功) */
29
+ items: NewsItem[];
30
+ /** 当前页码(highlight 接口恒为 1) */
31
+ pageCount?: number;
32
+ /** 每页条数 */
33
+ pageSize?: number;
34
+ /** 总页数 */
35
+ totalPage?: number;
36
+ /** 总条数 */
37
+ totalSize?: number;
38
+ }
@@ -9,7 +9,20 @@ export interface MarketState {
9
9
  status: string;
10
10
  openTime?: string;
11
11
  }
12
+ /** Current GTH/CURB option quote. Absent/null during regular trading. */
13
+ export interface OptionHourTrading {
14
+ tag?: string;
15
+ session?: string;
16
+ latestPrice?: number;
17
+ latestTimestamp?: number;
18
+ volume?: number;
19
+ amount?: number;
20
+ preClose?: number;
21
+ }
12
22
  export interface Brief {
23
+ cumVolume?: number;
24
+ cumAmount?: number;
25
+ hourTrading?: OptionHourTrading | null;
13
26
  symbol: string;
14
27
  open?: number;
15
28
  high?: number;
@@ -23,6 +36,7 @@ export interface Brief {
23
36
  bidPrice?: number;
24
37
  bidSize?: number;
25
38
  volume?: number;
39
+ amount?: number;
26
40
  status?: string;
27
41
  adjPreClose?: number;
28
42
  change?: number;
@@ -102,6 +116,9 @@ export interface OptionExpiration {
102
116
  counts?: number[];
103
117
  }
104
118
  export interface OptionLeg {
119
+ cumVolume?: number;
120
+ cumAmount?: number;
121
+ hourTrading?: OptionHourTrading | null;
105
122
  identifier: string;
106
123
  strike: string;
107
124
  right: string;
@@ -36,7 +36,8 @@ export interface GetOrderRequest {
36
36
  account?: string;
37
37
  /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
38
38
  secretKey?: string;
39
- id?: number;
39
+ /** Global order ID; use a string for values above Number.MAX_SAFE_INTEGER. */
40
+ id?: number | string;
40
41
  orderId?: number;
41
42
  isBrief?: boolean;
42
43
  showCharges?: boolean;
@@ -72,6 +73,7 @@ export interface PositionsRequest {
72
73
  expiry?: string;
73
74
  strike?: string;
74
75
  right?: string;
76
+ /** 资产行情类型枚举名: ETH / RTH / OVERNIGHT (wire: asset_quote_type) */
75
77
  assetQuoteType?: string;
76
78
  lang?: string;
77
79
  }
@@ -82,6 +84,8 @@ export interface AssetsRequest {
82
84
  subAccounts?: string[];
83
85
  segment?: boolean;
84
86
  marketValue?: boolean;
87
+ /** 资产行情类型枚举名: ETH / RTH / OVERNIGHT (wire: asset_quote_type) */
88
+ assetQuoteType?: string;
85
89
  lang?: string;
86
90
  }
87
91
  export interface ManagedAccountsRequest {
@@ -115,6 +119,8 @@ export interface AggregateAssetsRequest {
115
119
  secretKey?: string;
116
120
  baseCurrency?: string;
117
121
  segType?: string;
122
+ /** 资产行情类型枚举名: ETH / RTH / OVERNIGHT (wire: asset_quote_type) */
123
+ assetQuoteType?: string;
118
124
  lang?: string;
119
125
  }
120
126
  export interface EstimateTradableQuantityRequest {
@@ -0,0 +1,5 @@
1
+ /**
2
+ * 资讯模块导出
3
+ */
4
+ export { NewsClient } from './news-client';
5
+ export type { NewsClientOptions } from './news-client';
@@ -0,0 +1,60 @@
1
+ /**
2
+ * NewsClient — 资讯客户端(news_stock_list / news_highlight_list)。
3
+ *
4
+ * 路由约定(对齐 Java SDK 的 MethodType.NEWS):
5
+ * 资讯接口走主网关(config.serverUrl,与交易域同一路由),**不走行情域名**
6
+ * (config.quoteServerUrl)。本 SDK 的路由在 HttpClient 构造期决定——
7
+ * QuoteClient 以 useQuoteServerUrl 指向行情域名,其余客户端(TradeClient、
8
+ * NewsClient)默认指向主网关——因此 NewsClient 永远不传 useQuoteServerUrl。
9
+ *
10
+ * 请求参数 TypeScript 侧 camelCase,自动转为 wire snake_case;响应出参为
11
+ * camelCase,无需转换。
12
+ */
13
+ import { HttpClient } from '../client/http-client';
14
+ import type { ClientConfig } from '../config/client-config';
15
+ import type { NewsPage } from '../model/news';
16
+ import type { NewsStockListRequest, NewsHighlightListRequest } from '../model/news-requests';
17
+ /** NewsClient construction options. */
18
+ export interface NewsClientOptions {
19
+ /**
20
+ * 默认语言('zh_CN' / 'zh_TW' / 'en_US'):请求未显携带 lang 时注入
21
+ * biz_content。fromConfig 自动取 config.language。
22
+ */
23
+ lang?: string;
24
+ }
25
+ /** 资讯客户端:个股新闻列表与市场要闻列表。 */
26
+ export declare class NewsClient {
27
+ private httpClient;
28
+ private defaultLang;
29
+ constructor(httpClient: HttpClient, options?: NewsClientOptions);
30
+ /**
31
+ * 从 ClientConfig 直接创建 NewsClient——主网关路由,默认语言取
32
+ * config.language。
33
+ */
34
+ static fromConfig(config: ClientConfig): NewsClient;
35
+ /**
36
+ * 查询个股新闻列表(wire: news_stock_list)。
37
+ *
38
+ * @param req - symbol 必填(单标的,该接口不支持批量查询);
39
+ * pageCount / pageSize 可选(缺省服务端默认 1 / 20);
40
+ * lang 可选('zh_CN' / 'zh_TW' / 'en_US')
41
+ * @returns 分页信封 NewsPage;空列表属正常成功返回
42
+ */
43
+ getStockNews(req: NewsStockListRequest): Promise<NewsPage>;
44
+ /**
45
+ * 查询市场要闻列表(wire: news_highlight_list)。
46
+ *
47
+ * 翻页只走 lastId 游标:把上一页 items 最后一条的 id 作为 lastId 传入
48
+ * 即取下一页;不传从最新开始。本接口无 page_count / page_size,响应
49
+ * pageCount 恒为 1。
50
+ *
51
+ * @param req - 全部字段可选,不传即从最新开始
52
+ * @returns 分页信封 NewsPage;空列表属正常成功返回
53
+ */
54
+ getMarketNews(req?: NewsHighlightListRequest): Promise<NewsPage>;
55
+ /**
56
+ * 解析生效的 lang:显式传值原样透传,缺省回退客户端默认语言。
57
+ */
58
+ private resolveLang;
59
+ private callInto;
60
+ }
@@ -7,4 +7,4 @@ export * from './varint';
7
7
  export * from './tick-util';
8
8
  export * from './proto-message';
9
9
  export { PushClient, ConnectionState } from './push-client';
10
- export type { PushClientOptions, TLSSocketLike, TLSSocketFactory } from './push-client';
10
+ export type { PushClientOptions, AccountSubscribeOptions, TLSSocketLike, TLSSocketFactory, } from './push-client';
@@ -12,15 +12,15 @@ export interface QuoteBasicData {
12
12
  avgPrice?: number | undefined;
13
13
  /** */
14
14
  latestPrice?: number | undefined;
15
- /** Pre/Post-Mkt data not support */
15
+ /** Actual last-trade time (epoch ms) for the quoted session; 0 means no trade. */
16
16
  latestPriceTimestamp?: number | undefined;
17
17
  /** */
18
18
  latestTime?: string | undefined;
19
19
  /** */
20
20
  preClose?: number | undefined;
21
- /** */
21
+ /** Volume of the quoted session; cumulative option volume is cumVolume. */
22
22
  volume?: number | undefined;
23
- /** Futures and Options data not support */
23
+ /** Amount of the quoted session; cumulative option amount is cumAmount. */
24
24
  amount?: number | undefined;
25
25
  /** Pre/Post-Mkt data not support */
26
26
  open?: number | undefined;
@@ -28,7 +28,7 @@ export interface QuoteBasicData {
28
28
  high?: number | undefined;
29
29
  /** Pre/Post-Mkt data not support */
30
30
  low?: number | undefined;
31
- /** Pre/Post-Mkt */
31
+ /** Extended-session marker: PreMarket / AfterHours; absent for RTH. */
32
32
  hourTradingTag?: string | undefined;
33
33
  marketStatus?: string | undefined;
34
34
  /** only Options support */
@@ -43,8 +43,17 @@ export interface QuoteBasicData {
43
43
  minTick?: number | undefined;
44
44
  /** minute data: price, average price, time, volume */
45
45
  mi?: QuoteData_Minute | undefined;
46
- /** Decimal value encoded as a string to avoid precision loss */
46
+ /** Trading volume encoded as a double; precision may be lost for large or fractional values. */
47
47
  volumeDecimal?: number | undefined;
48
+ /** cumulative volume of CURB + RTH + GTH, only Options support */
49
+ cumVolume?: number | undefined;
50
+ /**
51
+ * Cumulative quote amount across CURB + RTH + GTH; same units as amount.
52
+ * Encoded as double; values may be rounded. Do not use for exact accounting.
53
+ */
54
+ cumAmount?: number | undefined;
55
+ /** Quoted option session (GTH / CURB); absent when not provided. */
56
+ session?: string | undefined;
48
57
  }
49
58
  export declare const QuoteBasicData: MessageFns<QuoteBasicData>;
50
59
  type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
@@ -11,15 +11,15 @@ export interface QuoteData {
11
11
  avgPrice?: number | undefined;
12
12
  /** required when type is 'BASIC' */
13
13
  latestPrice?: number | undefined;
14
- /** required when type is 'BASIC', Pre/Post-Mkt data not support */
14
+ /** Actual last-trade time (epoch ms) for the quoted session; 0 means no trade. */
15
15
  latestPriceTimestamp?: number | undefined;
16
16
  /** required when type is 'BASIC' */
17
17
  latestTime?: string | undefined;
18
18
  /** required when type is 'BASIC' */
19
19
  preClose?: number | undefined;
20
- /** required when type is 'BASIC' */
20
+ /** Volume of the quoted session; cumulative option volume is cumVolume. */
21
21
  volume?: number | undefined;
22
- /** required when type is 'BASIC', Futures and Options data not support */
22
+ /** Amount of the quoted session; cumulative option amount is cumAmount. */
23
23
  amount?: number | undefined;
24
24
  /** required when symbol in HK market */
25
25
  open?: number | undefined;
@@ -27,7 +27,7 @@ export interface QuoteData {
27
27
  high?: number | undefined;
28
28
  /** required when symbol in HK market */
29
29
  low?: number | undefined;
30
- /** Pre/Post-Mkt */
30
+ /** Extended-session marker: PreMarket / AfterHours; absent for RTH. */
31
31
  hourTradingTag?: string | undefined;
32
32
  marketStatus?: string | undefined;
33
33
  /** required when type is 'BBO' */
@@ -54,8 +54,17 @@ export interface QuoteData {
54
54
  minTick?: number | undefined;
55
55
  /** minute data: price, average price, time, volume */
56
56
  mi?: QuoteData_Minute | undefined;
57
- /** Decimal value encoded as a string to avoid precision loss */
57
+ /** Trading volume encoded as a double; precision may be lost for large or fractional values. */
58
58
  volumeDecimal?: number | undefined;
59
+ /** cumulative volume of CURB + RTH + GTH, only Options support */
60
+ cumVolume?: number | undefined;
61
+ /**
62
+ * Cumulative quote amount across CURB + RTH + GTH; same units as amount.
63
+ * Encoded as double; values may be rounded. Do not use for exact accounting.
64
+ */
65
+ cumAmount?: number | undefined;
66
+ /** Quoted option session (GTH / CURB); absent when not provided. */
67
+ session?: string | undefined;
59
68
  }
60
69
  export interface QuoteData_Minute {
61
70
  /** last price of the minute bar */
@@ -21,6 +21,7 @@ export interface Request_Subscribe {
21
21
  symbols?: string | undefined;
22
22
  account?: string | undefined;
23
23
  market?: string | undefined;
24
+ assetQuoteType?: string | undefined;
24
25
  }
25
26
  export declare const Request: MessageFns<Request>;
26
27
  export declare const Request_Connect: MessageFns<Request_Connect>;
@@ -17,8 +17,11 @@ export declare function buildConnectMessage(tigerId: string, sign: string, sdkVe
17
17
  export declare function buildHeartBeatMessage(): Request;
18
18
  /**
19
19
  * 构建 SUBSCRIBE 请求消息
20
+ *
21
+ * @param assetQuoteType 资产行情类型枚举名(ETH / RTH / OVERNIGHT),
22
+ * 仅对 Asset / Position 两种订阅有意义,其余场景传 undefined
20
23
  */
21
- export declare function buildSubscribeMessage(dataType: SocketCommon_DataType, symbols?: string, account?: string, market?: string): Request;
24
+ export declare function buildSubscribeMessage(dataType: SocketCommon_DataType, symbols?: string, account?: string, market?: string, assetQuoteType?: string): Request;
22
25
  /**
23
26
  * 构建 UNSUBSCRIBE 请求消息
24
27
  */
@@ -7,6 +7,18 @@ export declare enum ConnectionState {
7
7
  Connecting = 1,
8
8
  Connected = 2
9
9
  }
10
+ /**
11
+ * Options for account-level subscriptions (asset / position).
12
+ *
13
+ * `assetQuoteType` 用于选择资产/持仓推送的行情口径,通过重载传入,
14
+ * 老的 `subscribeAsset(account?)` / `subscribePosition(account?)` 签名保持不变。
15
+ */
16
+ export interface AccountSubscribeOptions {
17
+ /** Account to subscribe; omit to use the account from ClientConfig. */
18
+ account?: string;
19
+ /** 资产行情类型枚举名: ETH / RTH / OVERNIGHT,省略则由服务端取默认值 */
20
+ assetQuoteType?: string;
21
+ }
10
22
  /** PushClient configuration options */
11
23
  export interface PushClientOptions {
12
24
  pushHost?: string;
@@ -51,6 +63,8 @@ export declare class PushClient {
51
63
  private subscriptions;
52
64
  /** Account-level subscriptions: subject -> account string used at subscribe time */
53
65
  private accountSubs;
66
+ /** Account-level subscriptions: subject -> assetQuoteType used at subscribe time (reconnect replay) */
67
+ private accountSubQuoteTypes;
54
68
  private heartbeatTimer;
55
69
  private reconnectTimer;
56
70
  private stopped;
@@ -150,12 +164,31 @@ export declare class PushClient {
150
164
  subscribeMarket(market: string): void;
151
165
  /** Unsubscribe from market status (v0.4.0). */
152
166
  unsubscribeMarket(market: string): void;
167
+ /**
168
+ * Shared implementation for the account/options overloads of
169
+ * subscribeAsset / subscribePosition.
170
+ */
171
+ private subscribeAccount;
153
172
  /** Subscribe to asset changes */
154
173
  subscribeAsset(account?: string): void;
174
+ /**
175
+ * Subscribe to asset changes with extra options.
176
+ *
177
+ * @example
178
+ * client.subscribeAsset({ assetQuoteType: 'OVERNIGHT' });
179
+ */
180
+ subscribeAsset(options: AccountSubscribeOptions): void;
155
181
  /** Unsubscribe from asset changes */
156
182
  unsubscribeAsset(): void;
157
183
  /** Subscribe to position changes */
158
184
  subscribePosition(account?: string): void;
185
+ /**
186
+ * Subscribe to position changes with extra options.
187
+ *
188
+ * @example
189
+ * client.subscribePosition({ assetQuoteType: 'OVERNIGHT' });
190
+ */
191
+ subscribePosition(options: AccountSubscribeOptions): void;
159
192
  /** Unsubscribe from position changes */
160
193
  unsubscribePosition(): void;
161
194
  /** Subscribe to order status */
@@ -79,8 +79,9 @@ export declare class QuoteClient {
79
79
  * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
80
80
  * @param limit - Maximum number of bars to return.
81
81
  * @param sortDir - Sort direction ('asc' or 'desc').
82
+ * @param withHourTrading - Include GTH/CURB minute bars; omitted preserves the server default.
82
83
  */
83
- getOptionKline(identifiers: string[], period: string, beginTime?: number, endTime?: number, timezone?: string, limit?: number, sortDir?: string): Promise<Kline[]>;
84
+ getOptionKline(identifiers: string[], period: string, beginTime?: number, endTime?: number, timezone?: string, limit?: number, sortDir?: string, withHourTrading?: boolean): Promise<Kline[]>;
84
85
  /**
85
86
  * Real-time option quotes by OCC-style identifier.
86
87
  *
@@ -96,7 +96,8 @@ export declare class TradeClient {
96
96
  getFilledOrders(req?: OrdersRequest): Promise<Order[]>;
97
97
  /**
98
98
  * Get a single order by ID (v0.4.0 new).
99
- * Returns `undefined` if no match.
99
+ * Wire method: `orders` with `id` / `order_id` parameters.
100
+ * Returns `undefined` if no match or the result contains multiple orders.
100
101
  */
101
102
  getOrder(req: GetOrderRequest): Promise<Order | undefined>;
102
103
  /**
@@ -106,9 +107,15 @@ export declare class TradeClient {
106
107
  getOrderTransactions(req: OrderTransactionsRequest): Promise<Transaction[]>;
107
108
  /** Query positions. v0.4.0: supports Symbol / SecType / Currency / Market filters. */
108
109
  getPositions(req?: PositionsRequest): Promise<Position[]>;
109
- /** Query assets. v0.4.0: supports sub-account list and aggregation options. */
110
+ /**
111
+ * Query assets. v0.4.0: supports sub-account list and aggregation options.
112
+ * `assetQuoteType`(ETH / RTH / OVERNIGHT) 选择资产行情口径。
113
+ */
110
114
  getAssets(req?: AssetsRequest): Promise<Asset[]>;
111
- /** Query prime assets. v0.4.0: takes AssetsRequest for filters. */
115
+ /**
116
+ * Query prime assets. v0.4.0: takes AssetsRequest for filters.
117
+ * `assetQuoteType`(ETH / RTH / OVERNIGHT) 选择资产行情口径。
118
+ */
112
119
  getPrimeAssets(req?: AssetsRequest): Promise<PrimeAsset | undefined>;
113
120
  /** Query managed sub-accounts (institutional). */
114
121
  getManagedAccounts(req?: ManagedAccountsRequest): Promise<ManagedAccount[]>;
@@ -119,7 +126,10 @@ export declare class TradeClient {
119
126
  getDerivativeContracts(req: DerivativeContractsRequest): Promise<Contract[]>;
120
127
  /** Daily P&L / net-value / holding-value analytics. */
121
128
  getAnalyticsAsset(req: AnalyticsAssetRequest): Promise<AnalyticsAsset[]>;
122
- /** Aggregate assets (prime) by base currency. */
129
+ /**
130
+ * Aggregate assets (prime) by base currency.
131
+ * `assetQuoteType`(ETH / RTH / OVERNIGHT) 选择资产行情口径。
132
+ */
123
133
  getAggregateAssets(req?: AggregateAssetsRequest): Promise<AggregateAssets | undefined>;
124
134
  /** Estimate tradable quantity given order parameters. */
125
135
  getEstimateTradableQuantity(req: EstimateTradableQuantityRequest): Promise<EstimateTradableQuantity | undefined>;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.4.8";
1
+ export declare const SDK_VERSION = "0.5.8";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tigeropen",
3
- "version": "0.5.5",
3
+ "version": "0.5.8",
4
4
  "description": "Tiger Brokers OpenAPI TypeScript SDK for market data, trading, and real-time push",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -24,8 +24,8 @@
24
24
  "url": "https://github.com/tigerfintech/openapi-typescript-sdk/issues"
25
25
  },
26
26
  "scripts": {
27
- "build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node scripts/fix-esm-imports.mjs",
28
- "build:esm": "tsc -p tsconfig.json",
27
+ "build": "node scripts/sync-version.mjs && tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node scripts/fix-esm-imports.mjs",
28
+ "build:esm": "tsc -p tsconfig.json && node scripts/fix-esm-imports.mjs",
29
29
  "build:cjs": "tsc -p tsconfig.cjs.json",
30
30
  "prepublishOnly": "npm run build",
31
31
  "publish:all": "npm run build && npm publish --registry https://registry.npmjs.org --access public && npm pkg set name=tigeropen && npm publish --registry https://registry.npmjs.org && npm pkg set name=@tigeropenapi/tigeropen",
@@ -33,6 +33,7 @@
33
33
  "test:unit": "vitest run --config vitest.config.ts",
34
34
  "test:integ": "TIGER_RUN_INTEG=true vitest run --config vitest.integ.config.ts",
35
35
  "test:watch": "vitest",
36
+ "sync-version": "node scripts/sync-version.mjs",
36
37
  "clean": "rm -rf dist",
37
38
  "proto:generate": "protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./src/push/pb --ts_proto_opt=esModuleInterop=true,outputEncodeMethods=true,outputJsonMethods=false,outputClientImpl=false -I=./proto ./proto/*.proto"
38
39
  },
@@ -58,5 +59,6 @@
58
59
  },
59
60
  "dependencies": {
60
61
  "@bufbuild/protobuf": "^2.12.0"
61
- }
62
+ },
63
+ "gitHead": "25b76514df4cb4f6668bf9ef95b76180abadc28e"
62
64
  }