export type GetApiV1ScreenerDebugSymbolSymbolContractArgs = {symbol: string, expiry?: string | undefined, strike?: number | undefined, type?: string | undefined}; export type GetApiV1ScreenerDebugSymbolSymbolContractOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /v1/screener/debug/symbol/{symbol}/contract */ export const getApiV1ScreenerDebugSymbolSymbolContract = async (args: GetApiV1ScreenerDebugSymbolSymbolContractArgs, options: GetApiV1ScreenerDebugSymbolSymbolContractOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.expiry != null) query.append("expiry", String(args.expiry)) if (args.strike != null) query.append("strike", String(args.strike)) if (args.type != null) query.append("type", String(args.type)) if (ApiKey !== undefined) headers.set("X-Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/screener/debug/symbol/${encodeURIComponent(String(args.symbol))}/contract${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 };