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
@hogan-yuan hogan-yuan mentioned this pull request Sep 30, 2026
hogan-yuan added a commit that referenced this pull request Sep 30, 2026
Release **v5.2.0**. Bumps workspace `5.1.0` → `5.2.0`.

### New since v5.1.0
- **Breaking:** `TradeContext.fund_positions` — the `FundPosition`
identifier field is renamed `symbol` → `counter_id` across all layers (C
`lb_fund_position_t.counter_id`, C++ `FundPosition::counter_id`, Java
`getCounterId()`, Node.js `counterId`, Python `counter_id`). The value
is now the full fund `counter_id` (e.g. `UT/FD/HK0000384492`); the ISIN
is recoverable as its last `/`-separated segment. Rust keeps a `symbol`
serde alias for transition; the request-side filter
`GetFundPositionsOptions.symbols` is unchanged (#598)
- **Added:** mutual-fund channel `FundContext` / `FundContextSync` — 28
endpoints across fund catalog & market data, the user's fund positions,
and fund orders/trading. Funds are addressed by `counter_id` (sent as a
query parameter; the `nav` / `performance` / `position_performance`
batch endpoints use a one-element `counter_ids` JSON array). Mirrored
across C, C++, Java, Node.js and Python (the Go SDK ships separately,
openapi-go#124) (#598)
- **Changed:** `CalendarContext.finance_calendar` now exposes pagination
— `count` / `offset` / `next` (with the new `CalendarPageDirection`
enum) (#597)
- **Fixed:** C/C++ — resolved a cbindgen name collision from the fund
FFI: `CFundPosition` / `CGetFundPositionsOptions` were renamed to
`CFundPositionItem` (`lb_fund_position_item_t`) /
`CFundPositionsOptions` (`lb_fund_positions_options_t`) so they no
longer overwrite the portfolio types (#598)

> #598 is technically breaking; released as minor per maintainer
decision.
hogan-yuan added a commit to longbridge/developers that referenced this pull request Oct 8, 2026
…1267)

## What

Sync the calendar reference docs with the SDK change in
longbridge/openapi#597 (which exposes the `finance_calendar` pagination
parameters), and roll up the outstanding calendar-doc fixes from the
now-stale #1125.

### 1. Pagination parameters

Add **`count`**, **`offset`** and **`next`** (`CalendarPageDirection`:
`Later` / `Earlier`) to the "SDK method parameters" table on every
calendar page — split / dividend / earnings / ipo / macro / meeting /
merge, across `en`, `zh-CN`, `zh-HK`.

### 2. Fix broken request examples

The split / dividend / earnings / ipo / macro pages called non-existent
per-category methods like `ctx.split_calendar("AAPL.US")` (wrong name,
and a symbol instead of a date range). Every language tab now calls the
real method:

```
finance_calendar(CalendarCategory.<Category>, "2024-01-01", "2024-03-31")
```

with the correct category per page (earnings → `Report`, macro →
`MacroData`, etc.), consistent with the meeting / merge pages. Rust
examples use the new 7-argument signature.

### 3. Missing translations

Add `zh-CN` / `zh-HK` `meeting_calendar` and `merge_calendar` pages (4
files) — they previously existed only in English.

### 4. Response examples

Fix the misleading Response Example JSON: macro now shows a real
macro-economic event instead of a stock, per-day event counts corrected
to match the single sample row, and sample dates aligned to the request
window.

## Note on #1125

This supersedes #1125, which addressed the same broken examples and
missing translations but targeted the pre-`.mdx` docs (the pages were
since migrated by `convert-md-to-mdx.ts`) and predates the pagination
change, so it can no longer merge cleanly.

Related: #1265
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