Skip to content

feat(fundamental): add macrodata_indicators and macrodata methods#540

Open
hogan-yuan wants to merge 24 commits into
mainfrom
feat/economic-indicator
Open

feat(fundamental): add macrodata_indicators and macrodata methods#540
hogan-yuan wants to merge 24 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):

  • macrodata_indicators(offset, limit)GET /v1/quote/macrodata — list all macroeconomic indicators (~619 total)
  • macrodata(indicator_code, start_date, end_date, limit)GET /v1/quote/macrodata/{indicator_code} — fetch historical data for one indicator

start_date / end_date 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: Vec<Macrodata>

Time field formats

All timestamp fields (start_date, release_at, next_release_at) are returned as OffsetDateTime (Rust / Java), datetime (Python), i64 unix seconds (Node.js) — consistent with other SDK methods.

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>
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