export type GetApiV1PricingIvArgs = {spot?: number | undefined, strike?: number | undefined, dte?: number | undefined, price?: number | undefined, type?: string | undefined, r?: number | undefined, q?: number | undefined}; export type GetApiV1PricingIvOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /v1/pricing/iv */ export const getApiV1PricingIv = async (args: GetApiV1PricingIvArgs, options: GetApiV1PricingIvOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.spot != null) query.append("spot", String(args.spot)) if (args.strike != null) query.append("strike", String(args.strike)) if (args.dte != null) query.append("dte", String(args.dte)) if (args.price != null) query.append("price", String(args.price)) if (args.type != null) query.append("type", String(args.type)) if (args.r != null) query.append("r", String(args.r)) if (args.q != null) query.append("q", String(args.q)) if (ApiKey !== undefined) headers.set("X-Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/pricing/iv${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 };