Skip to content

fix(calendar): expose finance_calendar pagination parameters - #597

Merged
hogan-yuan merged 1 commit into
mainfrom
fix/finance-calendar-paginate
Sep 23, 2026
Merged

hogan-yuan merged 1 commit into
mainfrom
fix/finance-calendar-paginate

Conversation

@hogan-yuan

@hogan-yuan hogan-yuan commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

What

CalendarContext.finance_calendar issued a single request with no page-size control, so the server's default page cap (~10 events) made even a one-day query look truncated at 10 results (reported as longbridge/developers#1265).

Rather than hide pagination behind an internal loop, this exposes the endpoint's pagination controls so callers can page through results themselves:

  • add optional count (max events per page), offset (events to skip), and next (new CalendarPageDirection enum: Later / Earlier)
  • return the response's next_date cursor as-is

To retrieve a full window, request a larger count, or re-call with the returned next_date as start until it comes back empty.

Layers updated

Signature change propagated across every layer:

  • Rust core + blocking
  • C (extern fn + cbindgen header regenerated: lb_calendar_page_direction_t)
  • C++ (std::optional<...> params + enum)
  • Java (JNI + FinanceCalendarOptions fields + CalendarPageDirection class)
  • Node.js (napi; index.d.ts/index.js regenerated)
  • Python (PyO3 + openapi.pyi)

Verification

  • cargo clippy --all --all-features clean; cargo +nightly fmt --all
  • npm run build:debug regenerated the Node typings
  • C++ translation unit syntax-checked
  • Live-tested against the paper-trading gateway: finance_calendar(Split) now returns the requested window instead of a hard 10-item cap

Docs updated in longbridge/developers (separate PR).

Reported as longbridge/developers#1265

The finance_calendar method issued a single request with no page-size
control, so the server's default page cap (~10 events) made even a
one-day query look truncated at 10 results. Expose the endpoint's
pagination controls instead of hiding them behind an internal loop: add
optional `count`, `offset` and `next` (a new CalendarPageDirection enum)
parameters and return the response's `next_date` cursor as-is, so callers
can page through the full window themselves.

Propagated across all layers: Rust core + blocking, C (cbindgen), C++,
Java (JNI + FinanceCalendarOptions), Node.js (napi), Python (PyO3).

Reported as longbridge/developers#1265
@hogan-yuan
hogan-yuan force-pushed the fix/finance-calendar-paginate branch from e64f3c4 to a343f9b Compare September 23, 2026 01:56
@hogan-yuan hogan-yuan changed the title fix(calendar): paginate finance_calendar to return all events fix(calendar): expose finance_calendar pagination parameters Sep 23, 2026
@hogan-yuan
hogan-yuan merged commit 8278f46 into main Sep 23, 2026
56 checks passed
@hogan-yuan
hogan-yuan deleted the fix/finance-calendar-paginate branch September 23, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant