export type GetApiFinancialDatasetsInsiderTradesArgs = {ticker: string, limit?: number | undefined, name?: string | undefined, transaction_type?: string | undefined, form_type?: string | undefined, filing_date?: string | undefined, filing_date_gte?: string | undefined, filing_date_lte?: string | undefined, filing_date_gt?: string | undefined, filing_date_lt?: string | undefined, cursor?: string | undefined}; export type GetApiFinancialDatasetsInsiderTradesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get insider trades like buys and sells for a ticker by a company insider. * * GET /financial-datasets/insider-trades */ export const getApiFinancialDatasetsInsiderTrades = async (args: GetApiFinancialDatasetsInsiderTradesArgs, options?: GetApiFinancialDatasetsInsiderTradesOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.ticker != null) query.append("ticker", String(args.ticker)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.name != null) query.append("name", String(args.name)) if (args.transaction_type != null) query.append("transaction_type", String(args.transaction_type)) if (args.form_type != null) query.append("form_type", String(args.form_type)) if (args.filing_date != null) query.append("filing_date", String(args.filing_date)) if (args.filing_date_gte != null) query.append("filing_date_gte", String(args.filing_date_gte)) if (args.filing_date_lte != null) query.append("filing_date_lte", String(args.filing_date_lte)) if (args.filing_date_gt != null) query.append("filing_date_gt", String(args.filing_date_gt)) if (args.filing_date_lt != null) query.append("filing_date_lt", String(args.filing_date_lt)) if (args.cursor != null) query.append("cursor", String(args.cursor)) const url = `${baseUrl.replace(/\/+$/, '')}/financial-datasets/insider-trades${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 };