export type GetApiV1StocksTechnicalIndicatorTickerArgs = {ticker: string, function: 'AD' | 'ADOSC' | 'ADX' | 'ADXR' | 'APO' | 'AROON' | 'AROONOSC' | 'ATR' | 'BBANDS' | 'BOP' | 'CCI' | 'CMO' | 'DEMA' | 'DX' | 'EMA' | 'HT_DCPERIOD' | 'HT_DCPHASE' | 'HT_PHASOR' | 'HT_SINE' | 'HT_TRENDLINE' | 'HT_TRENDMODE' | 'KAMA' | 'MACD' | 'MACDEXT' | 'MAMA' | 'MFI' | 'MIDPOINT' | 'MIDPRICE' | 'MINUS_DI' | 'MINUS_DM' | 'MOM' | 'NATR' | 'OBV' | 'PLUS_DI' | 'PLUS_DM' | 'PPO' | 'ROC' | 'ROCR' | 'RSI' | 'SAR' | 'SMA' | 'STOCH' | 'STOCHF' | 'STOCHRSI' | 'T3' | 'TEMA' | 'TRANGE' | 'TRIMA' | 'TRIX' | 'ULTOSC' | 'VWAP' | 'WILLR' | 'WMA', interval?: ('1min' | '5min' | '15min' | '30min' | '60min' | 'daily' | 'weekly' | 'monthly') | undefined, series_type?: ('close' | 'open' | 'high' | 'low') | undefined, time_period?: number | undefined}; export type GetApiV1StocksTechnicalIndicatorTickerOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Technical indicator time series for one ticker (on-demand materialization) * * GET /v1/stocks/technical-indicator/{ticker} */ export const getApiV1StocksTechnicalIndicatorTicker = async (args: GetApiV1StocksTechnicalIndicatorTickerArgs, options?: GetApiV1StocksTechnicalIndicatorTickerOptions) => { const {baseUrl = "https://api.yehangshe.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.function != null) query.append("function", String(args.function)) if (args.interval != null) query.append("interval", String(args.interval)) if (args.series_type != null) query.append("series_type", String(args.series_type)) if (args.time_period != null) query.append("time_period", String(args.time_period)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/stocks/technical-indicator/${encodeURIComponent(String(args.ticker))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };