Skip to content
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
1 change: 0 additions & 1 deletion massive/rest/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ def list_futures_schedules(
product_code_lt: Optional[str] = None,
product_code_lte: Optional[str] = None,
session_end_date: Optional[str] = None,
session_end_date_any_of: Optional[str] = None,
session_end_date_gt: Optional[str] = None,
session_end_date_gte: Optional[str] = None,
session_end_date_lt: Optional[str] = None,
Expand Down
24 changes: 15 additions & 9 deletions massive/rest/models/futures.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, List
from typing import Optional, List, Union
from ...modelclass import modelclass


Expand Down Expand Up @@ -150,6 +150,7 @@ class FuturesQuote:
bid_price: Optional[float] = None
bid_size: Optional[float] = None
bid_timestamp: Optional[int] = None
channel: Optional[int] = None
report_sequence: Optional[int] = None
sequence_number: Optional[int] = None

Expand All @@ -165,6 +166,7 @@ def from_dict(d):
bid_price=d.get("bid_price"),
bid_size=d.get("bid_size"),
bid_timestamp=d.get("bid_timestamp"),
channel=d.get("channel"),
report_sequence=d.get("report_sequence"),
sequence_number=d.get("sequence_number"),
)
Expand All @@ -180,6 +182,7 @@ class FuturesTrade:
ticker: Optional[str] = None
timestamp: Optional[int] = None
session_end_date: Optional[str] = None
channel: Optional[int] = None
price: Optional[float] = None
size: Optional[float] = None
report_sequence: Optional[int] = None
Expand All @@ -191,6 +194,7 @@ def from_dict(d):
ticker=d.get("ticker"),
timestamp=d.get("timestamp"),
session_end_date=d.get("session_end_date"),
channel=d.get("channel"),
price=d.get("price"),
size=d.get("size"),
report_sequence=d.get("report_sequence"),
Expand Down Expand Up @@ -248,13 +252,17 @@ def from_dict(d):
@modelclass
class FuturesSnapshotDetails:
open_interest: Optional[int] = None
settlement_date: Optional[int] = None
settlement_date: Optional[Union[str, int]] = None
ticker: Optional[str] = None
product_code: Optional[str] = None

@staticmethod
def from_dict(d):
return FuturesSnapshotDetails(
open_interest=d.get("open_interest"),
settlement_date=d.get("settlement_date"),
ticker=d.get("ticker"),
product_code=d.get("product_code"),
)


Expand Down Expand Up @@ -354,6 +362,7 @@ def from_dict(d):
class FuturesSnapshot:
ticker: Optional[str] = None
product_code: Optional[str] = None

details: Optional[FuturesSnapshotDetails] = None
last_minute: Optional[FuturesSnapshotMinute] = None
last_quote: Optional[FuturesSnapshotQuote] = None
Expand All @@ -362,14 +371,11 @@ class FuturesSnapshot:

@staticmethod
def from_dict(d):
details_dict = d.get("details") or {}
return FuturesSnapshot(
ticker=d.get("ticker"),
product_code=d.get("product_code"),
details=(
FuturesSnapshotDetails.from_dict(d.get("details", {}))
if d.get("details")
else None
),
ticker=d.get("ticker") or details_dict.get("ticker"),
product_code=d.get("product_code") or details_dict.get("product_code"),
details=FuturesSnapshotDetails.from_dict(details_dict),
last_minute=(
FuturesSnapshotMinute.from_dict(d.get("last_minute", {}))
if d.get("last_minute")
Expand Down
Loading