Repository navigation
feat(quote)!: make QuoteShort and AftermarketTrade fields optional - #384
Merged
Merged
Conversation
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change makes
QuoteShort.price,QuoteShort.change,QuoteShort.volume, andAftermarketTrade.tradeSizeoptional across the Rust, Python, and Go SDKs so that anullprovider value surfaces asNone/Option/pointer instead of a hard decode failure or a coerced default.Response models:
libfmpQuoteShortnow wrapsprice,change, andvolumeinOption, andAftermarketTrade.tradeSizeinOption, with arequired_optiondeserializer that still rejects a missing member while accepting an explicitnull. Volume and trade size re-encode through theintegral_f64::serialize_optioncodec.Optional[float]in both the constructors and the generated.pyistubs.QuoteShortandAftermarketTradestructs use*float64for the optional members and decode each through ajsontext.Valueshadow that distinguishes missing fromnull.Tests and fixtures:
nulltradeSize,change, andvolumerows, extending the synthetic aftermarket-trade fixture and the multiple-quote-short fixture withnullvalues.Some(..)/pointers and to guard forNonebefore dereferencing, and added aquoteShortMatcheshelper in the Go parity tests.BREAKING CHANGE: QuoteShort price, change and volume and AftermarketTrade.tradeSize are now optional (Option / pointer / Optional); callers must handle None.