export type GetApiFinancialDatasetsInstitutionalHoldingsArgs = {filer_cik?: string | undefined, ticker?: string | undefined, limit?: number | undefined, cursor?: string | undefined}; export type GetApiFinancialDatasetsInstitutionalHoldingsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Query 13F institutional holdings by filer CIK or by held ticker. Provide exactly one of `filer_cik` or `ticker`. When no `report_period` filter is supplied, `?filer_cik=...` returns the filer's most recent 13F and `?ticker=...` returns one position per institutional filer whose most recent 13F currently includes the ticker (filers who have since dropped the position are excluded). * * GET /financial-datasets/institutional-holdings */ export const getApiFinancialDatasetsInstitutionalHoldings = async (args: GetApiFinancialDatasetsInstitutionalHoldingsArgs, options?: GetApiFinancialDatasetsInstitutionalHoldingsOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.filer_cik != null) query.append("filer_cik", String(args.filer_cik)) if (args.ticker != null) query.append("ticker", String(args.ticker)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.cursor != null) query.append("cursor", String(args.cursor)) const url = `${baseUrl.replace(/\/+$/, '')}/financial-datasets/institutional-holdings${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 };