@tigeropenapi/tigeropen 0.5.0 → 0.5.4

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 (33) hide show
  1. package/dist/cjs/client/api-response.js +17 -15
  2. package/dist/cjs/client/token-methods.js +42 -0
  3. package/dist/cjs/config/client-config.js +59 -11
  4. package/dist/cjs/config/config-parser.js +19 -9
  5. package/dist/cjs/config/index.js +2 -1
  6. package/dist/cjs/index.js +2 -1
  7. package/dist/cjs/model/enums.js +4 -0
  8. package/dist/cjs/model/order-helpers.js +126 -21
  9. package/dist/cjs/quote/quote-client.js +112 -21
  10. package/dist/cjs/trade/trade-client.js +74 -16
  11. package/dist/esm/client/api-response.js +17 -15
  12. package/dist/esm/client/token-methods.js +37 -0
  13. package/dist/esm/config/client-config.js +59 -12
  14. package/dist/esm/config/config-parser.js +19 -9
  15. package/dist/esm/config/index.js +1 -1
  16. package/dist/esm/index.js +1 -1
  17. package/dist/esm/model/enums.js +4 -0
  18. package/dist/esm/model/order-helpers.js +119 -20
  19. package/dist/esm/quote/quote-client.js +79 -21
  20. package/dist/esm/trade/trade-client.js +41 -16
  21. package/dist/types/client/api-response.d.ts +6 -5
  22. package/dist/types/client/token-methods.d.ts +34 -0
  23. package/dist/types/config/client-config.d.ts +2 -0
  24. package/dist/types/config/index.d.ts +1 -1
  25. package/dist/types/index.d.ts +3 -3
  26. package/dist/types/model/enums.d.ts +5 -1
  27. package/dist/types/model/order-helpers.d.ts +48 -8
  28. package/dist/types/model/order.d.ts +52 -1
  29. package/dist/types/model/quote.d.ts +56 -0
  30. package/dist/types/model/trade-requests.d.ts +41 -0
  31. package/dist/types/quote/quote-client.d.ts +31 -8
  32. package/dist/types/trade/trade-client.d.ts +19 -3
  33. package/package.json +1 -1
@@ -139,8 +139,59 @@ export interface OrderRequest {
139
139
  startTime?: number;
140
140
  /** 冰山单:生效结束时间(epoch ms) */
141
141
  endTime?: number;
142
+ /** GTD 到期时间(epoch ms) */
143
+ expireTime?: number;
144
+ /** 盘后委托价格 */
145
+ afterHoursPrice?: number;
146
+ /** 批次号 */
147
+ batchNo?: number;
148
+ /** 资金类型(CASH / MARGIN) */
149
+ segType?: string;
150
+ /** 按金额下单:委托金额 */
151
+ amount?: number;
152
+ /** 按金额下单:现金金额(wire: cash_amount,与 amount 二选一) */
153
+ cashAmount?: number;
154
+ /**
155
+ * @deprecated 服务端不再需要此字段,by-amount 订单直接设置 `cashAmount`。
156
+ * 保留仅为向前兼容,新代码勿使用。
157
+ */
158
+ isQuantityByAmount?: boolean;
159
+ /** 账户分配列表(机构账户) */
160
+ allocAccounts?: string[];
161
+ /** 各账户分配份额(与 allocAccounts 一一对应) */
162
+ allocShares?: number[];
163
+ /** 下单来源 */
164
+ source?: string;
165
+ /** 下单渠道 */
166
+ channel?: string;
167
+ /** 虚拟订单类型 */
168
+ virtualOrderType?: string;
169
+ /** 虚拟订单 ID */
170
+ virtualId?: string;
171
+ /** 止盈订单 ID(bracket 关联) */
172
+ profitTakerOrderId?: number;
173
+ /** 止损订单 ID(bracket 关联) */
174
+ stopLossOrderId?: number;
175
+ /** 本地流水号 */
176
+ localNo?: string;
177
+ /** OCA 订单组(One-Cancels-All) */
178
+ ocaOrders?: OrderRequest[];
179
+ /** 多腿期权各腿(MLEG) */
180
+ contractLegs?: ContractLegRequest[];
181
+ /** 组合单类型(如 MLEG) */
182
+ comboType?: string;
183
+ }
184
+ /** Single leg of a multi-leg option order (MLEG) */
185
+ export interface ContractLegRequest {
186
+ symbol?: string;
187
+ secType?: string;
188
+ expiry?: string;
189
+ strike?: string;
190
+ right?: string;
191
+ action?: string;
192
+ ratio?: number;
142
193
  }
