Skip to content

feat(quote)!: make QuoteShort and AftermarketTrade fields optional - #384

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

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

Conversation

@benbenbang

Copy link
Copy Markdown
Member

This change makes QuoteShort.price, QuoteShort.change, QuoteShort.volume, and AftermarketTrade.tradeSize optional across the Rust, Python, and Go SDKs so that a null provider value surfaces as None/Option/pointer instead of a hard decode failure or a coerced default.

Response models:

  • libfmp QuoteShort now wraps price, change, and volume in Option, and AftermarketTrade.tradeSize in Option, with a required_option deserializer that still rejects a missing member while accepting an explicit null. Volume and trade size re-encode through the integral_f64::serialize_option codec.
  • The PyO3 bindings expose these members as Optional[float] in both the constructors and the generated .pyi stubs.
  • The Go QuoteShort and AftermarketTrade structs use *float64 for the optional members and decode each through a jsontext.Value shadow that distinguishes missing from null.

Tests and fixtures:

  • Added coverage for null tradeSize, change, and volume rows, extending the synthetic aftermarket-trade fixture and the multiple-quote-short fixture with null values.
  • Updated Rust, Python, and Go assertions to compare against Some(..)/pointers and to guard for None before dereferencing, and added a quoteShortMatches helper in the Go parity tests.
  • Reworked the Go and proxy examples to handle a nil price, change, or volume before printing.

BREAKING CHANGE: QuoteShort price, change and volume and AftermarketTrade.tradeSize are now optional (Option / pointer / Optional); callers must handle None.

This change makes `QuoteShort.price`, `QuoteShort.change`, `QuoteShort.volume`, and `AftermarketTrade.tradeSize` optional across the Rust, Python, and Go SDKs so that a `null` provider value surfaces as `None`/`Option`/pointer instead of a hard decode failure or a coerced default.

**Response models:**
* `libfmp` `QuoteShort` now wraps `price`, `change`, and `volume` in `Option`, and `AftermarketTrade.tradeSize` in `Option`, with a `required_option` deserializer that still rejects a missing member while accepting an explicit `null`. Volume and trade size re-encode through the `integral_f64::serialize_option` codec.
* The PyO3 bindings expose these members as `Optional[float]` in both the constructors and the generated `.pyi` stubs.
* The Go `QuoteShort` and `AftermarketTrade` structs use `*float64` for the optional members and decode each through a `jsontext.Value` shadow that distinguishes missing from `null`.

**Tests and fixtures:**
* Added coverage for `null` `tradeSize`, `change`, and `volume` rows, extending the synthetic aftermarket-trade fixture and the multiple-quote-short fixture with `null` values.
* Updated Rust, Python, and Go assertions to compare against `Some(..)`/pointers and to guard for `None` before dereferencing, and added a `quoteShortMatches` helper in the Go parity tests.
* Reworked the Go and proxy examples to handle a nil price, change, or volume before printing.

BREAKING CHANGE: QuoteShort price, change and volume and AftermarketTrade.tradeSize are now optional (Option / pointer / Optional); callers must handle None.
@benbenbang
benbenbang enabled auto-merge (rebase) September 30, 2026 12:48
@github-actions github-actions Bot added the enhancement New feature or request label Sep 30, 2026
@benbenbang
benbenbang merged commit 716455c into main Sep 30, 2026
9 checks passed
@benbenbang
benbenbang deleted the feat/368-quote-nullable branch September 30, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant