@tigeropenapi/tigeropen 0.4.8 → 0.5.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.
@@ -12,11 +12,49 @@ exports.parseOptionIdentifier = parseOptionIdentifier;
12
12
  const http_client_1 = require("../client/http-client");
13
13
  const api_request_1 = require("../client/api-request");
14
14
  const api_response_1 = require("../client/api-response");
15
+ /**
16
+ * resolveOptionTimezone returns the timezone string to use for expiry conversion.
17
+ * Explicit tz takes precedence; otherwise infer from symbol (.HK suffix → Asia/Hong_Kong, else America/New_York).
18
+ */
19
+ function resolveOptionTimezone(tz, symbol) {
20
+ if (tz)
21
+ return tz;
22
+ return symbol.toUpperCase().endsWith('.HK') ? 'Asia/Hong_Kong' : 'America/New_York';
23
+ }
24
+ /**
25
+ * Convert a "YYYY-MM-DD" date string to the Unix timestamp (ms) of local midnight
26
+ * in the given IANA timezone.
27
+ *
28
+ * Strategy: use Intl.DateTimeFormat to determine what UTC time corresponds to
29
+ * local midnight in the target timezone, correctly handling DST.
30
+ */
31
+ function localMidnightMs(dateStr, timezone) {
32
+ const [year, month, day] = dateStr.split('-').map(Number);
33
+ // Use noon UTC as a safe anchor (avoids DST ambiguity right at midnight)
34
+ const noonUtc = new Date(Date.UTC(year, month - 1, day, 12, 0, 0));
35
+ // Determine what hour/minute/second UTC noon appears as in the target timezone
36
+ const timeParts = new Intl.DateTimeFormat('en-US', {
37
+ timeZone: timezone,
38
+ hour: '2-digit',
39
+ minute: '2-digit',
40
+ second: '2-digit',
41
+ hour12: false,
42
+ }).formatToParts(noonUtc);
43
+ const h = parseInt(timeParts.find(p => p.type === 'hour').value, 10);
44
+ const m = parseInt(timeParts.find(p => p.type === 'minute').value, 10);
45
+ const s = parseInt(timeParts.find(p => p.type === 'second').value, 10);
46
+ // UTC offset at noon = 12:00:00 UTC − local time shown for noon UTC
47
+ // Local midnight = noon UTC − 12h + offset = noon UTC − (h*3600+m*60+s)s
48
+ return noonUtc.getTime() - (h * 3600 + m * 60 + s) * 1000;
49
+ }
15
50
  /**
16
51
  * Parse an OCC-style option identifier like "AAPL 260619C00150000"
17
52
  * into its component parts.
53
+ *
54
+ * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
55
+ * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
18
56
  */
