export type GetApiV1FlowTickersTickerBucketArgs = {ticker: string, session_date?: string | undefined, window: 'day' | '1m' | '5m' | '15m' | '30m' | '60m', bucket_start_micros?: number | undefined, section?: ('summary' | 'top_contracts' | 'trades') | undefined, cohort?: ('rest' | 'zero_dte') | undefined, limit?: number | undefined, cursor?: string | undefined}; export type GetApiV1FlowTickersTickerBucketOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Bounded ticker bucket view: both cohort summaries, one cohort top-contract page, or one cohort trade page; truncated preserves the selected source cohort ceiling. ET dates use YYYY-MM-DD. * * GET /v1/flow/tickers/{ticker}/bucket */ export const getApiV1FlowTickersTickerBucket = async (args: GetApiV1FlowTickersTickerBucketArgs, options?: GetApiV1FlowTickersTickerBucketOptions) => { const {baseUrl = "https://api.yehangshe.com", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.session_date != null) query.append("session_date", String(args.session_date)) if (args.window != null) query.append("window", String(args.window)) if (args.bucket_start_micros != null) query.append("bucket_start_micros", String(args.bucket_start_micros)) if (args.section != null) query.append("section", String(args.section)) if (args.cohort != null) query.append("cohort", String(args.cohort)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.cursor != null) query.append("cursor", String(args.cursor)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/flow/tickers/${encodeURIComponent(String(args.ticker))}/bucket${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 };