Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 4 additions & 0 deletions c/csrc/include/longbridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
6 changes: 6 additions & 0 deletions c/src/calendar_context/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<CCalendarDateGroupOwned>,
next_date: CString,
}
impl From<CalendarEventsResponse> for CCalendarEventsResponseOwned {
fn from(v: CalendarEventsResponse) -> Self {
Self {
date: v.date.into(),
list: v.list.into(),
next_date: v.next_date.into(),
}
}
}
Expand All @@ -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(),
}
}
}
3 changes: 2 additions & 1 deletion cpp/include/calendar_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CalendarEventInfo> infos; };
/// Response for finance_calendar — events grouped by date within the requested range.
struct CalendarEventsResponse { std::string date; std::vector<CalendarDateGroup> list; };
/// Response for finance_calendar — events grouped by date within the requested range.
struct CalendarEventsResponse { std::string date; std::vector<CalendarDateGroup> list; std::string next_date; };

/// Financial calendar context — earnings, dividends, splits, IPOs, macro data.
class CalendarContext {
Expand Down
1 change: 1 addition & 0 deletions cpp/src/calendar_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
3 changes: 2 additions & 1 deletion java/src/types/classes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,8 @@ impl_java_class!(
[
date,
#[java(objarray)]
list
list,
next_date
]
);

Expand Down
2 changes: 2 additions & 0 deletions nodejs/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3397,6 +3397,8 @@ export interface CalendarEventsResponse {
date: string
/** Per-day event groups */
list: Array<CalendarDateGroup>
/** Pagination cursor; pass as start to fetch the next page, empty when there are no more pages */
nextDate: string
}

export declare const enum CashFlowDirection {
Expand Down
2 changes: 2 additions & 0 deletions python/pysrc/longbridge/openapi.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions rust/src/calendar/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions rust/src/calendar/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ pub struct CalendarEventsResponse {
pub date: String,
/// Per-day event groups
pub list: Vec<CalendarDateGroup>,
/// 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
Expand Down
Loading