Skip to content

feat(fundamental): add macroeconomic_indicators and macroeconomic methods#540

Merged
hogan-yuan merged 29 commits into
mainfrom
feat/economic-indicator
Jun 11, 2026
Merged

feat(fundamental): add macroeconomic_indicators and macroeconomic methods#540
hogan-yuan merged 29 commits into
mainfrom
feat/economic-indicator

Conversation

@hogan-yuan

@hogan-yuan hogan-yuan commented Jun 9, 2026

Copy link
Copy Markdown
Member

Summary

Two new methods on FundamentalContext across all language SDKs (Rust, Python, Node.js, Java):

  • macroeconomic_indicators(country, offset, limit)GET /v1/quote/macrodata — list macroeconomic indicators; filter by country; response includes count (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_date 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 enum: HongKong / China / UnitedStates / EuroZone / Japan / Singapore (SDK accepts short codes, converts to full names for API)
MacroeconomicImportance Importance level: Low=1 / Medium=2 / High=3
MacroeconomicIndicator Indicator metadata (code, country, category, periodicity, importance, etc.)
MacroeconomicIndicatorListResponse data: Vec<MacroeconomicIndicator> + count: i32
Macroeconomic One historical data point (period, actual/previous/forecast/revised values, release timestamps, unit)
MacroeconomicResponse info: MacroeconomicIndicator + data: Vec<Macroeconomic> + count: i32

Fixes

  • MacroeconomicIndicator.describe / name / MacroeconomicResponse.info: handle null API responses without deserializing error

Related

hogan-yuan and others added 10 commits June 9, 2026 19:33
… 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>
@hogan-yuan hogan-yuan changed the title feat(fundamental): add economic_indicator_list and economic_indicator feat(fundamental): add macrodata_indicators and macrodata methods Jun 10, 2026
hogan-yuan and others added 3 commits June 10, 2026 11:50
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>
hogan-yuan and others added 2 commits June 10, 2026 13:58
…istResponse

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
hogan-yuan and others added 8 commits June 10, 2026 17:00
- 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>
hogan-yuan and others added 4 commits June 11, 2026 10:05
@hogan-yuan hogan-yuan changed the title feat(fundamental): add macrodata_indicators and macrodata methods feat(fundamental): add macroeconomic_indicators and macroeconomic methods Jun 11, 2026
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 hogan-yuan merged commit 534dfe0 into main Jun 11, 2026
56 checks passed
@hogan-yuan hogan-yuan deleted the feat/economic-indicator branch June 11, 2026 09:29
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>
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