feat(fundamental): add macroeconomic_indicators and macroeconomic methods#540
Merged
Conversation
… methods
Two new methods on FundamentalContext across all language SDKs:
- economic_indicator_list: GET /v1/quote/macrodata
- economic_indicator: GET /v1/quote/macrodata/{indicator_code}
New types: MultiLanguageText, EconomicIndicatorInfo, EconomicIndicatorData,
EconomicIndicatorResponse.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- EconomicIndicatorInfo.start_date: String -> Option<OffsetDateTime> - EconomicIndicatorData.release_at/next_release_at: String -> Option<OffsetDateTime> Python: PyOffsetDateTimeWrapper (datetime), Node.js: Option<i64> (unix seconds). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…FC3339) Input params now accept OffsetDateTime and are serialized as RFC3339 (2024-01-01T00:00:00Z) to match API requirements. - Rust/Python: Option<OffsetDateTime> - Node.js: Option<i64> unix seconds (converted internally) - Java: Option<OffsetDateTime> - Go: *time.Time Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
start_date -> start_time: YYYY-MM-DDT00:00:00Z end_date -> end_time: YYYY-MM-DDT23:59:59Z Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
EconomicIndicatorInfo -> MacrodataIndicatorInfo EconomicIndicatorData -> MacrodataRecord EconomicIndicatorResponse -> MacrodataResponse Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
MacrodataIndicatorInfo -> MacrodataIndicator MacrodataRecord -> Macrodata Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- start_date/release_at/next_release_at: timestamp_opt -> rfc3339_opt (API returns RFC3339 strings, not unix seconds) - EconomicIndicatorListResponse: rename data field to list Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
describe field can be null in API response; use null_as_default deserializer to map null -> Default (empty strings). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Vec<T> does not implement IntoJValue; ObjectArray<T> does. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…uild Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
hogan-yuan
added a commit
to longbridge/openapi-go
that referenced
this pull request
Jun 10, 2026
## Summary
Two new methods on `FundamentalContext`:
- `MacrodataIndicators(ctx, offset, limit)` — `GET /v1/quote/macrodata`
— list all macroeconomic indicators (~619 total)
- `Macrodata(ctx, indicatorCode, startDate, endDate, limit)` — `GET
/v1/quote/macrodata/{indicator_code}` — fetch historical data for one
indicator
`startDate` / `endDate` accept `"YYYY-MM-DD"` strings and are sent to
the API as `YYYY-MM-DDT00:00:00Z` / `YYYY-MM-DDT23:59:59Z`.
## New Types
| Type | Description |
|------|-------------|
| `MultiLanguageText` | Localized text (English / Simplified Chinese /
Traditional Chinese) |
| `MacrodataIndicator` | Indicator metadata (code, country, category,
periodicity, importance, etc.) |
| `Macrodata` | One historical data point (period,
actual/previous/forecast/revised values, release timestamps, unit) |
| `MacrodataResponse` | `Info MacrodataIndicator` + `Data []Macrodata` |
## Time field formats
All timestamp fields (`StartDate`, `ReleaseAt`, `NextReleaseAt`) are
returned as `*time.Time` (UTC) — consistent with other SDK methods.
## Related
- Upstream (all language SDKs): longbridge/openapi#540
---------
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…istResponse Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
3 tasks
- MacrodataIndicator.name: #[serde(default)] -> null_as_default - Macrodata.unit / unit_prefix: same - MacrodataResponse.info: add null_as_default (was missing entirely) - Derive Default on MacrodataIndicator and Macrodata to support null_as_default Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
- macrodata_indicators: add country param (MacrodataCountry enum), returns MacrodataIndicatorListResponse with count - macrodata: add offset param for pagination, response includes count - Add MacrodataImportance (1=Low/2=Medium/3=High) and MacrodataCountry enums Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
SDK accepts HK/CN/US/EU/JP/SG shortcodes; serde renames to full strings
('Hong Kong SAR China'/'China (Mainland)'/etc.) when serializing to query params.
Java JNI also accepts both shortcodes and full strings.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…factor Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…ng for country query param serde_urlencoded cannot serialize enums — convert MacrodataCountry to its API string value before building the query struct. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
hogan-yuan
added a commit
to longbridge/longbridge-terminal
that referenced
this pull request
Jun 10, 2026
New SDK changes: - macrodata_indicators() gains country filter (MacrodataCountry enum) - macrodata() gains offset parameter for pagination - Both responses now include count (total records) - null deserialization bug fixed in SDK (name/unit/unit_prefix/info) CLI changes: - Add --country flag (HK/CN/US/EU/JP/SG) for indicator list filtering - --page now applies to both list and history (offset = (page-1) * limit) - JSON output includes top-level count field in both modes - Pretty list output prints total count above the table Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
hogan-yuan
added a commit
to longbridge/longbridge-terminal
that referenced
this pull request
Jun 11, 2026
Syncs with longbridge/openapi#540 rename commits: - CLI command: macrodata → macroeconomic - SDK methods: macrodata_indicators → macroeconomic_indicators, macrodata → macroeconomic - SDK types: MacrodataIndicator → MacroeconomicIndicator, MacrodataResponse → MacroeconomicResponse, etc. - Internal functions renamed accordingly finance-calendar macrodata subcommand is unaffected (different feature). Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
hogan-yuan
added a commit
to longbridge/openapi-go
that referenced
this pull request
Jun 11, 2026
…ods (#99) ## Summary Two new methods on `FundamentalContext`: - `MacroeconomicIndicators(ctx, country, offset, limit)` — `GET /v1/quote/macrodata` — list macroeconomic indicators; filter by country (`MacroeconomicCountryHK/CN/US/EU/JP/SG`); response includes `Count` (total matching) - `Macroeconomic(ctx, indicatorCode, startDate, endDate, offset, limit)` — `GET /v1/quote/macrodata/{indicator_code}` — historical data for a specific indicator; `startDate` / `endDate` accept `"YYYY-MM-DD"` strings; response includes `Count` (total data points) ## New Types | Type | Description | |------|-------------| | `MultiLanguageText` | Localized text (English / Simplified Chinese / Traditional Chinese) | | `MacroeconomicCountry` | Country filter (`MacroeconomicCountryHK/CN/US/EU/JP/SG`); converts to full name for API | | `MacroeconomicImportance` | `MacroeconomicImportanceLow=1` / `Medium=2` / `High=3` | | `MacroeconomicIndicator` | Indicator metadata | | `MacroeconomicIndicatorListResponse` | `Data []MacroeconomicIndicator` + `Count int32` | | `Macroeconomic` | One historical data point | | `MacroeconomicResponse` | `Info MacroeconomicIndicator` + `Data []Macroeconomic` + `Count int32` | ## Related - Upstream (all language SDKs): longbridge/openapi#540 --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
This was referenced Jun 12, 2026
Closed
hogan-yuan
added a commit
to longbridge/longbridge-terminal
that referenced
this pull request
Jun 26, 2026
## Summary
New `longbridge macrodata` command — the indicator-dimension counterpart
of `finance-calendar macrodata` (which is the release-time dimension).
Same underlying data, organised by indicator instead of by date.
Two modes:
- **List**: `longbridge macrodata` — all supported indicators (619
total: US/JP/EU/CN/HK/SG)
- **History**: `longbridge macrodata <CODE>` — historical releases for
one indicator
## Usage
```bash
# List all indicators (default 20/page)
longbridge macrodata
longbridge macrodata --page 2
longbridge macrodata --country US --limit 50
# Query historical data
longbridge macrodata US00175
longbridge macrodata US00175 --start 2024-01-01 --end 2024-12-31
# Language control
longbridge --lang en macrodata US00175
longbridge --lang zh-CN macrodata --country US --limit 5
# AI/scripting
longbridge macrodata --format json
longbridge macrodata US00175 --format json
```
## Options
| Flag | Description |
|------|-------------|
| `[CODE]` | Indicator code. Omit to list all. |
| `--country` | Filter list: `HK` / `CN` / `US` / `EU` / `JP` / `SG` |
| `--start YYYY-MM-DD` | History start (sent as `T00:00:00Z`) |
| `--end YYYY-MM-DD` | History end (sent as `T23:59:59Z`) |
| `--limit` | Records per page, default 20 |
| `--page` | 1-based page number |
| `--lang` | Language for names/descriptions (`zh-CN` / `zh-HK` / `en`)
|
## JSON output
```json
// List
{
"count": 619, "page": 1, "limit": 20, "has_more": true,
"list": [{ "indicator_code": "US00175", "name": "CPI ...", "category": "...", ... }]
}
// History
{
"count": 1, "page": 1, "limit": 20, "has_more": false,
"info": { "indicator_code": "US00175", "name": "CPI ...", ... },
"data": [{ "period": "2026-05-01", "actual_value": "0.5", "release_at": 1781094600, ... }]
}
```
- `name` / `describe` / `unit` collapsed to a single string per the
`--lang` flag
- Timestamps are Unix integers (consistent with other CLI commands)
- `count` + `has_more` allow reliable pagination
## SDK dependency
Uses `FundamentalContext::macroeconomic_indicators` /
`FundamentalContext::macroeconomic` from `longbridge/openapi#540`
(merged into main).
## Test plan
- [ ] `longbridge macrodata` — list with Total, 20 rows
- [ ] `longbridge macrodata --country JP` — 94 Japanese indicators
- [ ] `longbridge macrodata --page 2` — next page
- [ ] `longbridge macrodata US00175` — history pretty, shows
actual/forecast/previous
- [ ] `longbridge macrodata --format json` — has `count`, `page`,
`limit`, `has_more`
- [ ] `longbridge macrodata US00175 --format json` — timestamps are
integers
- [ ] `longbridge --lang en macrodata US00175` — English name
- [ ] `longbridge macrodata INVALID` — `Error: Indicator code 'INVALID'
not found`
- [ ] `longbridge macrodata US00175 --country US` — warns `--country is
ignored when CODE is specified`
- [ ] `longbridge finance-calendar macrodata` — unaffected
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Jason Lee <huacnlee@gmail.com>
hogan-yuan
added a commit
to longbridge/developers
that referenced
this pull request
Jun 26, 2026
…1085) ## Summary 新增宏观经济数据相关文档,三语言(en / zh-CN / zh-HK)同步。 ### SDK docs(`docs/{lang}/docs/fundamental/fundamental/`) - 新增 `macroeconomic-indicators.md` — `macroeconomic_indicators` 方法(参数:country、keyword、offset、limit) - 新增 `macroeconomic.md` — `macroeconomic` 方法 - Schema 字段类型修正:`name`、`describe`、`unit`、`unit_prefix` 已改为 `string`(v2 breaking change) - MacroeconomicCountry value 改为缩写:HK / CN / US / EU / JP / SG - JSON 示例仅保留 v2 实际返回字段 ### CLI docs(`docs/{lang}/docs/cli/fundamentals/`) - 新增 `macrodata.md` — `longbridge macrodata` 命令 - 选项:`--country`、`--keyword`、`--lang`、`--start`/`--end`、`--limit`、`--page`、`--format` - JSON 响应结构说明(含 `page`、`limit`、`has_more`) ### MCP docs - `mcp.md` 三语言 capabilities 表格追加宏观经济指标、补充实时行情链接 ### Changelog & Release Notes - `changelog.md` 追加 2026-06-25 条目(SDK v4.3.3 + CLI v0.23.4) - `cli/release-notes.md` 追加 v0.23.4 条目 ## Related PRs - CLI: longbridge/longbridge-terminal#239 - SDK: longbridge/openapi#540 (merged), #543 (merged, v2 endpoints) - MCP: longbridge/longbridge-mcp#79 - Go SDK: longbridge/openapi-go#100 (merged) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- 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
Two new methods on
FundamentalContextacross all language SDKs (Rust, Python, Node.js, Java):macroeconomic_indicators(country, offset, limit)—GET /v1/quote/macrodata— list macroeconomic indicators; filter by country; response includescount(total matching)macroeconomic(indicator_code, start_date, end_date, offset, limit)—GET /v1/quote/macrodata/{indicator_code}— historical data for a specific indicator;start_date/end_dateaccept"YYYY-MM-DD"strings; response includescount(total data points)New Types
MultiLanguageTextMacroeconomicCountryHongKong/China/UnitedStates/EuroZone/Japan/Singapore(SDK accepts short codes, converts to full names for API)MacroeconomicImportanceLow=1/Medium=2/High=3MacroeconomicIndicatorMacroeconomicIndicatorListResponsedata: Vec<MacroeconomicIndicator>+count: i32MacroeconomicMacroeconomicResponseinfo: MacroeconomicIndicator+data: Vec<Macroeconomic>+count: i32Fixes
MacroeconomicIndicator.describe/name/MacroeconomicResponse.info: handlenullAPI responses without deserializing errorRelated