feat: add shareholders, screener, short-trades, rank, stock-events, valuation-comparison APIs#527
Draft
hogan-yuan wants to merge 4 commits into
Draft
feat: add shareholders, screener, short-trades, rank, stock-events, valuation-comparison APIs#527hogan-yuan wants to merge 4 commits into
hogan-yuan wants to merge 4 commits into
Conversation
- FundamentalContext: shareholder_top, shareholder_detail, valuation_comparison - QuoteContext: hk_short_positions, short_trades (auto-detects HK vs US endpoint) - MarketContext: stock_events (POST), rank_categories, rank_list - New ScreenerContext: screener_recommend_strategies, screener_user_strategies, screener_strategy, screener_search (POST), screener_indicators - All methods have matching blocking (sync) wrappers - All new response types use serde_json::Value for flexible raw-JSON payloads Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
… APIs to all language SDKs
Rust SDK:
- `short_positions(symbol, count)` now auto-detects market from symbol suffix
(.HK → GET /v1/quote/short-positions/hk, else → /v1/quote/short-positions/us).
`ShortPositionsResponse` is now a raw JSON wrapper (`data: serde_json::Value`).
`hk_short_positions` and `ShortPosition` struct are removed.
Python / Node.js / Java / C / C++ SDKs:
- Port all 13 new Rust APIs added in the previous commit:
- FundamentalContext: shareholder_top, shareholder_detail, valuation_comparison
- QuoteContext: updated short_positions (HK+US, count param), short_trades
- MarketContext: stock_events, rank_categories, rank_list
- ScreenerContext (new): screener_recommend_strategies, screener_user_strategies,
screener_strategy, screener_search, screener_indicators
- All new "raw JSON" responses expose data as a string (Java/C/C++/Node.js)
or a Python object (Python, via pythonize).
- Updated openapi.pyi type stubs for all new types and methods.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ank_categories/rank_list These were already declared in longbridge.h (via cbindgen); the manual forward declarations in market_context.cpp had mismatched types (const char** vs const char* const*, size_t vs uintptr_t). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 task
…lization The HTTP client extracts the `data` field from the API envelope before deserializing into the target struct. Response structs with `data: serde_json::Value` caused a double-unwrap — the inner JSON has no `data` key, so deserialization failed with "missing field `data`". Fix: deserialize to `serde_json::Value` first, then construct the response struct explicitly. Affects 13 new methods across FundamentalContext, QuoteContext, MarketContext, and ScreenerContext. Verified against production API: Python SDK 17/17 pass. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ports 13 new APIs from longbridge-mcp PR #49 and longbridge-terminal PR #209.
FundamentalContext (3 new methods)
shareholder_top(symbol)— GET/v1/quote/shareholders/topshareholder_detail(symbol, object_id)— GET/v1/quote/shareholders/holdingvaluation_comparison(symbol, currency, comparison_symbols)— GET/v1/quote/compare/valuationQuoteContext (2 new methods)
hk_short_positions(symbol, count)— GET/v1/quote/short-positions/hkshort_trades(symbol, count)— GET/v1/quote/short-trades/hkor/us(auto-detected)MarketContext (3 new methods)
stock_events(markets, sort, date, limit)— POST/v1/quote/market/stock-eventsrank_categories()— GET/v1/quote/market/rank/categoriesrank_list(key, need_article)— GET/v1/quote/market/rank/listNew ScreenerContext (5 methods)
screener_recommend_strategies()— GET/v1/quote/screener/strategies/recommendscreener_user_strategies()— GET/v1/quote/screener/strategies/minescreener_strategy(id)— GET/v1/quote/screener/strategyscreener_search(market, strategy_id, page, size)— POST/v1/quote/screener/searchscreener_indicators()— GET/v1/quote/screener/indicatorsTest plan
cargo clippy --all --all-features✅cargo +nightly fmt --all✅🤖 Generated with Claude Code