export type GetApiV1PricingGreeksArgs = {spot?: number | undefined, strike?: number | undefined, dte?: number | undefined, sigma?: number | undefined, type?: string | undefined, r?: number | undefined, q?: number | undefined}; export type GetApiV1PricingGreeksOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /v1/pricing/greeks */ export const getApiV1PricingGreeks = async (args: GetApiV1PricingGreeksArgs, options: GetApiV1PricingGreeksOptions) => { 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.sigma != null) query.append("sigma", String(args.sigma)) 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/greeks${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 };