19
- function parseOptionIdentifier(identifier) {
57
+ function parseOptionIdentifier(identifier, timezone) {
20
58
  const trimmed = identifier.trim();
21
59
  const spaceIdx = trimmed.indexOf(' ');
22
60
  if (spaceIdx === -1) {
@@ -33,7 +71,11 @@ function parseOptionIdentifier(identifier) {
33
71
  const yy = parseInt(datePart.substring(0, 2), 10);
34
72
  const mm = parseInt(datePart.substring(2, 4), 10);
35
73
  const dd = parseInt(datePart.substring(4, 6), 10);
36
- const expiryMs = Date.UTC(2000 + yy, mm - 1, dd);
74
+ const resolvedTz = resolveOptionTimezone(timezone, symbol);
75
+ const paddedYear = String(2000 + yy).padStart(4, '0');
76
+ const paddedMonth = String(mm).padStart(2, '0');
77
+ const paddedDay = String(dd).padStart(2, '0');
78
+ const expiryMs = localMidnightMs(`${paddedYear}-${paddedMonth}-${paddedDay}`, resolvedTz);
37
79
  const right = rightChar === 'C' ? 'CALL' : rightChar === 'P' ? 'PUT' : '';
38
80
  if (!right)
39
81
  throw new Error(`invalid right character: ${rightChar}`);
@@ -79,10 +121,14 @@ class QuoteClient {
79
121
  async getMarketState(market) {
80
122
  return this.callInto('market_state', { market });
81
123
  }
82
- /** Real-time stock briefs. wire: quote_real_time */
83
- async getBrief(req) {
124
+ /** Real-time stock quotes. wire: quote_real_time */
125
+ async getRealTimeQuote(req) {
84
126
  return this.callInto('quote_real_time', req);
85
127
  }
128
+ /** @deprecated Use getRealTimeQuote instead. */
129
+ async getBrief(req) {
130
+ return this.getRealTimeQuote(req);
131
+ }
86
132
  async getKline(req) {
87
133
  return this.callInto('kline', req);
88
134
  }
@@ -98,32 +144,66 @@ class QuoteClient {
98
144
  return this.callInto('quote_depth', req);
99
145
  }
100
146
  // === Options ===
101
- async getOptionExpiration(symbols) {
102
- return this.callInto('option_expiration', { symbols });
147
+ async getOptionExpiration(symbols, market) {
148
+ const params = { symbols };
149
+ if (market)
150
+ params.market = market;
151
+ return this.callInto('option_expiration', params);
103
152
  }
104
- /** Option chain; each item is [symbol, "YYYY-MM-DD"]. */
105
- async getOptionChain(items) {
153
+ /**
154
+ * Option chain; each item is [symbol, "YYYY-MM-DD"].
155
+ *
156
+ * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
157
+ * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
158
+ */
159
+ async getOptionChain(items, timezone) {
106
160
  const optionBasic = items.map(([symbol, expiry]) => {
107
- const d = new Date(expiry + 'T00:00:00Z');
108
- const expiryMs = d.getTime();
109
- if (Number.isNaN(expiryMs)) {
161
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(expiry)) {
110
162
  throw new Error(`invalid expiry date, expected YYYY-MM-DD: ${expiry}`);
111
163
  }
164
+ const tz = resolveOptionTimezone(timezone, symbol);
165
+ const expiryMs = localMidnightMs(expiry, tz);
112
166
  return { symbol, expiry: expiryMs };
113
167
  });
114
168
  return this.callInto('option_chain', { option_basic: optionBasic }, '3.0');
115
169
  }
116
- async getOptionBrief(identifiers) {
170
+ /**
171
+ * Real-time option quotes by OCC-style identifier.
172
+ *
173
+ * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
174
+ * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
175
+ */
176
+ async getOptionQuote(identifiers, timezone) {
117
177
  const optionBasic = identifiers.map((id) => {
118
- const p = parseOptionIdentifier(id);
178
+ const p = parseOptionIdentifier(id, timezone);
119
179
  return { symbol: p.symbol, expiry: p.expiryMs, right: p.right, strike: p.strike };
120
180
  });
121
181
  return this.callInto('option_brief', { option_basic: optionBasic }, '2.0');
122
182
  }
123
- async getOptionKline(identifiers, period) {
183
+ /** @deprecated Use getOptionQuote instead. */
184
+ async getOptionBrief(identifiers) {
185
+ return this.getOptionQuote(identifiers);
186
+ }
187
+ /**
188
+ * Option K-line by OCC-style identifier.
189
+ *
190
+ * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
191
+ * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
192
+ */
193
+ async getOptionKline(identifiers, period, beginTime = -1, endTime = -1, timezone) {
194
+ const resolvedBegin = beginTime === 0 ? -1 : beginTime;
195
+ const resolvedEnd = endTime === 0 ? -1 : endTime;
124
196
  const optionQuery = identifiers.map((id) => {
125
- const p = parseOptionIdentifier(id);
126
- return { symbol: p.symbol, expiry: p.expiryMs, right: p.right, strike: p.strike, period };
197
+ const p = parseOptionIdentifier(id, timezone);
198
+ return {
199
+ symbol: p.symbol,
200
+ expiry: p.expiryMs,
201
+ right: p.right,
202
+ strike: p.strike,
203
+ period,
204
+ begin_time: resolvedBegin,
205
+ end_time: resolvedEnd,
206
+ };
127
207
  });
128
208
  return this.callInto('option_kline', { option_query: optionQuery }, '2.0');
129
209
  }
@@ -187,10 +267,14 @@ class QuoteClient {
187
267
  async getStockDetails(req) {
188
268
  return this.callIntoItems('stock_detail', req);
189
269
  }
190
- /** Delayed stock briefs. wire: quote_delay */
191
- async getStockDelayBriefs(req) {
270
+ /** Delayed stock quotes. wire: quote_delay */
271
+ async getDelayedQuote(req) {
192
272
  return this.callInto('quote_delay', req);
193
273
  }
274
+ /** @deprecated Use getDelayedQuote instead. */
275
+ async getStockDelayBriefs(req) {
276
+ return this.getDelayedQuote(req);
277
+ }
194
278
  /** Client-side paginated K-line fetch. Loops until totalSize bars are collected, oldest-first. */
195
279
  async getKlineByPage(req) {
196
280
  const pageSize = req.pageSize && req.pageSize > 0 ? req.pageSize : 200;
@@ -396,10 +480,14 @@ class QuoteClient {
396
480
  async getFundHistoryQuote(req) {
397
481
  return this.callInto('fund_history_quote', req);
398
482
  }
399
- /** Warrant briefs. wire: warrant_briefs */
400
- async getWarrantBriefs(req) {
483
+ /** Real-time warrant quotes. wire: warrant_briefs */
484
+ async getWarrantQuote(req) {
401
485
  return this.callInto('warrant_briefs', req);
402
486
  }
487
+ /** @deprecated Use getWarrantQuote instead. */
488
+ async getWarrantBriefs(req) {
489
+ return this.getWarrantQuote(req);
490
+ }
403
491
  /** Warrant filter (paged). wire: warrant_filter */
404
492
  async getWarrantFilter(req) {
405
493
  return this.callInto('warrant_filter', req);
@@ -8,11 +8,49 @@
8
8
  import { HttpClient } from '../client/http-client.js';
9
9
  import { createApiRequest } from '../client/api-request.js';
10
10
  import { unmarshalData } from '../client/api-response.js';
11
+ /**
12
+ * resolveOptionTimezone returns the timezone string to use for expiry conversion.
13
+ * Explicit tz takes precedence; otherwise infer from symbol (.HK suffix → Asia/Hong_Kong, else America/New_York).
14
+ */
15
+ function resolveOptionTimezone(tz, symbol) {
16
+ if (tz)
17
+ return tz;
18
+ return symbol.toUpperCase().endsWith('.HK') ? 'Asia/Hong_Kong' : 'America/New_York';
19
+ }
20
+ /**
21
+ * Convert a "YYYY-MM-DD" date string to the Unix timestamp (ms) of local midnight
22
+ * in the given IANA timezone.
23
+ *
24
+ * Strategy: use Intl.DateTimeFormat to determine what UTC time corresponds to
25
+ * local midnight in the target timezone, correctly handling DST.
26
+ */
27
+ function localMidnightMs(dateStr, timezone) {
28
+ const [year, month, day] = dateStr.split('-').map(Number);
29
+ // Use noon UTC as a safe anchor (avoids DST ambiguity right at midnight)
30
+ const noonUtc = new Date(Date.UTC(year, month - 1, day, 12, 0, 0));
31
+ // Determine what hour/minute/second UTC noon appears as in the target timezone
32
+ const timeParts = new Intl.DateTimeFormat('en-US', {
33
+ timeZone: timezone,
34
+ hour: '2-digit',
35
+ minute: '2-digit',
36
+ second: '2-digit',
37
+ hour12: false,
38
+ }).formatToParts(noonUtc);
39
+ const h = parseInt(timeParts.find(p => p.type === 'hour').value, 10);
40
+ const m = parseInt(timeParts.find(p => p.type === 'minute').value, 10);
41
+ const s = parseInt(timeParts.find(p => p.type === 'second').value, 10);
42
+ // UTC offset at noon = 12:00:00 UTC − local time shown for noon UTC
43
+ // Local midnight = noon UTC − 12h + offset = noon UTC − (h*3600+m*60+s)s
44
+ return noonUtc.getTime() - (h * 3600 + m * 60 + s) * 1000;
45
+ }
11
46
  /**
12
47
  * Parse an OCC-style option identifier like "AAPL 260619C00150000"
13
48
  * into its component parts.
49
+ *
50
+ * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
51
+ * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
14
52
  */
15
- export function parseOptionIdentifier(identifier) {
53
+ export function parseOptionIdentifier(identifier, timezone) {
16
54
  const trimmed = identifier.trim();
17
55
  const spaceIdx = trimmed.indexOf(' ');
18
56
  if (spaceIdx === -1) {
@@ -29,7 +67,11 @@ export function parseOptionIdentifier(identifier) {
29
67
  const yy = parseInt(datePart.substring(0, 2), 10);
30
68
  const mm = parseInt(datePart.substring(2, 4), 10);
31
69
  const dd = parseInt(datePart.substring(4, 6), 10);
32
- const expiryMs = Date.UTC(2000 + yy, mm - 1, dd);
70
+ const resolvedTz = resolveOptionTimezone(timezone, symbol);
71
+ const paddedYear = String(2000 + yy).padStart(4, '0');
72
+ const paddedMonth = String(mm).padStart(2, '0');
73
+ const paddedDay = String(dd).padStart(2, '0');
74
+ const expiryMs = localMidnightMs(`${paddedYear}-${paddedMonth}-${paddedDay}`, resolvedTz);
33
75
  const right = rightChar === 'C' ? 'CALL' : rightChar === 'P' ? 'PUT' : '';
34
76
  if (!right)
35
77
  throw new Error(`invalid right character: ${rightChar}`);
@@ -75,10 +117,14 @@ export class QuoteClient {
75
117
  async getMarketState(market) {
76
118
  return this.callInto('market_state', { market });
77
119
  }
78
- /** Real-time stock briefs. wire: quote_real_time */
79
- async getBrief(req) {
120
+ /** Real-time stock quotes. wire: quote_real_time */
121
+ async getRealTimeQuote(req) {
80
122
  return this.callInto('quote_real_time', req);
81
123
  }
124
+ /** @deprecated Use getRealTimeQuote instead. */
125
+ async getBrief(req) {
126
+ return this.getRealTimeQuote(req);
127
+ }
82
128
  async getKline(req) {
83
129
  return this.callInto('kline', req);
84
130
  }
@@ -94,32 +140,66 @@ export class QuoteClient {
94
140
  return this.callInto('quote_depth', req);
95
141
  }
96
142
  // === Options ===
97
- async getOptionExpiration(symbols) {
98
- return this.callInto('option_expiration', { symbols });
143
+ async getOptionExpiration(symbols, market) {
144
+ const params = { symbols };
145
+ if (market)
146
+ params.market = market;
147
+ return this.callInto('option_expiration', params);
99
148
  }
100
- /** Option chain; each item is [symbol, "YYYY-MM-DD"]. */
101
- async getOptionChain(items) {
149
+ /**
150
+ * Option chain; each item is [symbol, "YYYY-MM-DD"].
151
+ *
152
+ * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
153
+ * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
154
+ */
155
+ async getOptionChain(items, timezone) {
102
156
  const optionBasic = items.map(([symbol, expiry]) => {
103
- const d = new Date(expiry + 'T00:00:00Z');
104
- const expiryMs = d.getTime();
105
- if (Number.isNaN(expiryMs)) {
157
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(expiry)) {
106
158
  throw new Error(`invalid expiry date, expected YYYY-MM-DD: ${expiry}`);
107
159
  }
160
+ const tz = resolveOptionTimezone(timezone, symbol);
161
+ const expiryMs = localMidnightMs(expiry, tz);
108
162
  return { symbol, expiry: expiryMs };
109
163
  });
110
164
  return this.callInto('option_chain', { option_basic: optionBasic }, '3.0');
111
165
  }
112
- async getOptionBrief(identifiers) {
166
+ /**
167
+ * Real-time option quotes by OCC-style identifier.
168
+ *
169
+ * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
170
+ * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
171
+ */
172
+ async getOptionQuote(identifiers, timezone) {
113
173
  const optionBasic = identifiers.map((id) => {
114
- const p = parseOptionIdentifier(id);
174
+ const p = parseOptionIdentifier(id, timezone);
115
175
  return { symbol: p.symbol, expiry: p.expiryMs, right: p.right, strike: p.strike };
116
176
  });
117
177
  return this.callInto('option_brief', { option_basic: optionBasic }, '2.0');
118
178
  }
119
- async getOptionKline(identifiers, period) {
179
+ /** @deprecated Use getOptionQuote instead. */
180
+ async getOptionBrief(identifiers) {
181
+ return this.getOptionQuote(identifiers);
182
+ }
183
+ /**
184
+ * Option K-line by OCC-style identifier.
185
+ *
186
+ * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
187
+ * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
188
+ */
189
+ async getOptionKline(identifiers, period, beginTime = -1, endTime = -1, timezone) {
190
+ const resolvedBegin = beginTime === 0 ? -1 : beginTime;
191
+ const resolvedEnd = endTime === 0 ? -1 : endTime;
120
192
  const optionQuery = identifiers.map((id) => {
121
- const p = parseOptionIdentifier(id);
122
- return { symbol: p.symbol, expiry: p.expiryMs, right: p.right, strike: p.strike, period };
193
+ const p = parseOptionIdentifier(id, timezone);
194
+ return {
195
+ symbol: p.symbol,
196
+ expiry: p.expiryMs,
197
+ right: p.right,
198
+ strike: p.strike,
199
+ period,
200
+ begin_time: resolvedBegin,
201
+ end_time: resolvedEnd,
202
+ };
123
203
  });
124
204
  return this.callInto('option_kline', { option_query: optionQuery }, '2.0');
125
205
  }
@@ -183,10 +263,14 @@ export class QuoteClient {
183
263
  async getStockDetails(req) {
184
264
  return this.callIntoItems('stock_detail', req);
185
265
  }
186
- /** Delayed stock briefs. wire: quote_delay */
187
- async getStockDelayBriefs(req) {
266
+ /** Delayed stock quotes. wire: quote_delay */
267
+ async getDelayedQuote(req) {
188
268
  return this.callInto('quote_delay', req);
189
269
  }
270
+ /** @deprecated Use getDelayedQuote instead. */
271
+ async getStockDelayBriefs(req) {
272
+ return this.getDelayedQuote(req);
273
+ }
190
274
  /** Client-side paginated K-line fetch. Loops until totalSize bars are collected, oldest-first. */
191
275
  async getKlineByPage(req) {
192
276
  const pageSize = req.pageSize && req.pageSize > 0 ? req.pageSize : 200;
@@ -392,10 +476,14 @@ export class QuoteClient {
392
476
  async getFundHistoryQuote(req) {
393
477
  return this.callInto('fund_history_quote', req);
394
478
  }
395
- /** Warrant briefs. wire: warrant_briefs */
396
- async getWarrantBriefs(req) {
479
+ /** Real-time warrant quotes. wire: warrant_briefs */
480
+ async getWarrantQuote(req) {
397
481
  return this.callInto('warrant_briefs', req);
398
482
  }
483
+ /** @deprecated Use getWarrantQuote instead. */
484
+ async getWarrantBriefs(req) {
485
+ return this.getWarrantQuote(req);
486
+ }
399
487
  /** Warrant filter (paged). wire: warrant_filter */
400
488
  async getWarrantFilter(req) {
401
489
  return this.callInto('warrant_filter', req);
@@ -407,16 +407,26 @@ export interface KlineQuota {
407
407
  }
408
408
  /** Option historical-volatility time series point. */
409
409
  export interface OptionVolatilityPoint {
410
- date?: string;
411
- volatility?: number;
410
+ impliedVol?: number;
411
+ percentile?: number;
412
+ rank?: number;
413
+ hisVolatility?: number;
414
+ timestamp?: number;
415
+ }
416
+ /** Implied-volatility metric for a specific period. */
417
+ export interface ImpliedVolMetric {
418
+ period?: string;
419
+ percentile?: number;
420
+ rank?: number;
412
421
  }
413
422
  /** Option analysis (option_analysis). */
414
423
  export interface OptionAnalysis {
415
424
  symbol?: string;
416
- historicalVolatility30Day?: number;
417
- historicalVolatility60Day?: number;
418
- historicalVolatility90Day?: number;
419
- impliedVolatility?: number;
425
+ impliedVol30Days?: number;
426
+ hisVolatility?: number;
427
+ ivHisVRatio?: number;
428
+ callPutRatio?: number;
429
+ impliedVolMetric?: ImpliedVolMetric;
420
430
  volatilityList?: OptionVolatilityPoint[];
421
431
  }
422
432
  /** Option symbol listing (option_symbol). */
@@ -541,11 +551,14 @@ export interface MarketScannerTag {
541
551
  name?: string;
542
552
  values?: string[];
543
553
  }
544
- /** Market scanner tag set (market_scanner_tags). */
545
- export interface MarketScannerTags {
546
- tagFields?: string[];
547
- tags?: MarketScannerTag[];
554
+ /** Market-scanner tag group (one entry per market). wire: market_scanner_tags returns array of these. */
555
+ export interface MarketScannerTagGroup {
556
+ market?: string;
557
+ multiTagField?: string;
558
+ tagList?: MarketScannerTag[];
548
559
  }
560
+ /** @deprecated Use MarketScannerTagGroup[] instead. Kept for backwards compatibility. */
561
+ export type MarketScannerTags = MarketScannerTagGroup;
549
562
  /** Fund contract info (fund_contracts). */
550
563
  export interface FundContractInfo {
551
564
  symbol?: string;
@@ -203,7 +203,8 @@ export interface SegmentFundHistoryItem {
203
203
  updatedAt?: number;
204
204
  }
205
205
  export interface FundDetails {
206
- id?: number;
206
+ /** int64 fund-detail ID — server may return as string (e.g. "4733519770"). */
207
+ id?: string | number;
207
208
  account?: string;
208
209
  segType?: string;
209
210
  fundType?: string;
@@ -7,13 +7,16 @@
7
7
  */
8
8
  import { HttpClient } from '../client/http-client';
9
9
  import type { ClientConfig } from '../config/client-config';
10
- import type { MarketState, Brief, Kline, KlineItem, Timeline, TradeTick, Depth, OptionExpiration, OptionChain, FutureExchange, FutureContractInfo, FutureQuote, FutureKline, FutureKlineItem, FinancialDailyItem, FinancialReportItem, CorporateAction, CapitalFlow, CapitalDistribution, ScannerResult, QuotePermission, MarketScannerRequest, SymbolName, TradeMeta, StockDetail, StockBroker, StockIndustry, TradeRankItem, ShortInterest, KlineQuota, OptionAnalysis, OptionSymbol, FutureMainContractHistory, FutureTradingTime, FutureTradeTickItem, FutureDepth, WarrantBrief, WarrantFilterResult, IndustryItem, IndustryStock, TradingCalendarItem, ExchangeRate, FinancialCurrency, QuoteOvernight, MarketScannerTags, FundContractInfo, FundQuote, FundHistoryQuote, FinancialDailyRequest, FinancialReportRequest, CorporateActionRequest } from '../model/quote';
10
+ import type { MarketState, Brief, Kline, KlineItem, Timeline, TradeTick, Depth, OptionExpiration, OptionChain, FutureExchange, FutureContractInfo, FutureQuote, FutureKline, FutureKlineItem, FinancialDailyItem, FinancialReportItem, CorporateAction, CapitalFlow, CapitalDistribution, ScannerResult, QuotePermission, MarketScannerRequest, SymbolName, TradeMeta, StockDetail, StockBroker, StockIndustry, TradeRankItem, ShortInterest, KlineQuota, OptionAnalysis, OptionSymbol, FutureMainContractHistory, FutureTradingTime, FutureTradeTickItem, FutureDepth, WarrantBrief, WarrantFilterResult, IndustryItem, IndustryStock, TradingCalendarItem, ExchangeRate, FinancialCurrency, QuoteOvernight, MarketScannerTagGroup, FundContractInfo, FundQuote, FundHistoryQuote, FinancialDailyRequest, FinancialReportRequest, CorporateActionRequest } from '../model/quote';
11
11
  import type { BriefRequest, DepthQuoteRequest, TradeTickRequest, FutureBriefRequest, SymbolsRequest, TradeMetasRequest, StockDetailsRequest, StockDelayBriefsRequest, KlineRequest, KlineByPageRequest, TimelineHistoryRequest, TradeRankRequest, ShortInterestRequest, StockBrokerRequest, StockFundamentalRequest, StockIndustryRequest, KlineQuotaRequest, QuotePermissionRequest, OptionTradeTicksRequest, OptionTimelineRequest, OptionDepthRequest, OptionSymbolsRequest, OptionAnalysisRequest, FutureContractSingleRequest, AllFutureContractsRequest, FutureContinuousContractsRequest, FutureHistoryMainContractRequest, FutureKlineRequest, FutureKlineByPageRequest, FutureTradeTicksRequest, FutureDepthRequest, FutureTradingTimesRequest, FundSymbolsRequest, FundContractsRequest, FundQuoteRequest, FundHistoryQuoteRequest, WarrantBriefsRequest, WarrantFilterRequest, IndustryListRequest, IndustryStocksRequest, TradingCalendarRequest, FinancialExchangeRateRequest, FinancialCurrencyRequest, MarketScannerTagsRequest, QuoteOvernightRequest } from '../model/quote-requests';
12
12
  /**
13
13
  * Parse an OCC-style option identifier like "AAPL 260619C00150000"
14
14
  * into its component parts.
15
+ *
16
+ * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
17
+ * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
15
18
  */
16
- export declare function parseOptionIdentifier(identifier: string): {
19
+ export declare function parseOptionIdentifier(identifier: string, timezone?: string): {
17
20
  symbol: string;
18
21
  expiryMs: number;
19
22
  right: string;
@@ -35,7 +38,9 @@ export declare class QuoteClient {
35
38
  /** Unwrap server {"items":[...]} envelope. */
36
39
  private callIntoItems;
37
40
  getMarketState(market: string): Promise<MarketState[]>;
38
- /** Real-time stock briefs. wire: quote_real_time */
41
+ /** Real-time stock quotes. wire: quote_real_time */
42
+ getRealTimeQuote(req: BriefRequest): Promise<Brief[]>;
43
+ /** @deprecated Use getRealTimeQuote instead. */
39
44
  getBrief(req: BriefRequest): Promise<Brief[]>;
40
45
  getKline(req: KlineRequest): Promise<Kline[]>;
41
46
  getTimeline(symbols: string[]): Promise<Timeline[]>;
@@ -43,11 +48,30 @@ export declare class QuoteClient {
43
48
  getTradeTick(req: TradeTickRequest): Promise<TradeTick[]>;
44
49
  /** Depth snapshot. wire: quote_depth */
45
50
  getQuoteDepth(req: DepthQuoteRequest): Promise<Depth[]>;
46
- getOptionExpiration(symbols: string[]): Promise<OptionExpiration[]>;
47
- /** Option chain; each item is [symbol, "YYYY-MM-DD"]. */
48
- getOptionChain(items: Array<[string, string]>): Promise<OptionChain[]>;
51
+ getOptionExpiration(symbols: string[], market?: string): Promise<OptionExpiration[]>;
52
+ /**
53
+ * Option chain; each item is [symbol, "YYYY-MM-DD"].
54
+ *
55
+ * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
56
+ * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
57
+ */
58
+ getOptionChain(items: Array<[string, string]>, timezone?: string): Promise<OptionChain[]>;
59
+ /**
60
+ * Real-time option quotes by OCC-style identifier.
61
+ *
62
+ * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
63
+ * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
64
+ */
65
+ getOptionQuote(identifiers: string[], timezone?: string): Promise<Brief[]>;
66
+ /** @deprecated Use getOptionQuote instead. */
49
67
  getOptionBrief(identifiers: string[]): Promise<Brief[]>;
50
- getOptionKline(identifiers: string[], period: string): Promise<Kline[]>;
68
+ /**
69
+ * Option K-line by OCC-style identifier.
70
+ *
71
+ * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
72
+ * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
73
+ */
74
+ getOptionKline(identifiers: string[], period: string, beginTime?: number, endTime?: number, timezone?: string): Promise<Kline[]>;
51
75
  getFutureExchange(): Promise<FutureExchange[]>;
52
76
  getFutureContracts(exchange: string): Promise<FutureContractInfo[]>;
53
77
  /** Real-time futures quotes. wire: future_real_time_quote */
@@ -70,7 +94,9 @@ export declare class QuoteClient {
70
94
  getTradeMetas(req: TradeMetasRequest): Promise<TradeMeta[]>;
71
95
  /** Stock details. wire: stock_detail. Server returns {items:[...]}. */
72
96
  getStockDetails(req: StockDetailsRequest): Promise<StockDetail[]>;
73
- /** Delayed stock briefs. wire: quote_delay */
97
+ /** Delayed stock quotes. wire: quote_delay */
98
+ getDelayedQuote(req: StockDelayBriefsRequest): Promise<Brief[]>;
99
+ /** @deprecated Use getDelayedQuote instead. */
74
100
  getStockDelayBriefs(req: StockDelayBriefsRequest): Promise<Brief[]>;
75
101
  /** Client-side paginated K-line fetch. Loops until totalSize bars are collected, oldest-first. */
76
102
  getKlineByPage(req: KlineByPageRequest): Promise<KlineItem[]>;
@@ -131,7 +157,9 @@ export declare class QuoteClient {
131
157
  getFundQuote(req: FundQuoteRequest): Promise<FundQuote[]>;
132
158
  /** Fund historical NAV. wire: fund_history_quote */
133
159
  getFundHistoryQuote(req: FundHistoryQuoteRequest): Promise<FundHistoryQuote[]>;
134
- /** Warrant briefs. wire: warrant_briefs */
160
+ /** Real-time warrant quotes. wire: warrant_briefs */
161
+ getWarrantQuote(req: WarrantBriefsRequest): Promise<WarrantBrief[]>;
162
+ /** @deprecated Use getWarrantQuote instead. */
135
163
  getWarrantBriefs(req: WarrantBriefsRequest): Promise<WarrantBrief[]>;
136
164
  /** Warrant filter (paged). wire: warrant_filter */
137
165
  getWarrantFilter(req: WarrantFilterRequest): Promise<WarrantFilterResult | undefined>;
@@ -152,7 +180,7 @@ export declare class QuoteClient {
152
180
  /** Trading calendar. wire: trading_calendar */
153
181
  getTradingCalendar(req: TradingCalendarRequest): Promise<TradingCalendarItem[]>;
154
182
  /** Available market-scanner tags. wire: market_scanner_tags */
155
- getMarketScannerTags(req: MarketScannerTagsRequest): Promise<MarketScannerTags | undefined>;
183
+ getMarketScannerTags(req: MarketScannerTagsRequest): Promise<MarketScannerTagGroup[]>;
156
184
  /** Overnight quote. wire: quote_overnight */
157
185
  getQuoteOvernight(req: QuoteOvernightRequest): Promise<QuoteOvernight[]>;
158
186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tigeropenapi/tigeropen",
3
- "version": "0.4.8",
3
+ "version": "0.5.0",
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",