export type GetApiV1StrategiesVolCarrySymbolArgs = {symbol: string, expiry?: string | undefined, minOpenInterest?: number | undefined, targetShortDelta?: number | undefined, maxWidth?: number | undefined, minCredit?: number | undefined}; export type GetApiV1StrategiesVolCarrySymbolOptions = {baseUrl: string, ApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /v1/strategies/vol-carry/{symbol} */ export const getApiV1StrategiesVolCarrySymbol = async (args: GetApiV1StrategiesVolCarrySymbolArgs, options: GetApiV1StrategiesVolCarrySymbolOptions) => { 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.minOpenInterest != null) query.append("minOpenInterest", String(args.minOpenInterest)) if (args.targetShortDelta != null) query.append("targetShortDelta", String(args.targetShortDelta)) if (args.maxWidth != null) query.append("maxWidth", String(args.maxWidth)) if (args.minCredit != null) query.append("minCredit", String(args.minCredit)) if (ApiKey !== undefined) headers.set("X-Api-Key", ApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/strategies/vol-carry/${encodeURIComponent(String(args.symbol))}${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 };