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
38 changes: 24 additions & 14 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- **Rust, Python, Node.js:** Document normalization formulas for `SecurityCalcIndex` Greeks fields: `theta` (divide by 252 for per-trading-day), `vega` and `rho` (divide by 100 for per-unit change). The raw API values differ from Longbridge app display values by these factors.
- **Rust:** `Config::header(key, value)` builder method to inject custom headers into every HTTP request and WebSocket upgrade request.
- **Rust, Python:** `ContentContext` adds three new methods:
- `topic_detail(topic_id)` — get detail of a single topic.
- `list_topic_replies(opts)` — list replies for a topic, with optional page/size filtering.
- `create_topic_reply(opts)` — create a reply under a topic.
- **Rust, Python:** New types `ListTopicRepliesOptions`, `CreateReplyOptions`, and `TopicReply` to support the above methods.
- **All languages (Rust/Python/Node.js/Java/C/C++):** Six new `FundamentalContext` methods:
- `BusinessSegments` — GET `/v1/quote/fundamentals/business-segments`: latest business segment breakdown.
- `BusinessSegmentsHistory` — GET `/v1/quote/fundamentals/business-segments/history`: historical business and regional segment breakdowns with optional `report` and `cate` filters.
- `InstitutionRatingViews` — GET `/v1/quote/ratings/institutional`: historical rating distribution time-series (buy/over/hold/under/sell per date).
- `IndustryRank` — GET `/v1/quote/industry/rank`: industry leaderboard; exposes `IndustryRankIndicator` and `IndustryRankSortType` enum constants.
- `IndustryPeers` — GET `/v1/quote/industries/peers`: recursive industry peer chain; accepts both symbol-style (`AAPL.US`) and raw counter IDs (`BK/US/123`).
- `FinancialReportSnapshot` — GET `/v1/quote/financials/earnings-snapshot`: earnings snapshot with forecast and reported metrics.
- **Rust, Python, Node.js:** Document normalization formulas for `SecurityCalcIndex` Greeks fields: `theta` (divide by 252 for per-trading-day), `vega` and `rho` (divide by 100 for per-unit change).
- **Rust:** `Config::header(key, value)` builder method to inject custom headers.
- **Rust, Python:** `ContentContext` adds `topic_detail`, `list_topic_replies`, `create_topic_reply`.
- **All languages:** Six new `FundamentalContext` methods (PR #526): `BusinessSegments`, `BusinessSegmentsHistory`, `InstitutionRatingViews`, `IndustryRank`, `IndustryPeers`, `FinancialReportSnapshot`
- **C, C++:** C SDK bindings for all six PR #526 `FundamentalContext` APIs: `lb_fundamental_context_business_segments`, `lb_fundamental_context_business_segments_history`, `lb_fundamental_context_institution_rating_views`, `lb_fundamental_context_industry_rank`, `lb_fundamental_context_industry_peers`, `lb_fundamental_context_financial_report_snapshot`. New typed structs added to `longbridge.h`.
- **All languages:** 13 more new APIs: `shareholder_top`, `shareholder_detail`, `valuation_comparison` (FundamentalContext); `short_positions` (HK+US unified), `short_trades` (QuoteContext); `top_movers`, `rank_categories`, `rank_list` (MarketContext); `ScreenerContext` (new) with 5 screener methods

### Changed

- **Java, C, C++:** Response types for `short_positions`, `short_trades`, `top_movers`, `rank_list`, and `valuation_comparison` updated from raw-JSON stub structs to fully typed structs with named fields, matching the Rust/Python/Node.js SDK types. C SDK regenerated (`longbridge.h`) with new `lb_short_positions_item_t`, `lb_short_trades_item_t`, `lb_top_movers_stock_t`, `lb_top_movers_event_t`, `lb_rank_list_item_t`, `lb_valuation_history_point_t`, `lb_valuation_comparison_item_t` types.
- **All languages:** `QuoteContext::short_positions(symbol, count)` now auto-detects market from symbol suffix (`.HK` → HK, otherwise US). `ShortPositionsResponse` is raw JSON.
- **Rust, Python, Node.js, Java, C:** `short_positions` and `short_trades` responses now use typed structs (`ShortPositionsItem` / `ShortTradesItem`) with RFC 3339 timestamps instead of raw JSON. Fields absent in a given market default to empty string.
- **Rust, Python, Node.js, Java, C:** `rank_list` response now uses a typed `RankListResponse { bmp, lists: Vec<RankListItem> }` struct; `counter_id` is converted to `symbol`.
- **Rust, Python, Node.js, Java, C:** `top_movers` response now uses a typed `TopMoversResponse { events: Vec<TopMoversEvent>, next_params }` struct; timestamps converted to RFC 3339 and `counter_id` converted to `symbol`.
- **Rust, Python, Node.js, Java, C:** `valuation_comparison` response now uses a typed `ValuationComparisonResponse { list: Vec<ValuationComparisonItem> }` struct; history dates converted from Unix timestamp to RFC 3339 and `counter_id` converted to `symbol`.

### Breaking changes

- **All languages:** `MarketContext::stock_events` renamed to `top_movers`; `StockEventsResponse` → `TopMoversResponse`.
- **All languages:** `hk_short_positions` removed — use `short_positions(symbol, count)` which auto-detects HK/US.
- **All languages:** `ShortPositionsResponse.data` changed from raw JSON to `Vec<ShortPositionsItem>`; `ShortTradesResponse.data` changed from raw JSON to `Vec<ShortTradesItem>`.
- **All languages:** `TopMoversResponse.data` (raw JSON) replaced by `TopMoversResponse { events, next_params }`.
- **All languages:** `RankListResponse.data` (raw JSON) replaced by `RankListResponse { bmp, lists }`.
- **All languages:** `ValuationComparisonResponse.data` (raw JSON) replaced by `ValuationComparisonResponse { list }`.

# [4.1.0]

Expand Down
38 changes: 36 additions & 2 deletions c/cbindgen.toml
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,33 @@ cpp_compat = true
"CSnapshotReportedMetric" = "lb_snapshot_reported_metric_t"
"CFinancialReportSnapshot" = "lb_financial_report_snapshot_t"
# QuoteContext extensions
"CShortPosition" = "lb_short_position_t"
"CShortPositionsItem" = "lb_short_positions_item_t"
"CShortPositionsResponse" = "lb_short_positions_response_t"
"CShortTradesItem" = "lb_short_trades_item_t"
"CShortTradesResponse" = "lb_short_trades_response_t"
"COptionVolumeStats" = "lb_option_volume_stats_t"
"COptionVolumeDailyStat" = "lb_option_volume_daily_stat_t"
"COptionVolumeDaily" = "lb_option_volume_daily_t"
# FundamentalContext new types
"CShareholderTopResponse" = "lb_shareholder_top_response_t"
"CShareholderDetailResponse" = "lb_shareholder_detail_response_t"
"CValuationHistoryPoint" = "lb_valuation_history_point_t"
"CValuationComparisonItem" = "lb_valuation_comparison_item_t"
"CValuationComparisonResponse" = "lb_valuation_comparison_response_t"
# MarketContext new types
"CTopMoversStock" = "lb_top_movers_stock_t"
"CTopMoversEvent" = "lb_top_movers_event_t"
"CTopMoversResponse" = "lb_top_movers_response_t"
"CRankCategoriesResponse" = "lb_rank_categories_response_t"
"CRankListItem" = "lb_rank_list_item_t"
"CRankListResponse" = "lb_rank_list_response_t"
# ScreenerContext
"CScreenerContext" = "lb_screener_context_t"
"CScreenerRecommendStrategiesResponse" = "lb_screener_recommend_strategies_response_t"
"CScreenerUserStrategiesResponse" = "lb_screener_user_strategies_response_t"
"CScreenerStrategyResponse" = "lb_screener_strategy_response_t"
"CScreenerSearchResponse" = "lb_screener_search_response_t"
"CScreenerIndicatorsResponse" = "lb_screener_indicators_response_t"

[export]
include = [
Expand Down Expand Up @@ -415,7 +437,19 @@ include = [
# FundamentalContext opaque type (no rename, typedef added in hpp)
"CFundamentalContext",
# QuoteContext extensions
"CShortPosition", "CShortPositionsResponse",
"CShortPositionsItem", "CShortPositionsResponse",
"CShortTradesItem", "CShortTradesResponse",
"COptionVolumeStats",
"COptionVolumeDailyStat", "COptionVolumeDaily",
# FundamentalContext new types
"CShareholderTopResponse", "CShareholderDetailResponse",
"CValuationHistoryPoint", "CValuationComparisonItem", "CValuationComparisonResponse",
# MarketContext new types
"CTopMoversStock", "CTopMoversEvent", "CTopMoversResponse",
"CRankCategoriesResponse",
"CRankListItem", "CRankListResponse",
# ScreenerContext
"CScreenerContext",
"CScreenerRecommendStrategiesResponse", "CScreenerUserStrategiesResponse",
"CScreenerStrategyResponse", "CScreenerSearchResponse", "CScreenerIndicatorsResponse",
]
Loading
Loading