1
1
from typing import Optional , List
2
2
from ...modelclass import modelclass
3
3
4
+
4
5
@modelclass
5
6
class MarketExchanges :
6
7
"Contains exchange market status data."
7
8
nasdaq : Optional [str ] = None
8
9
nyse : Optional [str ] = None
9
10
otc : Optional [str ] = None
10
11
12
+
11
13
@modelclass
12
14
class FuturesAggregate :
13
15
"""Represents an aggregate for a futures contract."""
16
+
14
17
close : Optional [float ] = None
15
18
dollar_volume : Optional [float ] = None
16
19
high : Optional [float ] = None
@@ -25,11 +28,15 @@ class FuturesAggregate:
25
28
26
29
@staticmethod
27
30
def from_dict (d ):
28
- return FuturesAggregate (** {k : v for k , v in d .items () if k in FuturesAggregate .__annotations__ })
31
+ return FuturesAggregate (
32
+ ** {k : v for k , v in d .items () if k in FuturesAggregate .__annotations__ }
33
+ )
34
+
29
35
30
36
@modelclass
31
37
class FuturesContract :
32
38
"""Represents a futures contract."""
39
+
33
40
active : Optional [bool ] = None
34
41
as_of : Optional [str ] = None
35
42
days_to_maturity : Optional [int ] = None
@@ -49,22 +56,30 @@ class FuturesContract:
49
56
50
57
@staticmethod
51
58
def from_dict (d ):
52
- return FuturesContract (** {k : v for k , v in d .items () if k in FuturesContract .__annotations__ })
59
+ return FuturesContract (
60
+ ** {k : v for k , v in d .items () if k in FuturesContract .__annotations__ }
61
+ )
62
+
53
63
54
64
@modelclass
55
65
class FuturesMarketStatus :
56
66
"""Represents the market status for a futures product."""
67
+
57
68
exchange_code : Optional [str ] = None
58
69
market_status : Optional [str ] = None
59
70
product_code : Optional [str ] = None
60
71
61
72
@staticmethod
62
73
def from_dict (d ):
63
- return FuturesMarketStatus (** {k : v for k , v in d .items () if k in FuturesMarketStatus .__annotations__ })
74
+ return FuturesMarketStatus (
75
+ ** {k : v for k , v in d .items () if k in FuturesMarketStatus .__annotations__ }
76
+ )
77
+
64
78
65
79
@modelclass
66
80
class FuturesProduct :
67
81
"""Represents a futures product."""
82
+
68
83
as_of : Optional [str ] = None
69
84
asset_class : Optional [str ] = None
70
85
asset_sub_class : Optional [str ] = None
@@ -86,21 +101,29 @@ class FuturesProduct:
86
101
87
102
@staticmethod
88
103
def from_dict (d ):
89
- return FuturesProduct (** {k : v for k , v in d .items () if k in FuturesProduct .__annotations__ })
104
+ return FuturesProduct (
105
+ ** {k : v for k , v in d .items () if k in FuturesProduct .__annotations__ }
106
+ )
107
+
90
108
91
109
@modelclass
92
110
class FuturesScheduleEvent :
93
111
"""Represents a single event in a futures schedule."""
112
+
94
113
event : Optional [str ] = None
95
114
timestamp : Optional [str ] = None
96
115
97
116
@staticmethod
98
117
def from_dict (d ):
99
- return FuturesScheduleEvent (** {k : v for k , v in d .items () if k in FuturesScheduleEvent .__annotations__ })
118
+ return FuturesScheduleEvent (
119
+ ** {k : v for k , v in d .items () if k in FuturesScheduleEvent .__annotations__ }
120
+ )
121
+
100
122
101
123
@modelclass
102
124
class FuturesSchedule :
103
125
"""Represents a futures trading schedule."""
126
+
104
127
market_identifier_code : Optional [str ] = None
105
128
product_code : Optional [str ] = None
106
129
product_name : Optional [str ] = None
@@ -109,7 +132,11 @@ class FuturesSchedule:
109
132
110
133
@staticmethod
111
134
def from_dict (d ):
112
- schedule = [FuturesScheduleEvent .from_dict (e ) for e in d .get ("schedule" , [])] if d .get ("schedule" ) else None
135
+ schedule = (
136
+ [FuturesScheduleEvent .from_dict (e ) for e in d .get ("schedule" , [])]
137
+ if d .get ("schedule" )
138
+ else None
139
+ )
113
140
return FuturesSchedule (
114
141
market_identifier_code = d .get ("market_identifier_code" ),
115
142
product_code = d .get ("product_code" ),
@@ -118,9 +145,11 @@ def from_dict(d):
118
145
session_end_date = d .get ("session_end_date" ),
119
146
)
120
147
148
+
121
149
@modelclass
122
150
class FuturesQuote :
123
151
"""Represents a quote for a futures contract."""
152
+
124
153
ask_price : Optional [float ] = None
125
154
ask_size : Optional [float ] = None
126
155
ask_timestamp : Optional [int ] = None
@@ -133,11 +162,15 @@ class FuturesQuote:
133
162
134
163
@staticmethod
135
164
def from_dict (d ):
136
- return FuturesQuote (** {k : v for k , v in d .items () if k in FuturesQuote .__annotations__ })
165
+ return FuturesQuote (
166
+ ** {k : v for k , v in d .items () if k in FuturesQuote .__annotations__ }
167
+ )
168
+
137
169
138
170
@modelclass
139
171
class FuturesTrade :
140
172
"""Represents a trade for a futures contract."""
173
+
141
174
price : Optional [float ] = None
142
175
session_start_date : Optional [str ] = None
143
176
size : Optional [float ] = None
@@ -146,4 +179,6 @@ class FuturesTrade:
146
179
147
180
@staticmethod
148
181
def from_dict (d ):
149
- return FuturesTrade (** {k : v for k , v in d .items () if k in FuturesTrade .__annotations__ })
182
+ return FuturesTrade (
183
+ ** {k : v for k , v in d .items () if k in FuturesTrade .__annotations__ }
184
+ )
0 commit comments