From 31e7683d127b61b9b14846d1abd03517bf567b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E7=AB=A0=E6=B4=AA?= Date: Wed, 10 Jun 2026 17:50:17 +0800 Subject: [PATCH 1/8] feat(macrodata): add country filter, count field, offset param - MacrodataIndicators: add country parameter (MacrodataCountry enum) - MacrodataIndicators: return MacrodataIndicatorListResponse with count - Macrodata: add offset parameter for pagination - Macrodata: response includes count field - Add MacrodataImportance enum (1=Low, 2=Medium, 3=High) Co-Authored-By: Claude Sonnet 4.6 (1M context) --- fundamental/context.go | 28 +++++++++--------- fundamental/jsontypes/types.go | 8 ++++-- fundamental/types.go | 52 +++++++++++++++++++++++++++++----- 3 files changed, 65 insertions(+), 23 deletions(-) diff --git a/fundamental/context.go b/fundamental/context.go index facfc82..fec1577 100644 --- a/fundamental/context.go +++ b/fundamental/context.go @@ -1616,16 +1616,20 @@ func convertFinancialReportSnapshot(j *jsontypes.FinancialReportSnapshot) *Finan // MacrodataIndicators fetches the list of available macroeconomic indicators. // -// Pass offset and limit as nil to use the API defaults (offset=0, limit=100). -// To fetch all ~619 indicators in one call pass limit=1000. +// Pass country to filter by country code (e.g. MacrodataCountryUS). +// Pass nil for all countries. // // Path: GET /v1/quote/macrodata func (c *FundamentalContext) MacrodataIndicators( ctx context.Context, + country *MacrodataCountry, offset *int32, limit *int32, -) ([]MacrodataIndicator, error) { +) (*MacrodataIndicatorListResponse, error) { q := url.Values{} + if country != nil { + q.Set("country", string(*country)) + } if offset != nil { q.Set("offset", fmt.Sprintf("%d", *offset)) } @@ -1640,16 +1644,9 @@ func (c *FundamentalContext) MacrodataIndicators( for _, item := range resp.Data { out = append(out, convertMacrodataIndicator(&item)) } - return out, nil + return &MacrodataIndicatorListResponse{Data: out, Count: resp.Count}, nil } -// Macrodata fetches historical data for a specific macroeconomic -// indicator. -// -// startTime and endTime are Unix timestamps in seconds; pass nil to omit. -// limit defaults to 100 (max 100) when nil. -// -// Path: GET /v1/quote/macrodata/{indicator_code} // Macrodata fetches historical data for a specific macroeconomic indicator. // // startDate and endDate are date strings in "YYYY-MM-DD" format. @@ -1661,6 +1658,7 @@ func (c *FundamentalContext) Macrodata( indicatorCode string, startDate *string, endDate *string, + offset *int32, limit *int32, ) (*MacrodataResponse, error) { q := url.Values{} @@ -1670,6 +1668,9 @@ func (c *FundamentalContext) Macrodata( if endDate != nil { q.Set("end_time", *endDate+"T23:59:59Z") } + if offset != nil { + q.Set("offset", fmt.Sprintf("%d", *offset)) + } if limit != nil { q.Set("limit", fmt.Sprintf("%d", *limit)) } @@ -1683,8 +1684,9 @@ func (c *FundamentalContext) Macrodata( data = append(data, convertMacrodata(&d)) } return &MacrodataResponse{ - Info: convertMacrodataIndicator(&resp.Info), - Data: data, + Info: convertMacrodataIndicator(&resp.Info), + Data: data, + Count: resp.Count, }, nil } diff --git a/fundamental/jsontypes/types.go b/fundamental/jsontypes/types.go index 997f676..4831847 100644 --- a/fundamental/jsontypes/types.go +++ b/fundamental/jsontypes/types.go @@ -822,7 +822,8 @@ type MacrodataIndicator struct { // MacrodataIndicatorListResponse is the raw response for GET /v1/quote/macrodata. type MacrodataIndicatorListResponse struct { - Data []MacrodataIndicator `json:"list"` + Data []MacrodataIndicator `json:"list"` + Count int32 `json:"count"` } // Macrodata is one historical data point for a macroeconomic @@ -842,6 +843,7 @@ type Macrodata struct { // MacrodataResponse is the raw response for // GET /v1/quote/macrodata/{indicator_code}. type MacrodataResponse struct { - Info MacrodataIndicator `json:"info"` - Data []Macrodata `json:"data"` + Info MacrodataIndicator `json:"info"` + Data []Macrodata `json:"data"` + Count int32 `json:"count"` } diff --git a/fundamental/types.go b/fundamental/types.go index 251cda2..b056234 100644 --- a/fundamental/types.go +++ b/fundamental/types.go @@ -1363,9 +1363,46 @@ type MultiLanguageText struct { TraditionalChinese string } +// MacrodataCountry is a country code for filtering macroeconomic indicators. +type MacrodataCountry string + +const ( + MacrodataCountryUS MacrodataCountry = "US" // United States + MacrodataCountryCN MacrodataCountry = "CN" // China + MacrodataCountryEU MacrodataCountry = "EU" // Euro Zone + MacrodataCountryJP MacrodataCountry = "JP" // Japan + MacrodataCountryUK MacrodataCountry = "UK" // United Kingdom + MacrodataCountryDE MacrodataCountry = "DE" // Germany + MacrodataCountryFR MacrodataCountry = "FR" // France + MacrodataCountryAU MacrodataCountry = "AU" // Australia + MacrodataCountryCA MacrodataCountry = "CA" // Canada + MacrodataCountryKR MacrodataCountry = "KR" // South Korea + MacrodataCountryIN MacrodataCountry = "IN" // India + MacrodataCountryBR MacrodataCountry = "BR" // Brazil + MacrodataCountryHK MacrodataCountry = "HK" // Hong Kong + MacrodataCountrySG MacrodataCountry = "SG" // Singapore +) + +// MacrodataImportance is the importance level of a macroeconomic indicator. +type MacrodataImportance int32 + +const ( + MacrodataImportanceLow MacrodataImportance = 1 + MacrodataImportanceMedium MacrodataImportance = 2 + MacrodataImportanceHigh MacrodataImportance = 3 +) + +// MacrodataIndicatorListResponse is the response for FundamentalContext.MacrodataIndicators. +type MacrodataIndicatorListResponse struct { + // Data is the list of indicators. + Data []MacrodataIndicator + // Count is the total number of indicators matching the query. + Count int32 +} + // MacrodataIndicator is the metadata for one macroeconomic indicator. type MacrodataIndicator struct { - // IndicatorCode is the external vendor code (input to EconomicIndicator). + // IndicatorCode is the external vendor code (input to Macrodata). IndicatorCode string SourceOrg string Country string @@ -1375,14 +1412,13 @@ type MacrodataIndicator struct { Periodicity string Category string Describe MultiLanguageText - // Importance — higher is more important. + // Importance: 1=Low, 2=Medium, 3=High. Importance int32 // StartDate is the start date of data coverage; nil if unset. StartDate *time.Time } -// Macrodata is one historical data point for a macroeconomic -// indicator. +// Macrodata is one historical data point for a macroeconomic indicator. type Macrodata struct { // Period is the statistical period (e.g. "2024-Q1", "2024-03"). Period string @@ -1396,8 +1432,10 @@ type Macrodata struct { UnitPrefix MultiLanguageText } -// MacrodataResponse is the response for FundamentalContext.EconomicIndicator. +// MacrodataResponse is the response for FundamentalContext.Macrodata. type MacrodataResponse struct { - Info MacrodataIndicator - Data []Macrodata + Info MacrodataIndicator + Data []Macrodata + // Count is the total number of historical data points. + Count int32 } From 97b68fd5515b06c5af735e91f4af2fa0114f9ee2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E7=AB=A0=E6=B4=AA?= Date: Wed, 10 Jun 2026 17:53:06 +0800 Subject: [PATCH 2/8] fix: trim MacrodataCountry to 6 supported countries (HK/CN/US/EU/JP/SG) Co-Authored-By: Claude Sonnet 4.6 (1M context) --- fundamental/types.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/fundamental/types.go b/fundamental/types.go index b056234..10f46f8 100644 --- a/fundamental/types.go +++ b/fundamental/types.go @@ -1367,19 +1367,11 @@ type MultiLanguageText struct { type MacrodataCountry string const ( + MacrodataCountryHK MacrodataCountry = "HK" // Hong Kong SAR China + MacrodataCountryCN MacrodataCountry = "CN" // China (Mainland) MacrodataCountryUS MacrodataCountry = "US" // United States - MacrodataCountryCN MacrodataCountry = "CN" // China MacrodataCountryEU MacrodataCountry = "EU" // Euro Zone MacrodataCountryJP MacrodataCountry = "JP" // Japan - MacrodataCountryUK MacrodataCountry = "UK" // United Kingdom - MacrodataCountryDE MacrodataCountry = "DE" // Germany - MacrodataCountryFR MacrodataCountry = "FR" // France - MacrodataCountryAU MacrodataCountry = "AU" // Australia - MacrodataCountryCA MacrodataCountry = "CA" // Canada - MacrodataCountryKR MacrodataCountry = "KR" // South Korea - MacrodataCountryIN MacrodataCountry = "IN" // India - MacrodataCountryBR MacrodataCountry = "BR" // Brazil - MacrodataCountryHK MacrodataCountry = "HK" // Hong Kong MacrodataCountrySG MacrodataCountry = "SG" // Singapore ) From c94a4c05518708f6d7ae8aed17d36b4c261ac48d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E7=AB=A0=E6=B4=AA?= Date: Wed, 10 Jun 2026 17:55:25 +0800 Subject: [PATCH 3/8] fix: convert MacrodataCountry code to API full name before request SDK accepts HK/CN/US/EU/JP/SG; converts to 'Hong Kong SAR China'/'China (Mainland)'/etc. when sending to API. Co-Authored-By: Claude Sonnet 4.6 (1M context) --- fundamental/context.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/fundamental/context.go b/fundamental/context.go index fec1577..c6687c5 100644 --- a/fundamental/context.go +++ b/fundamental/context.go @@ -1628,7 +1628,7 @@ func (c *FundamentalContext) MacrodataIndicators( ) (*MacrodataIndicatorListResponse, error) { q := url.Values{} if country != nil { - q.Set("country", string(*country)) + q.Set("country", macrodataCountryToAPIValue(*country)) } if offset != nil { q.Set("offset", fmt.Sprintf("%d", *offset)) @@ -1738,3 +1738,22 @@ func convertMacrodata(j *jsontypes.Macrodata) Macrodata { UnitPrefix: convertMultiLanguageText(j.UnitPrefix), } } + +func macrodataCountryToAPIValue(c MacrodataCountry) string { + switch c { + case MacrodataCountryHK: + return "Hong Kong SAR China" + case MacrodataCountryCN: + return "China (Mainland)" + case MacrodataCountryUS: + return "United States" + case MacrodataCountryEU: + return "Euro Zone" + case MacrodataCountryJP: + return "Japan" + case MacrodataCountrySG: + return "Singapore" + default: + return string(c) + } +} From c480822829f0f289162a05932ba814af24bc9540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E7=AB=A0=E6=B4=AA?= Date: Thu, 11 Jun 2026 10:01:50 +0800 Subject: [PATCH 4/8] refactor: rename macrodata -> macroeconomic in all interfaces and types Co-Authored-By: Claude Sonnet 4.6 (1M context) --- fundamental/context.go | 44 +++++++++++++++++----------------- fundamental/jsontypes/types.go | 16 ++++++------- fundamental/types.go | 42 ++++++++++++++++---------------- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/fundamental/context.go b/fundamental/context.go index c6687c5..3ef1e16 100644 --- a/fundamental/context.go +++ b/fundamental/context.go @@ -1614,18 +1614,18 @@ func convertFinancialReportSnapshot(j *jsontypes.FinancialReportSnapshot) *Finan // ─── Macrodata ──────────────────────────────────────────────────── -// MacrodataIndicators fetches the list of available macroeconomic indicators. +// MacroeconomicIndicators fetches the list of available macroeconomic indicators. // -// Pass country to filter by country code (e.g. MacrodataCountryUS). +// Pass country to filter by country code (e.g. MacroeconomicCountryUS). // Pass nil for all countries. // // Path: GET /v1/quote/macrodata -func (c *FundamentalContext) MacrodataIndicators( +func (c *FundamentalContext) MacroeconomicIndicators( ctx context.Context, - country *MacrodataCountry, + country *MacroeconomicCountry, offset *int32, limit *int32, -) (*MacrodataIndicatorListResponse, error) { +) (*MacroeconomicIndicatorListResponse, error) { q := url.Values{} if country != nil { q.Set("country", macrodataCountryToAPIValue(*country)) @@ -1636,15 +1636,15 @@ func (c *FundamentalContext) MacrodataIndicators( if limit != nil { q.Set("limit", fmt.Sprintf("%d", *limit)) } - var resp jsontypes.MacrodataIndicatorListResponse + var resp jsontypes.MacroeconomicIndicatorListResponse if err := c.httpClient.Get(ctx, "/v1/quote/macrodata", q, &resp); err != nil { return nil, err } - out := make([]MacrodataIndicator, 0, len(resp.Data)) + out := make([]MacroeconomicIndicator, 0, len(resp.Data)) for _, item := range resp.Data { - out = append(out, convertMacrodataIndicator(&item)) + out = append(out, convertMacroeconomicIndicator(&item)) } - return &MacrodataIndicatorListResponse{Data: out, Count: resp.Count}, nil + return &MacroeconomicIndicatorListResponse{Data: out, Count: resp.Count}, nil } // Macrodata fetches historical data for a specific macroeconomic indicator. @@ -1660,7 +1660,7 @@ func (c *FundamentalContext) Macrodata( endDate *string, offset *int32, limit *int32, -) (*MacrodataResponse, error) { +) (*MacroeconomicResponse, error) { q := url.Values{} if startDate != nil { q.Set("start_time", *startDate+"T00:00:00Z") @@ -1674,7 +1674,7 @@ func (c *FundamentalContext) Macrodata( if limit != nil { q.Set("limit", fmt.Sprintf("%d", *limit)) } - var resp jsontypes.MacrodataResponse + var resp jsontypes.MacroeconomicResponse path := "/v1/quote/macrodata/" + indicatorCode if err := c.httpClient.Get(ctx, path, q, &resp); err != nil { return nil, err @@ -1683,8 +1683,8 @@ func (c *FundamentalContext) Macrodata( for _, d := range resp.Data { data = append(data, convertMacrodata(&d)) } - return &MacrodataResponse{ - Info: convertMacrodataIndicator(&resp.Info), + return &MacroeconomicResponse{ + Info: convertMacroeconomicIndicator(&resp.Info), Data: data, Count: resp.Count, }, nil @@ -1710,8 +1710,8 @@ func parseOptionalRFC3339(s string) *time.Time { return &t } -func convertMacrodataIndicator(j *jsontypes.MacrodataIndicator) MacrodataIndicator { - return MacrodataIndicator{ +func convertMacroeconomicIndicator(j *jsontypes.MacroeconomicIndicator) MacroeconomicIndicator { + return MacroeconomicIndicator{ IndicatorCode: j.IndicatorCode, SourceOrg: j.SourceOrg, Country: j.Country, @@ -1739,19 +1739,19 @@ func convertMacrodata(j *jsontypes.Macrodata) Macrodata { } } -func macrodataCountryToAPIValue(c MacrodataCountry) string { +func macrodataCountryToAPIValue(c MacroeconomicCountry) string { switch c { - case MacrodataCountryHK: + case MacroeconomicCountryHK: return "Hong Kong SAR China" - case MacrodataCountryCN: + case MacroeconomicCountryCN: return "China (Mainland)" - case MacrodataCountryUS: + case MacroeconomicCountryUS: return "United States" - case MacrodataCountryEU: + case MacroeconomicCountryEU: return "Euro Zone" - case MacrodataCountryJP: + case MacroeconomicCountryJP: return "Japan" - case MacrodataCountrySG: + case MacroeconomicCountrySG: return "Singapore" default: return string(c) diff --git a/fundamental/jsontypes/types.go b/fundamental/jsontypes/types.go index 4831847..d7c63f8 100644 --- a/fundamental/jsontypes/types.go +++ b/fundamental/jsontypes/types.go @@ -806,8 +806,8 @@ type MultiLanguageText struct { TraditionalChinese string `json:"traditional_chinese"` } -// MacrodataIndicator is the metadata for one macroeconomic indicator. -type MacrodataIndicator struct { +// MacroeconomicIndicator is the metadata for one macroeconomic indicator. +type MacroeconomicIndicator struct { IndicatorCode string `json:"indicator_code"` SourceOrg string `json:"source_org"` Country string `json:"country"` @@ -820,9 +820,9 @@ type MacrodataIndicator struct { StartDate string `json:"start_date"` } -// MacrodataIndicatorListResponse is the raw response for GET /v1/quote/macrodata. -type MacrodataIndicatorListResponse struct { - Data []MacrodataIndicator `json:"list"` +// MacroeconomicIndicatorListResponse is the raw response for GET /v1/quote/macrodata. +type MacroeconomicIndicatorListResponse struct { + Data []MacroeconomicIndicator `json:"list"` Count int32 `json:"count"` } @@ -840,10 +840,10 @@ type Macrodata struct { UnitPrefix MultiLanguageText `json:"unit_prefix"` } -// MacrodataResponse is the raw response for +// MacroeconomicResponse is the raw response for // GET /v1/quote/macrodata/{indicator_code}. -type MacrodataResponse struct { - Info MacrodataIndicator `json:"info"` +type MacroeconomicResponse struct { + Info MacroeconomicIndicator `json:"info"` Data []Macrodata `json:"data"` Count int32 `json:"count"` } diff --git a/fundamental/types.go b/fundamental/types.go index 10f46f8..9fc5a2d 100644 --- a/fundamental/types.go +++ b/fundamental/types.go @@ -1363,37 +1363,37 @@ type MultiLanguageText struct { TraditionalChinese string } -// MacrodataCountry is a country code for filtering macroeconomic indicators. -type MacrodataCountry string +// MacroeconomicCountry is a country code for filtering macroeconomic indicators. +type MacroeconomicCountry string const ( - MacrodataCountryHK MacrodataCountry = "HK" // Hong Kong SAR China - MacrodataCountryCN MacrodataCountry = "CN" // China (Mainland) - MacrodataCountryUS MacrodataCountry = "US" // United States - MacrodataCountryEU MacrodataCountry = "EU" // Euro Zone - MacrodataCountryJP MacrodataCountry = "JP" // Japan - MacrodataCountrySG MacrodataCountry = "SG" // Singapore + MacroeconomicCountryHK MacroeconomicCountry = "HK" // Hong Kong SAR China + MacroeconomicCountryCN MacroeconomicCountry = "CN" // China (Mainland) + MacroeconomicCountryUS MacroeconomicCountry = "US" // United States + MacroeconomicCountryEU MacroeconomicCountry = "EU" // Euro Zone + MacroeconomicCountryJP MacroeconomicCountry = "JP" // Japan + MacroeconomicCountrySG MacroeconomicCountry = "SG" // Singapore ) -// MacrodataImportance is the importance level of a macroeconomic indicator. -type MacrodataImportance int32 +// MacroeconomicImportance is the importance level of a macroeconomic indicator. +type MacroeconomicImportance int32 const ( - MacrodataImportanceLow MacrodataImportance = 1 - MacrodataImportanceMedium MacrodataImportance = 2 - MacrodataImportanceHigh MacrodataImportance = 3 + MacroeconomicImportanceLow MacroeconomicImportance = 1 + MacroeconomicImportanceMedium MacroeconomicImportance = 2 + MacroeconomicImportanceHigh MacroeconomicImportance = 3 ) -// MacrodataIndicatorListResponse is the response for FundamentalContext.MacrodataIndicators. -type MacrodataIndicatorListResponse struct { +// MacroeconomicIndicatorListResponse is the response for FundamentalContext.MacroeconomicIndicators. +type MacroeconomicIndicatorListResponse struct { // Data is the list of indicators. - Data []MacrodataIndicator + Data []MacroeconomicIndicator // Count is the total number of indicators matching the query. Count int32 } -// MacrodataIndicator is the metadata for one macroeconomic indicator. -type MacrodataIndicator struct { +// MacroeconomicIndicator is the metadata for one macroeconomic indicator. +type MacroeconomicIndicator struct { // IndicatorCode is the external vendor code (input to Macrodata). IndicatorCode string SourceOrg string @@ -1424,9 +1424,9 @@ type Macrodata struct { UnitPrefix MultiLanguageText } -// MacrodataResponse is the response for FundamentalContext.Macrodata. -type MacrodataResponse struct { - Info MacrodataIndicator +// MacroeconomicResponse is the response for FundamentalContext.Macrodata. +type MacroeconomicResponse struct { + Info MacroeconomicIndicator Data []Macrodata // Count is the total number of historical data points. Count int32 From 090f4b5ce553242e48a0a53d4b0bdb027267dbc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E7=AB=A0=E6=B4=AA?= Date: Thu, 11 Jun 2026 10:05:42 +0800 Subject: [PATCH 5/8] refactor: rename Macrodata (data point type) to Macroeconomic Co-Authored-By: Claude Sonnet 4.6 (1M context) --- fundamental/context.go | 12 ++++++------ fundamental/jsontypes/types.go | 6 +++--- fundamental/types.go | 10 +++++----- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/fundamental/context.go b/fundamental/context.go index 3ef1e16..1c29ac6 100644 --- a/fundamental/context.go +++ b/fundamental/context.go @@ -1612,7 +1612,7 @@ func convertFinancialReportSnapshot(j *jsontypes.FinancialReportSnapshot) *Finan } } -// ─── Macrodata ──────────────────────────────────────────────────── +// ─── Macroeconomic ──────────────────────────────────────────────────── // MacroeconomicIndicators fetches the list of available macroeconomic indicators. // @@ -1647,13 +1647,13 @@ func (c *FundamentalContext) MacroeconomicIndicators( return &MacroeconomicIndicatorListResponse{Data: out, Count: resp.Count}, nil } -// Macrodata fetches historical data for a specific macroeconomic indicator. +// Macroeconomic fetches historical data for a specific macroeconomic indicator. // // startDate and endDate are date strings in "YYYY-MM-DD" format. // startDate is sent as YYYY-MM-DDT00:00:00Z; endDate is sent as YYYY-MM-DDT23:59:59Z. // // Path: GET /v1/quote/macrodata/{indicator_code} -func (c *FundamentalContext) Macrodata( +func (c *FundamentalContext) Macroeconomic( ctx context.Context, indicatorCode string, startDate *string, @@ -1679,7 +1679,7 @@ func (c *FundamentalContext) Macrodata( if err := c.httpClient.Get(ctx, path, q, &resp); err != nil { return nil, err } - data := make([]Macrodata, 0, len(resp.Data)) + data := make([]Macroeconomic, 0, len(resp.Data)) for _, d := range resp.Data { data = append(data, convertMacrodata(&d)) } @@ -1725,8 +1725,8 @@ func convertMacroeconomicIndicator(j *jsontypes.MacroeconomicIndicator) Macroeco } } -func convertMacrodata(j *jsontypes.Macrodata) Macrodata { - return Macrodata{ +func convertMacrodata(j *jsontypes.Macroeconomic) Macroeconomic { + return Macroeconomic{ Period: j.Period, ReleaseAt: parseOptionalRFC3339(j.ReleaseAt), ActualValue: j.ActualValue, diff --git a/fundamental/jsontypes/types.go b/fundamental/jsontypes/types.go index d7c63f8..26aa33b 100644 --- a/fundamental/jsontypes/types.go +++ b/fundamental/jsontypes/types.go @@ -826,9 +826,9 @@ type MacroeconomicIndicatorListResponse struct { Count int32 `json:"count"` } -// Macrodata is one historical data point for a macroeconomic +// Macroeconomic is one historical data point for a macroeconomic // indicator. -type Macrodata struct { +type Macroeconomic struct { Period string `json:"period"` ReleaseAt string `json:"release_at"` ActualValue string `json:"actual_value"` @@ -844,6 +844,6 @@ type Macrodata struct { // GET /v1/quote/macrodata/{indicator_code}. type MacroeconomicResponse struct { Info MacroeconomicIndicator `json:"info"` - Data []Macrodata `json:"data"` + Data []Macroeconomic `json:"data"` Count int32 `json:"count"` } diff --git a/fundamental/types.go b/fundamental/types.go index 9fc5a2d..ef68789 100644 --- a/fundamental/types.go +++ b/fundamental/types.go @@ -1394,7 +1394,7 @@ type MacroeconomicIndicatorListResponse struct { // MacroeconomicIndicator is the metadata for one macroeconomic indicator. type MacroeconomicIndicator struct { - // IndicatorCode is the external vendor code (input to Macrodata). + // IndicatorCode is the external vendor code (input to Macroeconomic). IndicatorCode string SourceOrg string Country string @@ -1410,8 +1410,8 @@ type MacroeconomicIndicator struct { StartDate *time.Time } -// Macrodata is one historical data point for a macroeconomic indicator. -type Macrodata struct { +// Macroeconomic is one historical data point for a macroeconomic indicator. +type Macroeconomic struct { // Period is the statistical period (e.g. "2024-Q1", "2024-03"). Period string ReleaseAt *time.Time @@ -1424,10 +1424,10 @@ type Macrodata struct { UnitPrefix MultiLanguageText } -// MacroeconomicResponse is the response for FundamentalContext.Macrodata. +// MacroeconomicResponse is the response for FundamentalContext.Macroeconomic. type MacroeconomicResponse struct { Info MacroeconomicIndicator - Data []Macrodata + Data []Macroeconomic // Count is the total number of historical data points. Count int32 } From c2a97c9090995481bc92431277faf2912b08fe14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E7=AB=A0=E6=B4=AA?= Date: Thu, 11 Jun 2026 10:07:40 +0800 Subject: [PATCH 6/8] refactor: rename macrodataCountryToAPIValue to macroeconomicCountryToAPIValue Co-Authored-By: Claude Sonnet 4.6 (1M context) --- fundamental/context.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fundamental/context.go b/fundamental/context.go index 1c29ac6..e200a71 100644 --- a/fundamental/context.go +++ b/fundamental/context.go @@ -1628,7 +1628,7 @@ func (c *FundamentalContext) MacroeconomicIndicators( ) (*MacroeconomicIndicatorListResponse, error) { q := url.Values{} if country != nil { - q.Set("country", macrodataCountryToAPIValue(*country)) + q.Set("country", macroeconomicCountryToAPIValue(*country)) } if offset != nil { q.Set("offset", fmt.Sprintf("%d", *offset)) @@ -1739,7 +1739,7 @@ func convertMacrodata(j *jsontypes.Macroeconomic) Macroeconomic { } } -func macrodataCountryToAPIValue(c MacroeconomicCountry) string { +func macroeconomicCountryToAPIValue(c MacroeconomicCountry) string { switch c { case MacroeconomicCountryHK: return "Hong Kong SAR China" From 9b6c28996fcdd34ed5b19930eb4246103b190b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E7=AB=A0=E6=B4=AA?= Date: Thu, 11 Jun 2026 10:09:51 +0800 Subject: [PATCH 7/8] refactor: rename all remaining macrodata -> macroeconomic Co-Authored-By: Claude Sonnet 4.6 (1M context) --- fundamental/context.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fundamental/context.go b/fundamental/context.go index e200a71..9373da2 100644 --- a/fundamental/context.go +++ b/fundamental/context.go @@ -1681,7 +1681,7 @@ func (c *FundamentalContext) Macroeconomic( } data := make([]Macroeconomic, 0, len(resp.Data)) for _, d := range resp.Data { - data = append(data, convertMacrodata(&d)) + data = append(data, convertMacroeconomic(&d)) } return &MacroeconomicResponse{ Info: convertMacroeconomicIndicator(&resp.Info), @@ -1725,7 +1725,7 @@ func convertMacroeconomicIndicator(j *jsontypes.MacroeconomicIndicator) Macroeco } } -func convertMacrodata(j *jsontypes.Macroeconomic) Macroeconomic { +func convertMacroeconomic(j *jsontypes.Macroeconomic) Macroeconomic { return Macroeconomic{ Period: j.Period, ReleaseAt: parseOptionalRFC3339(j.ReleaseAt), From 6d1f6009113983b1b5e28eabafd5e67a32d9bba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E7=AB=A0=E6=B4=AA?= Date: Thu, 11 Jun 2026 10:35:40 +0800 Subject: [PATCH 8/8] docs: update CHANGELOG with correct macroeconomic naming --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 85a88e7..5fa9287 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,9 +13,9 @@ - `QuoteContext.SymbolToCounterIds` — batch convert symbols to counter IDs via `POST /v1/quote/symbol-to-counter-ids` - `QuoteContext.ResolveCounterIds` — local-first counter ID resolution with batched remote fallback and automatic caching - `FundamentalContext.EtfAssetAllocation` — ETF asset allocation (holdings / regional / asset class / industry) via `GET /v1/quote/etf-asset-allocation` -- `FundamentalContext.MacrodataIndicators` — list macroeconomic indicators via `GET /v1/quote/macrodata` -- `FundamentalContext.Macrodata` — historical data for a specific indicator via `GET /v1/quote/macrodata/{indicator_code}`; `startDate` / `endDate` accept `"YYYY-MM-DD"` strings -- New types: `MultiLanguageText`, `MacrodataIndicator`, `Macrodata`, `MacrodataResponse` +- `FundamentalContext.MacroeconomicIndicators(country, offset, limit)` — list macroeconomic indicators via `GET /v1/quote/macrodata`; filter by `MacroeconomicCountry` (HK/CN/US/EU/JP/SG); response includes `Count` +- `FundamentalContext.Macroeconomic(indicatorCode, startDate, endDate, offset, limit)` — historical data for a specific indicator via `GET /v1/quote/macrodata/{indicator_code}`; `startDate` / `endDate` accept `"YYYY-MM-DD"` strings; response includes `Count` +- New types: `MultiLanguageText`, `MacroeconomicCountry`, `MacroeconomicImportance`, `MacroeconomicIndicator`, `MacroeconomicIndicatorListResponse`, `Macroeconomic`, `MacroeconomicResponse` ## [v0.24.2] - 2026-06-02