Skip to content

Sync with latest futures spec #897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 8 additions & 12 deletions polygon/rest/models/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class FuturesAgg:
"""

ticker: Optional[str] = None
underlying_asset: Optional[str] = None
open: Optional[float] = None
high: Optional[float] = None
low: Optional[float] = None
Expand All @@ -26,7 +25,6 @@ class FuturesAgg:
def from_dict(d):
return FuturesAgg(
ticker=d.get("ticker"),
underlying_asset=d.get("underlying_asset"),
open=d.get("open"),
high=d.get("high"),
low=d.get("low"),
Expand All @@ -49,7 +47,7 @@ class FuturesContract:

ticker: Optional[str] = None
product_code: Optional[str] = None
market_identifier_code: Optional[str] = None
trading_venue: Optional[str] = None
name: Optional[str] = None
type: Optional[str] = None
as_of: Optional[str] = None
Expand All @@ -70,7 +68,7 @@ def from_dict(d):
return FuturesContract(
ticker=d.get("ticker"),
product_code=d.get("product_code"),
market_identifier_code=d.get("market_identifier_code"),
trading_venue=d.get("trading_venue"),
name=d.get("name"),
type=d.get("type"),
as_of=d.get("as_of"),
Expand Down Expand Up @@ -98,15 +96,14 @@ class FuturesProduct:
product_code: Optional[str] = None
name: Optional[str] = None
as_of: Optional[str] = None
market_identifier_code: Optional[str] = None
trading_venue: Optional[str] = None
asset_class: Optional[str] = None
asset_sub_class: Optional[str] = None
clearing_channel: Optional[str] = None
sector: Optional[str] = None
sub_sector: Optional[str] = None
type: Optional[str] = None
last_updated: Optional[str] = None
otc_eligible: Optional[bool] = None
price_quotation: Optional[str] = None
settlement_currency_code: Optional[str] = None
settlement_method: Optional[str] = None
Expand All @@ -121,15 +118,14 @@ def from_dict(d):
product_code=d.get("product_code"),
name=d.get("name"),
as_of=d.get("as_of"),
market_identifier_code=d.get("market_identifier_code"),
trading_venue=d.get("trading_venue"),
asset_class=d.get("asset_class"),
clearing_channel=d.get("clearing_channel"),
asset_sub_class=d.get("asset_sub_class"),
sector=d.get("sector"),
sub_sector=d.get("sub_sector"),
type=d.get("type"),
last_updated=d.get("last_updated"),
otc_eligible=d.get("otc_eligible"),
price_quotation=d.get("price_quotation"),
settlement_currency_code=d.get("settlement_currency_code"),
settlement_method=d.get("settlement_method"),
Expand Down Expand Up @@ -222,7 +218,7 @@ class FuturesSchedule:

session_end_date: Optional[str] = None
product_code: Optional[str] = None
market_identifier_code: Optional[str] = None
trading_venue: Optional[str] = None
product_name: Optional[str] = None
schedule: Optional[List[FuturesScheduleEvent]] = None

Expand All @@ -231,7 +227,7 @@ def from_dict(d):
return FuturesSchedule(
session_end_date=d.get("session_end_date"),
product_code=d.get("product_code"),
market_identifier_code=d.get("market_identifier_code"),
trading_venue=d.get("trading_venue"),
product_name=d.get("product_name"),
schedule=[
FuturesScheduleEvent.from_dict(ev) for ev in d.get("schedule", [])
Expand All @@ -241,7 +237,7 @@ def from_dict(d):

@modelclass
class FuturesMarketStatus:
market_identifier_code: Optional[str] = None
trading_venue: Optional[str] = None
market_status: Optional[str] = (
None # Enum: pre_open, open, close, pause, post_close_pre_open
)
Expand All @@ -250,7 +246,7 @@ class FuturesMarketStatus:
@staticmethod
def from_dict(d):
return FuturesMarketStatus(
market_identifier_code=d.get("market_identifier_code"),
trading_venue=d.get("trading_venue"),
market_status=d.get("market_status"),
product_code=d.get("product_code"),
)
Expand Down
2 changes: 0 additions & 2 deletions polygon/websocket/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,6 @@ class FuturesAgg:
high: Optional[float] = None
low: Optional[float] = None
transaction_count: Optional[int] = None
underlying_asset: Optional[str] = None
start_timestamp: Optional[int] = None
end_timestamp: Optional[int] = None

Expand All @@ -434,7 +433,6 @@ def from_dict(d):
high=d.get("h"),
low=d.get("l"),
transaction_count=d.get("n"),
underlying_asset=d.get("p"),
start_timestamp=d.get("s"),
end_timestamp=d.get("e"),
)
Expand Down