Repository navigation
[bot] Add binary option fields to OptionsContract - #1062
Merged
Merged
Conversation
justinpolygon
requested review from
jbonzo,
kschoche,
lukeoleson,
mmoghaddam385 and
suever
as code owners
December 4, 2026 01:18
lukeoleson
approved these changes
Dec 4, 2026
justinpolygon
added a commit
that referenced
this pull request
Dec 4, 2026
Adds response fields that the REST and WebSocket specs define but the
models dropped. A full audit of the library against both specs found
them.
**REST**
- `Agg.fractional_volume` (from `dv`, string), used for the snapshot
`day` and `prevDay` bars. The API sends this field, for example on
`get_snapshot_all("stocks", ...)`. The name matches
`MinuteSnapshot.fractional_volume`.
- `FuturesContract`: `provider_id`, `provider_product_id`
- `FuturesProduct`: `clearing_symbol`, `clearing_venue`, `provider_id`,
`strategy_type`
- `OptionContractSnapshot.fmv_last_updated` and
`UniversalSnapshot.fmv_last_updated` (int, ns)
- `Trade.received_timestamp` (int, ns; crypto trades)
**WebSocket**
- `EquityTrade.participant_timestamp` and
`EquityQuote.participant_timestamp` (from `pt`)
Additive only: new fields go at the end of each model, and method
signatures are unchanged. The options contract binary fields are in
#1062.
**Testing**
- `make lint` and `make test` pass.
- Rerunning the spec audits (REST endpoints and all 38 WebSocket
channels) shows no dropped fields left outside #1062.
- A live A/B against `master` on 42 core workflows: every existing value
is identical, and the only differences are the new fields. `dv` comes
through live as `day.fractional_volume`.
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.
Adds the binary option fields from the OpenAPI spec to
OptionsContract, whichget_options_contractandlist_options_contractsreturn. Before this change the client dropped them.Fields added (from the production spec, same on both endpoints):
type: Optional[str]:standardorbinary. Can be missing, for example on older contracts.underlying_type: Optional[str]:kpi,equityorindexcompany_ticker: Optional[str]metric: Optional[str]reporting_period: Optional[str]report_time: Optional[str](AMorPM)scale: Optional[int]The new fields are appended after the existing ones, so positional construction of
OptionsContractis unchanged.Existing mismatches fixed:
correctionwas annotatedOptional[str], but the spec saysinteger. Changed toOptional[int]. This only changes the type hint: the value is passed through unchanged.from_dictpassedsize=, which isn't a model field or a spec property.@modelclasssilently drops unknown kwargs, so it was dead code. Removed it, along with the matchingsize=Nonein the tests.No server-side
typefilter: the spec has notypeorunderlying_typequery parameter on/v3/reference/options/contracts, and the live API ignorestype=binary(it returns the same contracts as an unfiltered request). So this PR adds no filter kwargs. To get only binaries, filter on the client:Testing:
O:KAAPL270205C00001200O:B1VDA261120C00160000(withas_of=2026-11-19)Noneon a standard contract. All 3 fail against the previous model.make lintandmake testpass (56 REST, 14 WebSocket).O:KAAPL270205C00001200: every new field is populated (binary,kpi,AAPL,Earnings Per Share ($/share),2027Q1,PM,1).O:B1VDA261120C00160000withas_of=2026-11-19:type=binaryandunderlying_type=equity, with the KPI-only fieldsNone.O:SPY261218C00600000: the API doesn't sendtype, so it'sNone.list_options_contracts(underlying_ticker="KAAPL"): returns the fields.