143
- /** Attached leg for request side */
194
+ /** Attached profit/loss leg for order request side */
144
195
  export interface OrderLegRequest {
145
196
  legType: string;
146
197
  price?: number;
@@ -121,6 +121,26 @@ export interface OptionChainRow {
121
121
  put?: OptionLeg;
122
122
  call?: OptionLeg;
123
123
  }
124
+ /** Range filter, serialized as { min, max } — corresponds to Java Range<T> */
125
+ export interface Range {
126
+ min?: number;
127
+ max?: number;
128
+ }
129
+ /** Greeks range filters for option_chain (corresponds to Java OptionChainFilterModel.Greeks) */
130
+ export interface OptionChainFilterGreeks {
131
+ delta?: Range;
132
+ gamma?: Range;
133
+ vega?: Range;
134
+ theta?: Range;
135
+ rho?: Range;
136
+ }
137
+ /** Option chain filter (corresponds to Java OptionChainFilterModel) */
138
+ export interface OptionChainFilter {
139
+ inTheMoney?: boolean;
140
+ impliedVolatility?: Range;
141
+ openInterest?: Range;
142
+ greeks?: OptionChainFilterGreeks;
143
+ }
124
144
  export interface OptionChain {
125
145
  symbol: string;
126
146
  expiry: number;
@@ -217,6 +237,42 @@ export interface CorporateAction {
217
237
  fromFactor?: number;
218
238
  toFactor?: number;
219
239
  }
240
+ export interface CorporateSymbolChange {
241
+ symbol: string;
242
+ market?: string;
243
+ exchange?: string;
244
+ executeDate?: string;
245
+ actionType?: string;
246
+ oldSymbol?: string;
247
+ /** newSymbol is the ticker after the rename; same as symbol. */
248
+ newSymbol?: string;
249
+ }
250
+ export interface CorporateDelisting {
251
+ symbol: string;
252
+ market?: string;
253
+ exchange?: string;
254
+ executeDate?: string;
255
+ actionType?: string;
256
+ announcedDate?: string;
257
+ reason?: string;
258
+ }
259
+ export interface CorporateIPO {
260
+ symbol: string;
261
+ market?: string;
262
+ exchange?: string;
263
+ executeDate?: string;
264
+ actionType?: string;
265
+ ipoName?: string;
266
+ listingDate?: string;
267
+ listingPrice?: number;
268
+ sharesOutstanding?: number;
269
+ sharesFloat?: number;
270
+ offerAmount?: number;
271
+ priceRange?: string;
272
+ currency?: string;
273
+ minPurchaseQuantity?: number;
274
+ leverageRatio?: number;
275
+ }
220
276
  export interface CapitalFlowItem {
221
277
  time: string;
222
278
  timestamp: number;
@@ -11,6 +11,8 @@
11
11
  */
12
12
  export interface OrdersRequest {
13
13
  account?: string;
14
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
15
+ secretKey?: string;
14
16
  secType?: string;
15
17
  market?: string;
16
18
  symbol?: string;
@@ -32,6 +34,8 @@ export interface OrdersRequest {
32
34
  }
33
35
  export interface GetOrderRequest {
34
36
  account?: string;
37
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
38
+ secretKey?: string;
35
39
  id?: number;
36
40
  orderId?: number;
37
41
  isBrief?: boolean;
@@ -40,6 +44,8 @@ export interface GetOrderRequest {
40
44
  }
41
45
  export interface OrderTransactionsRequest {
42
46
  account?: string;
47
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
48
+ secretKey?: string;
43
49
  orderId?: number;
44
50
  symbol?: string;
45
51
  secType?: string;
@@ -56,6 +62,8 @@ export interface OrderTransactionsRequest {
56
62
  }
57
63
  export interface PositionsRequest {
58
64
  account?: string;
65
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
66
+ secretKey?: string;
59
67
  secType?: string;
60
68
  currency?: string;
61
69
  market?: string;
@@ -69,6 +77,8 @@ export interface PositionsRequest {
69
77
  }
70
78
  export interface AssetsRequest {
71
79
  account?: string;
80
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
81
+ secretKey?: string;
72
82
  subAccounts?: string[];
73
83
  segment?: boolean;
74
84
  marketValue?: boolean;
@@ -76,10 +86,14 @@ export interface AssetsRequest {
76
86
  }
77
87
  export interface ManagedAccountsRequest {
78
88
  account?: string;
89
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
90
+ secretKey?: string;
79
91
  lang?: string;
80
92
  }
81
93
  export interface DerivativeContractsRequest {
82
94
  account?: string;
95
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
96
+ secretKey?: string;
83
97
  symbols: string[];
84
98
  secType: string;
85
99
  expiry?: string;
@@ -87,6 +101,8 @@ export interface DerivativeContractsRequest {
87
101
  }
88
102
  export interface AnalyticsAssetRequest {
89
103
  account?: string;
104
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
105
+ secretKey?: string;
90
106
  segType?: string;
91
107
  /** 格式 "YYYY-MM-DD" */
92
108
  startDate?: string;
@@ -95,12 +111,16 @@ export interface AnalyticsAssetRequest {
95
111
  }
96
112
  export interface AggregateAssetsRequest {
97
113
  account?: string;
114
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
115
+ secretKey?: string;
98
116
  baseCurrency?: string;
99
117
  segType?: string;
100
118
  lang?: string;
101
119
  }
102
120
  export interface EstimateTradableQuantityRequest {
103
121
  account?: string;
122
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
123
+ secretKey?: string;
104
124
  symbol: string;
105
125
  secType: string;
106
126
  action: string;
@@ -115,6 +135,8 @@ export interface EstimateTradableQuantityRequest {
115
135
  }
116
136
  export interface ForexOrderRequest {
117
137
  account?: string;
138
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
139
+ secretKey?: string;
118
140
  segType?: string;
119
141
  sourceCurrency: string;
120
142
  targetCurrency: string;
@@ -125,6 +147,8 @@ export interface ForexOrderRequest {
125
147
  }
126
148
  export interface SegmentFundRequest {
127
149
  account?: string;
150
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
151
+ secretKey?: string;
128
152
  id?: string;
129
153
  fromSegment?: string;
130
154
  toSegment?: string;
@@ -135,6 +159,8 @@ export interface SegmentFundRequest {
135
159
  }
136
160
  export interface FundDetailsRequest {
137
161
  account?: string;
162
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
163
+ secretKey?: string;
138
164
  segTypes?: string[];
139
165
  fundType?: string;
140
166
  currency?: string;
@@ -148,6 +174,8 @@ export interface FundDetailsRequest {
148
174
  }
149
175
  export interface FundingHistoryRequest {
150
176
  account?: string;
177
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
178
+ secretKey?: string;
151
179
  segType?: string;
152
180
  currency?: string;
153
181
  /** 毫秒时间戳 */
@@ -159,6 +187,8 @@ export interface FundingHistoryRequest {
159
187
  }
160
188
  export interface PositionTransferRequest {
161
189
  fromAccount?: string;
190
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
191
+ secretKey?: string;
162
192
  toAccount: string;
163
193
  market?: string;
164
194
  transfers: Array<{
@@ -174,6 +204,8 @@ export interface PositionTransferRequest {
174
204
  export interface PositionTransferRecordsRequest {
175
205
  /** wire: account_id */
176
206
  accountId?: string;
207
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
208
+ secretKey?: string;
177
209
  sinceDate?: string;
178
210
  toDate?: string;
179
211
  market?: string;
@@ -182,11 +214,15 @@ export interface PositionTransferRecordsRequest {
182
214
  }
183
215
  export interface PositionTransferDetailRequest {
184
216
  accountId?: string;
217
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
218
+ secretKey?: string;
185
219
  id: string;
186
220
  lang?: string;
187
221
  }
188
222
  export interface PositionTransferExternalRecordsRequest {
189
223
  accountId?: string;
224
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
225
+ secretKey?: string;
190
226
  sinceDate?: string;
191
227
  toDate?: string;
192
228
  market?: string;
@@ -196,6 +232,7 @@ export interface PositionTransferExternalRecordsRequest {
196
232
  /** 行权检验请求 (wire: option_exercise_check) */
197
233
  export interface OptionExerciseCheckRequest {
198
234
  account?: string;
235
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
199
236
  secretKey?: string;
200
237
  /** 期权合约 ID */
201
238
  contractId: number;
@@ -213,6 +250,7 @@ export interface OptionExerciseCheckRequest {
213
250
  /** 查询可行权持仓请求 (wire: option_exercise_position) */
214
251
  export interface OptionExercisePositionRequest {
215
252
  account?: string;
253
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
216
254
  secretKey?: string;
217
255
  /** Exercise | Expire */
218
256
  type: string;
@@ -221,6 +259,7 @@ export interface OptionExercisePositionRequest {
221
259
  /** 提交行权申请请求 (wire: option_exercise_submit) */
222
260
  export interface OptionExerciseSubmitRequest {
223
261
  account?: string;
262
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
224
263
  secretKey?: string;
225
264
  contractId: number;
226
265
  /** Exercise | Expire */
@@ -237,6 +276,7 @@ export interface OptionExerciseSubmitRequest {
237
276
  /** 分页查询行权记录请求 (wire: option_exercise_record) */
238
277
  export interface OptionExerciseRecordsRequest {
239
278
  account?: string;
279
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
240
280
  secretKey?: string;
241
281
  /** 从 1 开始,默认 1 */
242
282
  page?: number;
@@ -254,6 +294,7 @@ export interface OptionExerciseRecordsRequest {
254
294
  /** 撤销行权申请请求 (wire: option_exercise_cancel) */
255
295
  export interface OptionExerciseCancelRequest {
256
296
  account?: string;
297
+ /** Institution account secret key. Overrides the default set in ClientConfig; omit to use the config default. */
257
298
  secretKey?: string;
258
299
  id: number;
259
300
  lang?: string;
@@ -7,7 +7,8 @@
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, MarketScannerTagGroup, FundContractInfo, FundQuote, FundHistoryQuote, FinancialDailyRequest, FinancialReportRequest, CorporateActionRequest } from '../model/quote';
10
+ import type { TokenManager } from '../config/token-manager';
11
+ import type { MarketState, Brief, Kline, KlineItem, Timeline, TradeTick, Depth, OptionExpiration, OptionChain, OptionChainFilter, FutureExchange, FutureContractInfo, FutureQuote, FutureKline, FutureKlineItem, FinancialDailyItem, FinancialReportItem, CorporateAction, CorporateSymbolChange, CorporateDelisting, CorporateIPO, 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
12
  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
13
  /**
13
14
  * Parse an OCC-style option identifier like "AAPL 260619C00150000"
@@ -28,6 +29,18 @@ export declare class QuoteClient {
28
29
  constructor(httpClient: HttpClient);
29
30
  /** Create a QuoteClient directly from a ClientConfig — no need to construct HttpClient manually. */
30
31
  static fromConfig(config: ClientConfig): QuoteClient;
32
+ /** Call the `user_token_refresh` API and return the new token. Read-only. */
33
+ queryToken(): Promise<string>;
34
+ /** Refresh the token and update the in-memory config token. */
35
+ refreshToken(tokenManager?: TokenManager | null): Promise<void>;
36
+ /**
37
+ * Start background token auto-refresh. Returns a TokenManager to stop with `tm.stopAutoRefresh()`.
38
+ *
39
+ * @param refreshDurationSecs - Refresh threshold in seconds (minimum 30).
40
+ * @param checkIntervalMs - How often to check, in milliseconds (default 300 000 / 5 min).
41
+ * @param tokenWriter - Optional callback invoked after each successful refresh.
42
+ */
43
+ startTokenAutoRefresh(refreshDurationSecs: number, checkIntervalMs?: number, tokenWriter?: (token: string) => void): TokenManager;
31
44
  private callInto;
32
45
  /**
33
46
  * Some endpoints return either a list or a single object depending on the
@@ -54,24 +67,28 @@ export declare class QuoteClient {
54
67
  *
55
68
  * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
56
69
  * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
70
+ * @param returnGreekValue - Whether to return Greeks (delta/gamma/theta/vega/rho).
71
+ * @param optionFilter - Optional filter for in-the-money status, IV range, open interest range, Greeks ranges.
57
72
  */
58
- getOptionChain(items: Array<[string, string]>, timezone?: string): Promise<OptionChain[]>;
73
+ getOptionChain(items: Array<[string, string]>, timezone?: string, returnGreekValue?: boolean, optionFilter?: OptionChainFilter): Promise<OptionChain[]>;
59
74
  /**
60
- * Real-time option quotes by OCC-style identifier.
75
+ * Option K-line by OCC-style identifier.
61
76
  *
62
77
  * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
63
78
  * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
79
+ * @param limit - Maximum number of bars to return.
80
+ * @param sortDir - Sort direction ('asc' or 'desc').
64
81
  */
65
- getOptionQuote(identifiers: string[], timezone?: string): Promise<Brief[]>;
66
- /** @deprecated Use getOptionQuote instead. */
67
- getOptionBrief(identifiers: string[]): Promise<Brief[]>;
82
+ getOptionKline(identifiers: string[], period: string, beginTime?: number, endTime?: number, timezone?: string, limit?: number, sortDir?: string): Promise<Kline[]>;
68
83
  /**
69
- * Option K-line by OCC-style identifier.
84
+ * Real-time option quotes by OCC-style identifier.
70
85
  *
71
86
  * @param timezone - Optional IANA timezone for expiry conversion (e.g. 'America/New_York').
72
87
  * If omitted, defaults to America/New_York for US symbols and Asia/Hong_Kong for .HK symbols.
73
88
  */
74
- getOptionKline(identifiers: string[], period: string, beginTime?: number, endTime?: number, timezone?: string): Promise<Kline[]>;
89
+ getOptionQuote(identifiers: string[], timezone?: string): Promise<Brief[]>;
90
+ /** @deprecated Use getOptionQuote instead. */
91
+ getOptionBrief(identifiers: string[]): Promise<Brief[]>;
75
92
  getFutureExchange(): Promise<FutureExchange[]>;
76
93
  getFutureContracts(exchange: string): Promise<FutureContractInfo[]>;
77
94
  /** Real-time futures quotes. wire: future_real_time_quote */
@@ -173,6 +190,12 @@ export declare class QuoteClient {
173
190
  getCorporateDividend(req: CorporateActionRequest): Promise<CorporateAction[]>;
174
191
  /** Corporate earnings calendar (flattened). wire: corporate_action (action_type=earning) */
175
192
  getCorporateEarningsCalendar(req: CorporateActionRequest): Promise<CorporateAction[]>;
193
+ /** Corporate symbol change (flattened). wire: corporate_action (action_type=symbol_change) */
194
+ getCorporateSymbolChange(req: Omit<CorporateActionRequest, 'actionType'>): Promise<CorporateSymbolChange[]>;
195
+ /** Corporate delisting (flattened). wire: corporate_action (action_type=delisting) */
196
+ getCorporateDelisting(req: Omit<CorporateActionRequest, 'actionType'>): Promise<CorporateDelisting[]>;
197
+ /** Corporate IPO (flattened). wire: corporate_action (action_type=ipo) */
198
+ getCorporateIPO(req: Omit<CorporateActionRequest, 'actionType'>): Promise<CorporateIPO[]>;
176
199
  /** Financial currency per symbol. wire: financial_currency */
177
200
  getFinancialCurrency(req: FinancialCurrencyRequest): Promise<FinancialCurrency[]>;
178
201
  /** FX rates. wire: financial_exchange_rate */
@@ -9,6 +9,7 @@
9
9
  */
10
10
  import { HttpClient } from '../client/http-client';
11
11
  import type { ClientConfig } from '../config/client-config';
12
+ import type { TokenManager } from '../config/token-manager';
12
13
  import type { OrderRequest, Order } from '../model/order';
13
14
  import type { Contract } from '../model/contract';
14
15
  import type { Position } from '../model/position';
@@ -22,6 +23,24 @@ export declare class TradeClient {
22
23
  constructor(httpClient: HttpClient, account: string, secretKey?: string);
23
24
  /** Create a TradeClient directly from a ClientConfig — no need to construct HttpClient manually. */
24
25
  static fromConfig(config: ClientConfig, account: string, secretKey?: string): TradeClient;
26
+ /** Call the `user_token_refresh` API and return the new token. Read-only. */
27
+ queryToken(): Promise<string>;
28
+ /**
29
+ * Refresh the token: call the API, update the in-memory config token, and
30
+ * optionally persist via the provided TokenManager (file + writer callback).
31
+ *
32
+ * @param tokenManager - optional TokenManager for file persistence and writer callback
33
+ */
34
+ refreshToken(tokenManager?: TokenManager | null): Promise<void>;
35
+ /**
36
+ * Start background token auto-refresh. Returns a TokenManager that can be
37
+ * used to stop the background task via `tm.stopAutoRefresh()`.
38
+ *
39
+ * @param refreshDurationSecs - Refresh threshold in seconds (minimum 30).
40
+ * @param checkIntervalMs - How often to check, in milliseconds (default 300 000 / 5 min).
41
+ * @param tokenWriter - Optional callback invoked after each successful refresh.
42
+ */
43
+ startTokenAutoRefresh(refreshDurationSecs: number, checkIntervalMs?: number, tokenWriter?: (token: string) => void): TokenManager;
25
44
  private callInto;
26
45
  /** Strip `{items: [...]}` envelope used by most trade read endpoints. */
27
46
  private callIntoItems;
@@ -62,9 +81,6 @@ export declare class TradeClient {
62
81
  getFilledOrders(req?: OrdersRequest): Promise<Order[]>;
63
82
  /**
64
83
  * Get a single order by ID (v0.4.0 new).
65
- * Wire method: `orders` with id/order_id param; server returns a single Order object
66
- * (not `{items:[]}` envelope).
67
- *
68
84
  * Returns `undefined` if no match.
69
85
  */
70
86
  getOrder(req: GetOrderRequest): Promise<Order | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tigeropenapi/tigeropen",
3
- "version": "0.5.0",
3
+ "version": "0.5.4",
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",