Repository navigation
feat(statements)!: make pre-IPO stub-quarter statement amounts optional - #386
Merged
Merged
Conversation
Make 57 BalanceSheetStatement and CashFlowStatement amounts optional so pre-IPO stub quarters that FMP sends as null decode cleanly instead of being rejected. Amounts that appear only on those stub rows now decode as None and re-encode as null, while amounts outside that set still reject a null value. **Response models (libfmp):** * Wrap the 38 balance-sheet and 19 cash-flow stub-quarter amounts in `Option<StatementAmount>`, deserializing through a `required_option` helper and serializing via `integral_f64::serialize_option`. * Add response tests covering the full stub-null member sets, decoding to `None`, re-encoding to null, and rejecting null on non-stub amounts. **Python bindings (fmp-py):** * Change the corresponding `#[pyo3(get)]` fields and constructor parameters to `Option<f64>` and regenerate the `.pyi` stubs as `typing.Optional[builtins.float]`. **Go SDK:** * Switch the affected model fields to `*float64`, decode each through a `jsontext.Value` shadow member, and treat a JSON null as nil. **Tests:** * Update balance and cash-flow assertions to `Some(...)` / pointer form and add stub-quarter null decode/re-encode coverage across crates. BREAKING CHANGE: 57 BalanceSheetStatement and CashFlowStatement amounts are now optional (Option / pointer / Optional); callers must handle None.
Add a test to the cash flow statement response suite that removes the `stockBasedCompensation` key from a historical record and asserts that deserialization fails with an error mentioning the missing field. This ensures required stub amount keys remain mandatory during parsing.
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.
FMP sends null for many balance-sheet and cash-flow amounts on pre-IPO stub quarters, which previously caused those records to be rejected during decoding. This change makes the affected amounts optional so those rows decode cleanly, while keeping the same amounts mandatory outside the stub set.
BREAKING CHANGE: 57 BalanceSheetStatement and CashFlowStatement amounts are now optional (Option / pointer / Optional); callers must handle the absent case.