Skip to content

feat(economics): make treasury tenors and calendar figures optional - #385

Merged
benbenbang merged 1 commit into
mainfrom
feat/368-econ-nullable
Sep 30, 2026
Merged

benbenbang merged 1 commit into
mainfrom
feat/368-econ-nullable

Conversation

@benbenbang

Copy link
Copy Markdown
Member

The live economics endpoints return null for treasury rate tenors,
indicator values, and several calendar figures on upcoming or partial
releases (issue #368). Decoding these rows previously failed the whole
call because the members were required numeric types.

Response model changes:

  • Made all twelve TreasuryRate tenors, EconomicIndicatorObservation.value, and the previous, estimate, actual, change, changePercentage, and unit members of EconomicCalendarEvent optional across Rust, Go, and Python.
  • Added a required_option deserializer in the Rust responses so a null decodes to None while a missing key still fails.
  • Reworked the Go shadow decoders to use jsontext.Value so a present-but-null member is distinguished from an absent one and mapped to a nil pointer.

Tests and docs:

  • Updated fixtures and parity tests to assert null tenors, values, and calendar figures decode as None/nil, and extended the contract checks to accept null only for the newly optional members.
  • Documented the null-figure ambiguity for the economics calendar, treasury tenors, and indicator value in the contract-ambiguities table.

BREAKING CHANGE: TreasuryRate tenors, EconomicIndicatorObservation.value
and six EconomicCalendarEvent members are now optional (Option / pointer
/ Optional); handle None.

Refs: #368

The live economics endpoints return `null` for treasury rate tenors,
indicator values, and several calendar figures on upcoming or partial
releases (issue #368). Decoding these rows previously failed the whole
call because the members were required numeric types.

**Response model changes:**
* Made all twelve `TreasuryRate` tenors, `EconomicIndicatorObservation.value`, and the `previous`, `estimate`, `actual`, `change`, `changePercentage`, and `unit` members of `EconomicCalendarEvent` optional across Rust, Go, and Python.
* Added a `required_option` deserializer in the Rust responses so a `null` decodes to `None` while a missing key still fails.
* Reworked the Go shadow decoders to use `jsontext.Value` so a present-but-null member is distinguished from an absent one and mapped to a nil pointer.

**Tests and docs:**
* Updated fixtures and parity tests to assert null tenors, values, and calendar figures decode as `None`/`nil`, and extended the contract checks to accept null only for the newly optional members.
* Documented the null-figure ambiguity for the economics calendar, treasury tenors, and indicator value in the contract-ambiguities table.

BREAKING CHANGE: TreasuryRate tenors, EconomicIndicatorObservation.value
and six EconomicCalendarEvent members are now optional (Option / pointer
/ Optional); handle None.

Refs: #368
@benbenbang
benbenbang enabled auto-merge (rebase) September 30, 2026 12:52
@github-actions github-actions Bot added documentation Improvements or additions to documentation enhancement New feature or request labels Sep 30, 2026
@benbenbang
benbenbang merged commit b3a7969 into main Sep 30, 2026
9 checks passed
@benbenbang
benbenbang deleted the feat/368-econ-nullable branch September 30, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant