diff --git a/CHANGELOG.md b/CHANGELOG.md index 90b9bfb04..661e9fc3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [4.2.2] + +### Fixed + +- **All languages:** `CalendarEventsResponse` now exposes `next_date` cursor — callers can pass it as `start` (with the same `end`) to fetch the next page of `/v1/quote/finance_calendar` results +- **All languages:** `CalendarEventInfo.symbol` now returns standard symbol format (e.g. `CRM.US`) instead of raw `counter_id` format (e.g. `ST/US/CRM`) + ## [4.2.1] ### Changed diff --git a/Cargo.toml b/Cargo.toml index fabc86433..932f6f842 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ resolver = "3" members = ["rust", "python", "nodejs", "java", "c"] [workspace.package] -version = "4.2.1" +version = "4.2.2" edition = "2024" [profile.release] diff --git a/c/csrc/include/longbridge.h b/c/csrc/include/longbridge.h index cb8db05c0..81fefdb02 100644 --- a/c/csrc/include/longbridge.h +++ b/c/csrc/include/longbridge.h @@ -7110,6 +7110,10 @@ typedef struct lb_calendar_events_response_t { * Number of elements in the `list` array. */ uintptr_t num_list; + /** + * Pagination cursor; pass as start to fetch the next page, empty when there are no more pages. + */ + const char *next_date; } lb_calendar_events_response_t; /** diff --git a/c/src/calendar_context/types.rs b/c/src/calendar_context/types.rs index 6d1c559e7..014839660 100644 --- a/c/src/calendar_context/types.rs +++ b/c/src/calendar_context/types.rs @@ -198,16 +198,21 @@ pub struct CCalendarEventsResponse { pub list: *const CCalendarDateGroup, /// Number of elements in the `list` array. pub num_list: usize, + /// Pagination cursor; pass as start to fetch the next page, empty when + /// there are no more pages. + pub next_date: *const c_char, } pub(crate) struct CCalendarEventsResponseOwned { date: CString, list: CVec, + next_date: CString, } impl From for CCalendarEventsResponseOwned { fn from(v: CalendarEventsResponse) -> Self { Self { date: v.date.into(), list: v.list.into(), + next_date: v.next_date.into(), } } } @@ -218,6 +223,7 @@ impl ToFFI for CCalendarEventsResponseOwned { date: self.date.to_ffi_type(), list: self.list.to_ffi_type(), num_list: self.list.len(), + next_date: self.next_date.to_ffi_type(), } } } diff --git a/cpp/include/calendar_context.hpp b/cpp/include/calendar_context.hpp index f4c4ea65a..b42e28e53 100644 --- a/cpp/include/calendar_context.hpp +++ b/cpp/include/calendar_context.hpp @@ -26,7 +26,8 @@ struct CalendarEventInfo { std::string symbol; std::string market; std::string c /// Calendar events grouped by date. struct CalendarDateGroup { std::string date; int32_t count; std::vector infos; }; /// Response for finance_calendar — events grouped by date within the requested range. -struct CalendarEventsResponse { std::string date; std::vector list; }; +/// Response for finance_calendar — events grouped by date within the requested range. +struct CalendarEventsResponse { std::string date; std::vector list; std::string next_date; }; /// Financial calendar context — earnings, dividends, splits, IPOs, macro data. class CalendarContext { diff --git a/cpp/src/calendar_context.cpp b/cpp/src/calendar_context.cpp index ed9163f44..a4e48a29e 100644 --- a/cpp/src/calendar_context.cpp +++ b/cpp/src/calendar_context.cpp @@ -29,6 +29,7 @@ void CalendarContext::finance_calendar(CalendarCategory category, const std::str auto* r = (const lb_calendar_events_response_t*)res->data; CalendarEventsResponse resp; resp.date = r->date; + resp.next_date = r->next_date ? r->next_date : ""; for (size_t i = 0; i < r->num_list; ++i) { CalendarDateGroup grp; grp.date = r->list[i].date; grp.count = r->list[i].count; for (size_t j = 0; j < r->list[i].num_infos; ++j) { diff --git a/java/javasrc/src/main/java/com/longbridge/calendar/CalendarEventsResponse.java b/java/javasrc/src/main/java/com/longbridge/calendar/CalendarEventsResponse.java index 830a06e0d..b290b5065 100644 --- a/java/javasrc/src/main/java/com/longbridge/calendar/CalendarEventsResponse.java +++ b/java/javasrc/src/main/java/com/longbridge/calendar/CalendarEventsResponse.java @@ -6,4 +6,6 @@ public class CalendarEventsResponse { public String date; /** Per-day event groups. */ public CalendarDateGroup[] list; + /** Pagination cursor; pass as start to fetch the next page, empty when there are no more pages. */ + public String nextDate; } diff --git a/java/src/types/classes.rs b/java/src/types/classes.rs index 29c7751c2..141d5f839 100644 --- a/java/src/types/classes.rs +++ b/java/src/types/classes.rs @@ -1261,7 +1261,8 @@ impl_java_class!( [ date, #[java(objarray)] - list + list, + next_date ] ); diff --git a/nodejs/index.d.ts b/nodejs/index.d.ts index 40056b695..5de5f15f7 100644 --- a/nodejs/index.d.ts +++ b/nodejs/index.d.ts @@ -3397,6 +3397,8 @@ export interface CalendarEventsResponse { date: string /** Per-day event groups */ list: Array + /** Pagination cursor; pass as start to fetch the next page, empty when there are no more pages */ + nextDate: string } export declare const enum CashFlowDirection { diff --git a/python/pysrc/longbridge/openapi.pyi b/python/pysrc/longbridge/openapi.pyi index fa4bb05fd..5641e2bf9 100644 --- a/python/pysrc/longbridge/openapi.pyi +++ b/python/pysrc/longbridge/openapi.pyi @@ -10759,6 +10759,8 @@ class CalendarEventsResponse: """Start date of the query window""" list: list[CalendarDateGroup] """Per-day event groups""" + next_date: str + """Pagination cursor; pass as start to fetch the next page, empty when there are no more pages""" class CalendarCategory: diff --git a/rust/src/calendar/context.rs b/rust/src/calendar/context.rs index 6ed5bea05..5cbf6d90f 100644 --- a/rust/src/calendar/context.rs +++ b/rust/src/calendar/context.rs @@ -48,6 +48,9 @@ impl CalendarContext { /// Get financial calendar events. /// + /// The endpoint is paginated via `next_date`. When the returned + /// `next_date` is non-empty, pass it as `start` to fetch the next page. + /// /// Path: `GET /v1/quote/finance_calendar` pub async fn finance_calendar( &self, diff --git a/rust/src/calendar/types.rs b/rust/src/calendar/types.rs index 889f3e47e..b68a6488e 100644 --- a/rust/src/calendar/types.rs +++ b/rust/src/calendar/types.rs @@ -12,6 +12,10 @@ pub struct CalendarEventsResponse { pub date: String, /// Per-day event groups pub list: Vec, + /// Pagination cursor; pass as `start` to fetch the next page, empty when + /// there are no more pages + #[serde(default)] + pub next_date: String, } /// Events for one calendar date