export type GetApiV1FlowContractsContractSymbolBucketArgs = {contract_symbol: string, session_date?: string | undefined, bucket_start_micros: number, limit?: number | undefined, cursor?: string | undefined}; export type GetApiV1FlowContractsContractSymbolBucketOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Flow aggregates for one contract in an exact five-minute bucket, paged at up to 25 rows; truncated reports the source 200-row ceiling. ET dates use YYYY-MM-DD. * * GET /v1/flow/contracts/{contract_symbol}/bucket */ export const getApiV1FlowContractsContractSymbolBucket = async (args: GetApiV1FlowContractsContractSymbolBucketArgs, options?: GetApiV1FlowContractsContractSymbolBucketOptions) => { 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.bucket_start_micros != null) query.append("bucket_start_micros", String(args.bucket_start_micros)) 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/contracts/${encodeURIComponent(String(args.contract_symbol))}/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 };