Skip to content

Commit 531f64b

Browse files
Add support for futures snapshot endpoint (#939)
1 parent 154061d commit 531f64b

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

polygon/rest/models/futures.py

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,21 @@ class FuturesSnapshotMinute:
265265
last_updated: Optional[int] = None
266266
low: Optional[float] = None
267267
open: Optional[float] = None
268+
timeframe: Optional[str] = None
268269
volume: Optional[float] = None
269270

271+
@staticmethod
272+
def from_dict(d):
273+
return FuturesSnapshotMinute(
274+
close=d.get("close"),
275+
high=d.get("high"),
276+
last_updated=d.get("last_updated"),
277+
low=d.get("low"),
278+
open=d.get("open"),
279+
timeframe=d.get("timeframe"),
280+
volume=d.get("volume"),
281+
)
282+
270283

271284
@modelclass
272285
class FuturesSnapshotQuote:
@@ -277,13 +290,37 @@ class FuturesSnapshotQuote:
277290
bid_size: Optional[int] = None
278291
bid_timestamp: Optional[int] = None
279292
last_updated: Optional[int] = None
293+
timeframe: Optional[str] = None
294+
295+
@staticmethod
296+
def from_dict(d):
297+
return FuturesSnapshotQuote(
298+
ask=d.get("ask"),
299+
ask_size=d.get("ask_size"),
300+
ask_timestamp=d.get("ask_timestamp"),
301+
bid=d.get("bid"),
302+
bid_size=d.get("bid_size"),
303+
bid_timestamp=d.get("bid_timestamp"),
304+
last_updated=d.get("last_updated"),
305+
timeframe=d.get("timeframe"),
306+
)
280307

281308

282309
@modelclass
283310
class FuturesSnapshotTrade:
284311
last_updated: Optional[int] = None
285312
price: Optional[float] = None
286313
size: Optional[int] = None
314+
timeframe: Optional[str] = None
315+
316+
@staticmethod
317+
def from_dict(d):
318+
return FuturesSnapshotTrade(
319+
last_updated=d.get("last_updated"),
320+
price=d.get("price"),
321+
size=d.get("size"),
322+
timeframe=d.get("timeframe"),
323+
)
287324

288325

289326
@modelclass
@@ -298,6 +335,20 @@ class FuturesSnapshotSession:
298335
settlement_price: Optional[float] = None
299336
volume: Optional[float] = None
300337

338+
@staticmethod
339+
def from_dict(d):
340+
return FuturesSnapshotSession(
341+
change=d.get("change"),
342+
change_percent=d.get("change_percent"),
343+
close=d.get("close"),
344+
high=d.get("high"),
345+
low=d.get("low"),
346+
open=d.get("open"),
347+
previous_settlement=d.get("previous_settlement"),
348+
settlement_price=d.get("settlement_price"),
349+
volume=d.get("volume"),
350+
)
351+
301352

302353
@modelclass
303354
class FuturesSnapshot:

0 commit comments

Comments
 (0)