Skip to content

feat: add shareholders, screener, short-trades, rank, stock-events, valuation-comparison APIs#92

Draft
hogan-yuan wants to merge 3 commits into
mainfrom
feat/shareholders-screener-short-trades-rank
Draft

feat: add shareholders, screener, short-trades, rank, stock-events, valuation-comparison APIs#92
hogan-yuan wants to merge 3 commits into
mainfrom
feat/shareholders-screener-short-trades-rank

Conversation

@hogan-yuan
Copy link
Copy Markdown
Member

Summary

Ports 13 new APIs from longbridge-mcp PR #49 and longbridge-terminal PR #209.

FundamentalContext (3 new methods)

  • ShareholderTop(symbol) — GET /v1/quote/shareholders/top
  • ShareholderDetail(symbol, objectID) — GET /v1/quote/shareholders/holding
  • ValuationComparison(symbol, currency, comparisonSymbols) — GET /v1/quote/compare/valuation

QuoteContext (2 new methods)

  • HkShortPositions(symbol, count) — GET /v1/quote/short-positions/hk
  • ShortTrades(symbol, count) — GET /v1/quote/short-trades/hk or /us (auto-detected)

MarketContext (3 new methods)

  • StockEvents(markets, sort, date, limit) — POST /v1/quote/market/stock-events
  • RankCategories() — GET /v1/quote/market/rank/categories
  • RankList(key, needArticle) — GET /v1/quote/market/rank/list

New ScreenerContext package (5 methods)

  • ScreenerRecommendStrategies() — GET /v1/quote/screener/strategies/recommend
  • ScreenerUserStrategies() — GET /v1/quote/screener/strategies/mine
  • ScreenerStrategy(id) — GET /v1/quote/screener/strategy
  • ScreenerSearch(market, strategyID, page, size) — POST /v1/quote/screener/search
  • ScreenerIndicators() — GET /v1/quote/screener/indicators

Test plan

  • go build ./...
  • go vet ./...
  • Runtime tests against production API

🤖 Generated with Claude Code

…ank APIs

- fundamental: ShareholderTop, ShareholderDetail, ValuationComparison (3 new methods)
- quote: HkShortPositions, ShortTrades with auto market detection (2 new methods)
- market: StockEvents (POST), RankCategories, RankList (3 new methods)
- screener: new package with ScreenerContext — RecommendStrategies,
  UserStrategies, Strategy, Search, Indicators (5 new methods)

All responses use json.RawMessage for forward-compatible raw data access.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…fied)

short_positions now auto-detects market from symbol suffix:
- .HK → GET /v1/quote/short-positions/hk (HKEX daily data)
- other → GET /v1/quote/short-positions/us (FINRA bi-monthly data)

Response is ShortPositionsResponse{Data json.RawMessage} since HK and US
have different shapes. HkShortPositions and ShortPositionStats removed.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ata APIs

The Go HTTP client already extracts the `data` field from the API envelope
before deserializing into the target struct. Wrapping in an intermediate
struct with `json:"data"` caused double-unwrapping, producing null Data.

Fix: use json.RawMessage directly as the deserialization target in
ShareholderTop, ShareholderDetail, ValuationComparison, StockEvents,
RankCategories, RankList, all screener methods.
Also add missing json:"data" tags to market/types.go and screener/types.go
response structs.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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