@tigeropenapi/tigeropen 0.5.4 → 0.5.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.
@@ -9,7 +9,7 @@ import { HttpClient } from '../client/http-client';
9
9
  import type { ClientConfig } from '../config/client-config';
10
10
  import type { TokenManager } from '../config/token-manager';
11
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';
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
+ import type { BriefRequest, DepthQuoteRequest, TradeTickRequest, FutureBriefRequest, SymbolsRequest, TradeMetasRequest, StockDetailsRequest, StockDelayBriefsRequest, KlineRequest, KlineByPageRequest, TimelineRequest, 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';
13
13
  /**
14
14
  * Parse an OCC-style option identifier like "AAPL 260619C00150000"
15
15
  * into its component parts.
@@ -57,6 +57,7 @@ export declare class QuoteClient {
57
57
  getBrief(req: BriefRequest): Promise<Brief[]>;
58
58
  getKline(req: KlineRequest): Promise<Kline[]>;
59
59
  getTimeline(symbols: string[]): Promise<Timeline[]>;
60
+ getTimeline(req: TimelineRequest): Promise<Timeline[]>;
60
61
  /** Tick-by-tick trades. wire: trade_tick */
61
62
  getTradeTick(req: TradeTickRequest): Promise<TradeTick[]>;
62
63
  /** Depth snapshot. wire: quote_depth */
@@ -129,11 +130,18 @@ export declare class QuoteClient {
129
130
  getStockFundamental(req: StockFundamentalRequest): Promise<Record<string, unknown>>;
130
131
  /** Stock industry classification (array). wire: stock_industry */
131
132
  getStockIndustry(req: StockIndustryRequest): Promise<StockIndustry[]>;
132
- /** Quote permission detail. wire: get_quote_permission */
133
+ /** Market data permission entries. wire: get_quote_permission */
133
134
  getQuotePermission(req: QuotePermissionRequest): Promise<QuotePermission[]>;
134
135
  /** K-line quota usage. wire: kline_quota */
135
136
  getKlineQuota(req: KlineQuotaRequest): Promise<KlineQuota[]>;
136
- /** Option tick trades. wire: option_trade_tick */
137
+ /** Option tick trades. wire: option_trade_tick
138
+ *
139
+ * Server expects `biz_content` as a top-level JSON array (matches Java's
140
+ * `BatchApiModel` and Python's `MultipleContractParams.to_openapi_dict`).
141
+ * We unwrap the request here so the array is emitted directly instead of
142
+ * `{"contracts": [...]}`. Sending it as an object triggers
143
+ * `biz param error(failed to parse parameters in 'biz_content')`.
144
+ */
137
145
  getOptionTradeTicks(req: OptionTradeTicksRequest): Promise<TradeTick[]>;
138
146
  /** Option intraday timeline. wire: option_timeline */
139
147
  getOptionTimeline(req: OptionTimelineRequest): Promise<Timeline[]>;
@@ -154,7 +162,9 @@ export declare class QuoteClient {
154
162
  /** Historical main contracts. wire: future_main_contract */
155
163
  getFutureHistoryMainContract(req: FutureHistoryMainContractRequest): Promise<FutureMainContractHistory[]>;
156
164
  /** Futures K-line. wire: future_kline
157
- * beginTime / endTime default to -1 when unset (server requires them present). */
165
+ * beginTime / endTime default to -1 when unset (server requires them present).
166
+ * Server expects `contract_codes` (plural) — normalize singular `contractCode`
167
+ * to the plural form so callers can pass either shape. */
158
168
  getFutureKline(req: FutureKlineRequest): Promise<FutureKline[]>;
159
169
  /** Client-side paginated futures K-line fetch. */
160
170
  getFutureKlineByPage(req: FutureKlineByPageRequest): Promise<FutureKlineItem[]>;
@@ -180,8 +190,19 @@ export declare class QuoteClient {
180
190
  getWarrantBriefs(req: WarrantBriefsRequest): Promise<WarrantBrief[]>;
181
191
  /** Warrant filter (paged). wire: warrant_filter */
182
192
  getWarrantFilter(req: WarrantFilterRequest): Promise<WarrantFilterResult | undefined>;
183
- /** Industry list. wire: industry_list */
184
- getIndustryList(req: IndustryListRequest): Promise<IndustryItem[]>;
193
+ /** Industry list. wire: industry_list
194
+ *
195
+ * `industryLevel` is required by the server — omitting it returns
196
+ * `industry level error, all supported is: [GSECTOR, GGROUP, GIND, GSUBIND]`.
197
+ * Defaults to `GGROUP` when unset, matching Python SDK's
198
+ * `IndustryLevel.GGROUP` default.
199
+ *
200
+ * Wire fields differ from other endpoints (see `IndustryItem`): server sends
201
+ * `nameCN` / `nameEN` / `industryLevel`. This method hydrates the
202
+ * backwards-compat `name` (from `nameEN || nameCN`) and mirrors
203
+ * `industryLevel` to `level` so existing callers keep working.
204
+ */
205
+ getIndustryList(req?: IndustryListRequest): Promise<IndustryItem[]>;
185
206
  /** Stocks inside an industry. wire: industry_stock_list */
186
207
  getIndustryStocks(req: IndustryStocksRequest): Promise<IndustryStock[]>;
187
208
  /** Corporate split (flattened). wire: corporate_action (action_type=split) */
@@ -51,6 +51,21 @@ export declare class TradeClient {
51
51
  * `symbol` is the underlying (e.g. "AAPL"); `expiry` is "YYYYMMDD".
52
52
  */
53
53
  getQuoteContract(symbol: string, secType: string, expiry: string): Promise<Contract[]>;
54
+ /**
55
+ * Prepare an order request for the wire.
56
+ *
57
+ * The gateway expects `algo_params` as a `[{tag, value}, ...]` array
58
+ * (matching the Python SDK's AlgoParams.to_dict serialization), not the
59
+ * plain object shape that reads naturally in TypeScript. This helper
60
+ * normalizes the object form into the array form on outbound payloads
61
+ * so callers can pass the natural object and TWAP/VWAP orders work end
62
+ * to end without wire-format workarounds.
63
+ *
64
+ * Fields with undefined/null values are dropped; empty algoParams
65
+ * becomes an empty array rather than being stripped, matching the
66
+ * Python SDK behavior when the user passes an empty AlgoParams().
67
+ */
68
+ private marshalOrderForWire;
54
69
  placeOrder(order: OrderRequest): Promise<PlaceOrderResult | undefined>;
55
70
  previewOrder(order: OrderRequest): Promise<PreviewResult | undefined>;
56
71
  modifyOrder(id: number | string, order: OrderRequest): Promise<OrderIdResult | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tigeropenapi/tigeropen",
3
- "version": "0.5.4",
3
+ "version": "0.5.5",
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",
@@ -30,6 +30,8 @@
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",
32
32
  "test": "vitest run",
33
+ "test:unit": "vitest run --config vitest.config.ts",
34
+ "test:integ": "TIGER_RUN_INTEG=true vitest run --config vitest.integ.config.ts",
33
35
  "test:watch": "vitest",
34
36
  "clean": "rm -rf dist",
35
37
  "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"