itmatrix 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- itmatrix/__init__.py +53 -0
- itmatrix/_core/__init__.py +9 -0
- itmatrix/_core/_wire/__init__.py +1 -0
- itmatrix/_core/_wire/rest_pb2.py +65 -0
- itmatrix/_core/_wire/ws_pb2.py +63 -0
- itmatrix/_core/client.py +587 -0
- itmatrix/_core/config.py +9 -0
- itmatrix/_core/errors.py +31 -0
- itmatrix/_core/models.py +180 -0
- itmatrix/_core/resources.py +633 -0
- itmatrix/_core/stream.py +431 -0
- itmatrix/analytics.py +88 -0
- itmatrix/client.py +485 -0
- itmatrix/models.py +430 -0
- itmatrix/options.py +78 -0
- itmatrix/periods.py +80 -0
- itmatrix/py.typed +0 -0
- itmatrix-1.0.0.dist-info/METADATA +228 -0
- itmatrix-1.0.0.dist-info/RECORD +21 -0
- itmatrix-1.0.0.dist-info/WHEEL +4 -0
- itmatrix-1.0.0.dist-info/licenses/LICENSE +21 -0
itmatrix/_core/models.py
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"""Small, hand-owned public types."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Awaitable, Callable, Mapping, Sequence
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from datetime import date, datetime
|
|
8
|
+
from typing import Any, Generic, Literal, TypeVar
|
|
9
|
+
|
|
10
|
+
from typing_extensions import NotRequired, TypedDict
|
|
11
|
+
|
|
12
|
+
T = TypeVar("T")
|
|
13
|
+
Transport = Literal["json", "protobuf"]
|
|
14
|
+
Credential = str | Callable[[], str | Awaitable[str]]
|
|
15
|
+
QueryValue = str | int | float | bool | date | datetime | Sequence[str] | None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class OffExchangeActivityRow(TypedDict):
|
|
19
|
+
date: str
|
|
20
|
+
off_exch_volume: float
|
|
21
|
+
notional: float
|
|
22
|
+
trade_count: int
|
|
23
|
+
avg_size: float
|
|
24
|
+
vwap: float
|
|
25
|
+
off_exch_pct: float | None
|
|
26
|
+
consolidated_volume: float | None
|
|
27
|
+
consolidated_notional: float | None
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class OffExchangeConcentrationRow(TypedDict):
|
|
31
|
+
date: str
|
|
32
|
+
bucket_midpoint: float
|
|
33
|
+
bucket_width: float
|
|
34
|
+
volume: float
|
|
35
|
+
notional: float
|
|
36
|
+
trade_count: int
|
|
37
|
+
distinct_sessions: int
|
|
38
|
+
rank_score: float
|
|
39
|
+
rank: int
|
|
40
|
+
bucket_count: int
|
|
41
|
+
distance_bps: float | None
|
|
42
|
+
lookback_sessions: int
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class OffExchangeProfileRow(TypedDict):
|
|
46
|
+
date: str
|
|
47
|
+
price_thousandths: int
|
|
48
|
+
volume: float
|
|
49
|
+
notional: float
|
|
50
|
+
trade_count: int
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class OffExchangeCompositionRow(TypedDict):
|
|
54
|
+
date: str
|
|
55
|
+
category: str
|
|
56
|
+
volume: float
|
|
57
|
+
notional: float
|
|
58
|
+
trade_count: int
|
|
59
|
+
share_of_off_exch_notional: float
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class PremiumBucket(TypedDict):
|
|
63
|
+
session_date: str
|
|
64
|
+
ts_ms: int
|
|
65
|
+
call_premium_usd: float
|
|
66
|
+
put_premium_usd: float
|
|
67
|
+
call_prints: int
|
|
68
|
+
put_prints: int
|
|
69
|
+
call_contracts: int
|
|
70
|
+
put_contracts: int
|
|
71
|
+
call_ask_premium_usd: NotRequired[float | None]
|
|
72
|
+
call_bid_premium_usd: NotRequired[float | None]
|
|
73
|
+
put_ask_premium_usd: NotRequired[float | None]
|
|
74
|
+
put_bid_premium_usd: NotRequired[float | None]
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class PremiumData(TypedDict):
|
|
78
|
+
symbol: str
|
|
79
|
+
bucket_ms: int
|
|
80
|
+
sessions: list[str]
|
|
81
|
+
buckets: list[PremiumBucket]
|
|
82
|
+
coverage_status: str
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class GexHistoryStrike(TypedDict):
|
|
86
|
+
"""One history row. GEX values are dollars of dealer hedging per $1 move;
|
|
87
|
+
each ``*_shares`` field is its dollar sibling in shares of the underlying,
|
|
88
|
+
``None`` when unknown."""
|
|
89
|
+
|
|
90
|
+
strike: int
|
|
91
|
+
gex: float
|
|
92
|
+
gex_shares: float | None
|
|
93
|
+
gex_0dte: NotRequired[float | None]
|
|
94
|
+
gex_0dte_shares: NotRequired[float | None]
|
|
95
|
+
call_oi: NotRequired[int | None]
|
|
96
|
+
put_oi: NotRequired[int | None]
|
|
97
|
+
delta_adj: float | None
|
|
98
|
+
delta_adj_shares: float | None
|
|
99
|
+
expiry: NotRequired[str | None]
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class GexHistoryCapture(TypedDict):
|
|
103
|
+
captured_at: int
|
|
104
|
+
spot: float | None
|
|
105
|
+
prior_close_spot: float | None
|
|
106
|
+
net_gex: float
|
|
107
|
+
net_gex_shares: float | None
|
|
108
|
+
flip_point: float | None
|
|
109
|
+
strikes: list[GexHistoryStrike]
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class GexHistoryData(TypedDict):
|
|
113
|
+
symbol: str
|
|
114
|
+
session_date: str
|
|
115
|
+
captures: list[GexHistoryCapture]
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class GexReferenceStrike(TypedDict):
|
|
119
|
+
"""One reference row; ``gex_shares`` is ``gex`` divided by the book's spot."""
|
|
120
|
+
|
|
121
|
+
strike: int
|
|
122
|
+
gex: float
|
|
123
|
+
gex_shares: float
|
|
124
|
+
gex_0dte: NotRequired[float | None]
|
|
125
|
+
gex_0dte_shares: NotRequired[float | None]
|
|
126
|
+
call_oi: NotRequired[int | None]
|
|
127
|
+
put_oi: NotRequired[int | None]
|
|
128
|
+
delta_adj: NotRequired[float | None]
|
|
129
|
+
delta_adj_shares: NotRequired[float | None]
|
|
130
|
+
expiry: NotRequired[str | None]
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
class GexReferenceData(TypedDict):
|
|
134
|
+
symbol: str
|
|
135
|
+
basis: Literal["open", "prev_close"]
|
|
136
|
+
session_date: str
|
|
137
|
+
reference_session_date: str
|
|
138
|
+
captured_at: int | None
|
|
139
|
+
spot: float | None
|
|
140
|
+
net_gex: float | None
|
|
141
|
+
complete: bool | None
|
|
142
|
+
contract_count: int | None
|
|
143
|
+
gamma_absent: int | None
|
|
144
|
+
strikes: list[GexReferenceStrike]
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class Quote(TypedDict):
|
|
148
|
+
symbol: str
|
|
149
|
+
spot: float | None
|
|
150
|
+
change_pct: float | None
|
|
151
|
+
net_gex: float | None
|
|
152
|
+
gex_change: float | None
|
|
153
|
+
volume: int | None
|
|
154
|
+
official_close: float | None
|
|
155
|
+
session_date: str | None
|
|
156
|
+
event_ts_ms: int | None
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
SymbolIdentity = TypedDict(
|
|
160
|
+
"SymbolIdentity",
|
|
161
|
+
{
|
|
162
|
+
"valid": bool,
|
|
163
|
+
"symbol": str,
|
|
164
|
+
"instrument_type": str,
|
|
165
|
+
"name": NotRequired[str | None],
|
|
166
|
+
"class": NotRequired[str | None],
|
|
167
|
+
"instrument_type_source": NotRequired[str | None],
|
|
168
|
+
"instrument_type_as_of": NotRequired[str | None],
|
|
169
|
+
},
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
@dataclass(frozen=True, slots=True)
|
|
174
|
+
class Result(Generic[T]):
|
|
175
|
+
data: T
|
|
176
|
+
meta: Mapping[str, Any]
|
|
177
|
+
status: int
|
|
178
|
+
request_id: str | None = None
|
|
179
|
+
etag: str | None = None
|
|
180
|
+
not_modified: bool = False
|