export type GetApiFinancialDatasetsMacroYieldCurveSnapshotOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * The most recent business day US Treasury par yield curve as one object with one key per tenor. Refreshed each evening after the day final curve is published. * * GET /financial-datasets/macro/yield-curve/snapshot */ export const getApiFinancialDatasetsMacroYieldCurveSnapshot = async (options?: GetApiFinancialDatasetsMacroYieldCurveSnapshotOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/financial-datasets/macro/yield-curve/snapshot${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 };