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