deephaven-massive 0.1.0rc6__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.
- deephaven_massive/__init__.py +220 -0
- deephaven_massive/_config.py +2208 -0
- deephaven_massive/_dataset_list.py +367 -0
- deephaven_massive/_datasets/__init__.py +35 -0
- deephaven_massive/_datasets/argument_rules.py +145 -0
- deephaven_massive/_datasets/bar_periods.py +520 -0
- deephaven_massive/_datasets/catalog.py +1652 -0
- deephaven_massive/_datasets/column_descriptions.py +542 -0
- deephaven_massive/_datasets/column_reference.py +1390 -0
- deephaven_massive/_datasets/dates.py +972 -0
- deephaven_massive/_datasets/epoch.py +66 -0
- deephaven_massive/_datasets/feeds.py +117 -0
- deephaven_massive/_datasets/filters.py +543 -0
- deephaven_massive/_datasets/futures_sessions.py +237 -0
- deephaven_massive/_datasets/history_source.py +846 -0
- deephaven_massive/_datasets/readme_plans.py +342 -0
- deephaven_massive/_datasets/request.py +211 -0
- deephaven_massive/_datasets/row_times.py +1469 -0
- deephaven_massive/_datasets/schema.py +680 -0
- deephaven_massive/_datasets/source_columns.py +382 -0
- deephaven_massive/_datasets/symbols.py +1849 -0
- deephaven_massive/_datasets/timestamps.py +283 -0
- deephaven_massive/_datasets/trading_hours.py +100 -0
- deephaven_massive/_datasets/wire_symbols.py +341 -0
- deephaven_massive/_debug_log.py +464 -0
- deephaven_massive/_enums.py +722 -0
- deephaven_massive/_error_policy.py +477 -0
- deephaven_massive/_errors.py +917 -0
- deephaven_massive/_ingest/__init__.py +37 -0
- deephaven_massive/_ingest/clients.py +314 -0
- deephaven_massive/_ingest/crypto_tickers.py +377 -0
- deephaven_massive/_ingest/flatfiles.py +2202 -0
- deephaven_massive/_ingest/futures_calendar.py +1164 -0
- deephaven_massive/_ingest/history_reads.py +822 -0
- deephaven_massive/_ingest/host_decision.py +612 -0
- deephaven_massive/_ingest/option_roots.py +974 -0
- deephaven_massive/_ingest/rate_limits.py +799 -0
- deephaven_massive/_ingest/recency_labels.py +189 -0
- deephaven_massive/_ingest/refusal_search.py +380 -0
- deephaven_massive/_ingest/refused_venues.py +224 -0
- deephaven_massive/_ingest/rest.py +4409 -0
- deephaven_massive/_ingest/rest_refusals.py +325 -0
- deephaven_massive/_ingest/rest_requests.py +1030 -0
- deephaven_massive/_ingest/rest_rows.py +457 -0
- deephaven_massive/_ingest/shared_lookup.py +430 -0
- deephaven_massive/_ingest/static_reads.py +230 -0
- deephaven_massive/_ingest/stop_tokens.py +34 -0
- deephaven_massive/_ingest/subscriptions.py +965 -0
- deephaven_massive/_ingest/symbol_reads.py +1587 -0
- deephaven_massive/_ingest/ws.py +1438 -0
- deephaven_massive/_ingest/ws_connection.py +2508 -0
- deephaven_massive/_ingest/ws_silence.py +120 -0
- deephaven_massive/_log_limits.py +337 -0
- deephaven_massive/_massive/__init__.py +203 -0
- deephaven_massive/_massive/flatfiles/__init__.py +17 -0
- deephaven_massive/_massive/flatfiles/client.py +1144 -0
- deephaven_massive/_massive/flatfiles/object_keys.py +48 -0
- deephaven_massive/_massive/flatfiles/reader.py +1253 -0
- deephaven_massive/_massive/net/__init__.py +40 -0
- deephaven_massive/_massive/net/api_keys.py +83 -0
- deephaven_massive/_massive/net/base_urls.py +128 -0
- deephaven_massive/_massive/net/cancel.py +162 -0
- deephaven_massive/_massive/net/capture.py +230 -0
- deephaven_massive/_massive/net/codec.py +200 -0
- deephaven_massive/_massive/net/errors.py +387 -0
- deephaven_massive/_massive/net/http.py +480 -0
- deephaven_massive/_massive/net/origins.py +47 -0
- deephaven_massive/_massive/net/redaction.py +307 -0
- deephaven_massive/_massive/net/retry.py +242 -0
- deephaven_massive/_massive/net/slots.py +111 -0
- deephaven_massive/_massive/rest/__init__.py +42 -0
- deephaven_massive/_massive/rest/batch.py +568 -0
- deephaven_massive/_massive/rest/client.py +1064 -0
- deephaven_massive/_massive/rest/governor.py +1802 -0
- deephaven_massive/_massive/rest/query.py +143 -0
- deephaven_massive/_massive/rest/response.py +472 -0
- deephaven_massive/_massive/spec/__init__.py +267 -0
- deephaven_massive/_massive/spec/convert.py +1039 -0
- deephaven_massive/_massive/spec/descriptions.json +10260 -0
- deephaven_massive/_massive/spec/flatfiles.json +351 -0
- deephaven_massive/_massive/spec/generated_schemas.py +540 -0
- deephaven_massive/_massive/spec/rest.json +4527 -0
- deephaven_massive/_massive/spec/types.py +1107 -0
- deephaven_massive/_massive/spec/values.py +264 -0
- deephaven_massive/_massive/spec/ws.json +509 -0
- deephaven_massive/_massive/ws/__init__.py +20 -0
- deephaven_massive/_massive/ws/backoff.py +105 -0
- deephaven_massive/_massive/ws/client.py +776 -0
- deephaven_massive/_massive/ws/protocol.py +935 -0
- deephaven_massive/_on_error.py +60 -0
- deephaven_massive/_session.py +824 -0
- deephaven_massive/_snapshots.py +50 -0
- deephaven_massive/_tables/__init__.py +27 -0
- deephaven_massive/_tables/background_read.py +639 -0
- deephaven_massive/_tables/call_failure.py +95 -0
- deephaven_massive/_tables/cause_reference.py +73 -0
- deephaven_massive/_tables/columns.py +561 -0
- deephaven_massive/_tables/diagnostics.py +1582 -0
- deephaven_massive/_tables/execution_context.py +260 -0
- deephaven_massive/_tables/follow_coordinator.py +1777 -0
- deephaven_massive/_tables/followed_read.py +1118 -0
- deephaven_massive/_tables/futures_dates.py +142 -0
- deephaven_massive/_tables/futures_problems.py +122 -0
- deephaven_massive/_tables/held_rows.py +864 -0
- deephaven_massive/_tables/live_set.py +69 -0
- deephaven_massive/_tables/liveness.py +659 -0
- deephaven_massive/_tables/poll.py +2182 -0
- deephaven_massive/_tables/poll_symbols.py +406 -0
- deephaven_massive/_tables/problem_events.py +646 -0
- deephaven_massive/_tables/problem_ledger.py +528 -0
- deephaven_massive/_tables/problem_reporter.py +151 -0
- deephaven_massive/_tables/publisher.py +335 -0
- deephaven_massive/_tables/read_pool.py +161 -0
- deephaven_massive/_tables/read_tally.py +353 -0
- deephaven_massive/_tables/refused_values.py +263 -0
- deephaven_massive/_tables/row_memory.py +44 -0
- deephaven_massive/_tables/session_core.py +1017 -0
- deephaven_massive/_tables/shared_streams.py +860 -0
- deephaven_massive/_tables/stream.py +2636 -0
- deephaven_massive/_tables/stream_ids.py +36 -0
- deephaven_massive/_tables/symbol_read_rows.py +141 -0
- deephaven_massive/_tables/symbol_retry.py +292 -0
- deephaven_massive/_tables/symbol_spans.py +108 -0
- deephaven_massive/_tables/symbols.py +349 -0
- deephaven_massive/_tables/time_text.py +111 -0
- deephaven_massive/_tables/transports.py +845 -0
- deephaven_massive/_tables/watchlist.py +1136 -0
- deephaven_massive/_tables/withheld.py +614 -0
- deephaven_massive/_tables/worker_tables.py +467 -0
- deephaven_massive/namespaces/__init__.py +83 -0
- deephaven_massive/namespaces/_crypto.py +627 -0
- deephaven_massive/namespaces/_economy.py +432 -0
- deephaven_massive/namespaces/_forex.py +604 -0
- deephaven_massive/namespaces/_futures.py +879 -0
- deephaven_massive/namespaces/_indicators.py +602 -0
- deephaven_massive/namespaces/_indices.py +434 -0
- deephaven_massive/namespaces/_namespace.py +75 -0
- deephaven_massive/namespaces/_options.py +1655 -0
- deephaven_massive/namespaces/_partners.py +1502 -0
- deephaven_massive/namespaces/_query_building.py +1090 -0
- deephaven_massive/namespaces/_reference.py +794 -0
- deephaven_massive/namespaces/_stock_filings.py +1265 -0
- deephaven_massive/namespaces/_stock_financials.py +464 -0
- deephaven_massive/namespaces/_stocks.py +1301 -0
- deephaven_massive/py.typed +1 -0
- deephaven_massive/queries/__init__.py +71 -0
- deephaven_massive/queries/_call.py +292 -0
- deephaven_massive/queries/_choice.py +177 -0
- deephaven_massive/queries/_fetch.py +624 -0
- deephaven_massive/queries/_history.py +703 -0
- deephaven_massive/queries/_query.py +658 -0
- deephaven_massive/queries/_stream.py +492 -0
- deephaven_massive-0.1.0rc6.dist-info/METADATA +850 -0
- deephaven_massive-0.1.0rc6.dist-info/RECORD +156 -0
- deephaven_massive-0.1.0rc6.dist-info/WHEEL +4 -0
- deephaven_massive-0.1.0rc6.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
"""Market data from Massive as live and historical Deephaven tables, for traders and quants.
|
|
2
|
+
|
|
3
|
+
Testing a trading idea usually takes one program for history and another for the live feed.
|
|
4
|
+
Here, one query of a streaming dataset gives both, with the same columns.
|
|
5
|
+
|
|
6
|
+
Every dataset works the same way. Create a session, call a dataset method to get a query, and
|
|
7
|
+
call one of the query's methods to get a Deephaven table.
|
|
8
|
+
|
|
9
|
+
Example:
|
|
10
|
+
In the Deephaven console, with your API key in `MASSIVE_API_KEY`::
|
|
11
|
+
|
|
12
|
+
import deephaven_massive as dm
|
|
13
|
+
|
|
14
|
+
m = dm.MassiveSession()
|
|
15
|
+
|
|
16
|
+
# Apple's daily bars for one week.
|
|
17
|
+
apple = m.stocks.bars("AAPL", dm.Timespan.DAY).history("2026-10-26", "2026-10-30")
|
|
18
|
+
|
|
19
|
+
# Each stock's latest minute bar, kept live.
|
|
20
|
+
latest = m.stocks.bars(["AAPL", "MSFT"], dm.Timespan.MINUTE).last_by()
|
|
21
|
+
|
|
22
|
+
Datasets:
|
|
23
|
+
Each dataset is a method of a namespace on the session. The namespaces by asset class are
|
|
24
|
+
`m.stocks`, `m.options`, `m.futures`, `m.indices`, `m.forex`, and `m.crypto`. The ones by
|
|
25
|
+
topic are `m.reference`, `m.indicators`, `m.economy`, and `m.partners`. `m.snapshots()`
|
|
26
|
+
reads symbols of several asset classes at once. `dm.datasets()` lists every dataset in a
|
|
27
|
+
table, with each one's query methods in its `Methods` column.
|
|
28
|
+
|
|
29
|
+
To annotate your own code, import the class of a namespace, such as `StocksNamespace` for
|
|
30
|
+
`m.stocks`, from `deephaven_massive.namespaces`, and the class of a query, such as
|
|
31
|
+
`StreamHistoryQuery`, from `deephaven_massive.queries`. The types of the arguments,
|
|
32
|
+
`dm.SymbolsLike`, `dm.DateLike`, and `dm.FilterValue`, are here, and so is
|
|
33
|
+
`dm.AllSymbols`, the type of `dm.ALL`.
|
|
34
|
+
|
|
35
|
+
Query methods:
|
|
36
|
+
A query reads nothing until you call one of its methods. It has only the methods its
|
|
37
|
+
dataset supports:
|
|
38
|
+
|
|
39
|
+
- `history(start, end)`: a table of a past range.
|
|
40
|
+
- `fetch()`: a table of what Massive has now.
|
|
41
|
+
- `poll(interval)`: a live table that fetches again every `interval` seconds.
|
|
42
|
+
- `blink()`: a live table of a stream's rows from the latest update cycle.
|
|
43
|
+
- `append_only()`: a live table of every row a stream sends after the call.
|
|
44
|
+
- `ring(capacity)`: a live table of a stream's latest `capacity` rows.
|
|
45
|
+
- `last_by()`: a live table of each symbol's latest row from a stream.
|
|
46
|
+
|
|
47
|
+
`columns()` on any query lists its columns and what each one means.
|
|
48
|
+
|
|
49
|
+
A live table updates while anything uses it: a variable, a panel, or a table made from it.
|
|
50
|
+
`m.release(table)` drops your variable's hold at once. The table then stops when no panel
|
|
51
|
+
or table made from it is left. `m.close()` stops every live table of the session.
|
|
52
|
+
|
|
53
|
+
Settings:
|
|
54
|
+
`dm.MassiveConfig` holds a session's settings. Pass it as `dm.MassiveSession(config)`. Two
|
|
55
|
+
settings match a session to your plans:
|
|
56
|
+
|
|
57
|
+
- `delayed_subscriptions` lists the subscriptions whose data Massive serves you delayed.
|
|
58
|
+
Their streams use Massive's delayed feed, and their `fetch()` and `poll()` tables accept
|
|
59
|
+
delayed data.
|
|
60
|
+
- `rest_requests_per_minute` keeps a subscription's requests within the limit Massive
|
|
61
|
+
gives your plan from the first request.
|
|
62
|
+
|
|
63
|
+
`help(dm.MassiveConfig)` lists every setting. `dm.ErrorPolicy` decides what a bad symbol or
|
|
64
|
+
row does, for the session or for one call.
|
|
65
|
+
|
|
66
|
+
Symbols:
|
|
67
|
+
Datasets take Massive's tickers, spelled exactly: `AAPL`, `BRK.B`, `O:SPY271217C00700000`,
|
|
68
|
+
`I:SPX`, `C:EURUSD`, `X:BTCUSD`, and `ESZ6`. `dm.ALL` means every symbol, in the datasets
|
|
69
|
+
that take it. A table with a `Symbol` column works too. A live one is a watchlist, which
|
|
70
|
+
the library follows as you add and delete rows. `dm.canonical_symbol` and
|
|
71
|
+
`dm.canonicalize_symbols` convert other spellings, such as Yahoo's `BRK-B`.
|
|
72
|
+
|
|
73
|
+
Enums:
|
|
74
|
+
An argument with a fixed set of values takes an enum member, such as `dm.Timespan.MINUTE`.
|
|
75
|
+
`dm.Timespan("minute")` converts text to a member.
|
|
76
|
+
|
|
77
|
+
Errors:
|
|
78
|
+
`dm.MassiveError` covers every error Massive reports and every failure inside a method of
|
|
79
|
+
a query, such as `fetch()`. `dm.AuthenticationError` means your API key is missing or Massive
|
|
80
|
+
refused your keys. `dm.EntitlementError` means your plan doesn't include the data.
|
|
81
|
+
`dm.SessionClosedError` means the session is closed. Each error's `source` says what
|
|
82
|
+
stopped the call, as a `dm.ErrorSource`. Its `is_retryable` says whether the same call may
|
|
83
|
+
succeed later, and its `is_bug` whether a bug caused it.
|
|
84
|
+
A wrong argument raises `TypeError` or `ValueError` at the call instead.
|
|
85
|
+
`dm.enable_debug_logging()` records what the library does, for a bug report.
|
|
86
|
+
|
|
87
|
+
Server:
|
|
88
|
+
The library runs inside a Deephaven server: in its console, in an application script, or
|
|
89
|
+
in a Python program that starts one first. Importing the package without a running server
|
|
90
|
+
fails with Deephaven's own error. In a plain Python program, start the server before the
|
|
91
|
+
import::
|
|
92
|
+
|
|
93
|
+
from deephaven_server import Server
|
|
94
|
+
|
|
95
|
+
Server(port=10000, jvm_args=["-Xmx4g"]).start()
|
|
96
|
+
|
|
97
|
+
import deephaven_massive as dm
|
|
98
|
+
|
|
99
|
+
Next steps:
|
|
100
|
+
- The README and its tutorial: https://github.com/deephaven-examples/deephaven-massive
|
|
101
|
+
- Every dataset's arguments, plans, and columns:
|
|
102
|
+
https://github.com/deephaven-examples/deephaven-massive/blob/main/docs/datasets/README.md
|
|
103
|
+
- Error messages and their fixes:
|
|
104
|
+
https://github.com/deephaven-examples/deephaven-massive/blob/main/docs/troubleshooting.md
|
|
105
|
+
- `help()` on any object, such as `help(m.stocks.bars)`.
|
|
106
|
+
|
|
107
|
+
Attributes:
|
|
108
|
+
__version__: The installed version, such as `"0.1.0"`.
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
from importlib.metadata import version as _version
|
|
112
|
+
|
|
113
|
+
from deephaven_massive._config import MassiveConfig
|
|
114
|
+
from deephaven_massive._dataset_list import datasets
|
|
115
|
+
from deephaven_massive._datasets.dates import DateLike
|
|
116
|
+
from deephaven_massive._datasets.filters import FilterValue
|
|
117
|
+
from deephaven_massive._datasets.symbols import (
|
|
118
|
+
ALL,
|
|
119
|
+
AllSymbols,
|
|
120
|
+
SymbolsLike,
|
|
121
|
+
canonical_symbol,
|
|
122
|
+
canonical_symbol_crypto,
|
|
123
|
+
canonical_symbol_forex,
|
|
124
|
+
canonical_symbol_future,
|
|
125
|
+
canonical_symbol_future_spread,
|
|
126
|
+
canonical_symbol_index,
|
|
127
|
+
canonical_symbol_option,
|
|
128
|
+
canonical_symbol_stock,
|
|
129
|
+
canonical_symbol_stock_cms,
|
|
130
|
+
canonical_symbol_stock_nasdaq,
|
|
131
|
+
canonical_symbol_stock_yahoo,
|
|
132
|
+
)
|
|
133
|
+
from deephaven_massive._debug_log import LogOutput, disable_debug_logging, enable_debug_logging
|
|
134
|
+
from deephaven_massive._enums import (
|
|
135
|
+
AssetClass,
|
|
136
|
+
ConditionDataType,
|
|
137
|
+
ConnectionTaken,
|
|
138
|
+
ContractType,
|
|
139
|
+
Direction,
|
|
140
|
+
FuturesVenue,
|
|
141
|
+
HistorySource,
|
|
142
|
+
Locale,
|
|
143
|
+
Market,
|
|
144
|
+
OnError,
|
|
145
|
+
Order,
|
|
146
|
+
PollMode,
|
|
147
|
+
Reread,
|
|
148
|
+
SeriesType,
|
|
149
|
+
Sip,
|
|
150
|
+
Subscription,
|
|
151
|
+
SymbolConvention,
|
|
152
|
+
TickerType,
|
|
153
|
+
Timeframe,
|
|
154
|
+
Timespan,
|
|
155
|
+
)
|
|
156
|
+
from deephaven_massive._error_policy import ErrorPolicy
|
|
157
|
+
from deephaven_massive._errors import (
|
|
158
|
+
AuthenticationError,
|
|
159
|
+
EntitlementError,
|
|
160
|
+
ErrorSource,
|
|
161
|
+
MassiveError,
|
|
162
|
+
SessionClosedError,
|
|
163
|
+
)
|
|
164
|
+
from deephaven_massive._session import MassiveSession
|
|
165
|
+
from deephaven_massive._tables.symbols import canonicalize_symbols
|
|
166
|
+
|
|
167
|
+
__all__ = [
|
|
168
|
+
"ALL",
|
|
169
|
+
"AllSymbols",
|
|
170
|
+
"AssetClass",
|
|
171
|
+
"AuthenticationError",
|
|
172
|
+
"ConditionDataType",
|
|
173
|
+
"ConnectionTaken",
|
|
174
|
+
"ContractType",
|
|
175
|
+
"DateLike",
|
|
176
|
+
"Direction",
|
|
177
|
+
"EntitlementError",
|
|
178
|
+
"ErrorPolicy",
|
|
179
|
+
"ErrorSource",
|
|
180
|
+
"FilterValue",
|
|
181
|
+
"FuturesVenue",
|
|
182
|
+
"HistorySource",
|
|
183
|
+
"Locale",
|
|
184
|
+
"LogOutput",
|
|
185
|
+
"Market",
|
|
186
|
+
"MassiveConfig",
|
|
187
|
+
"MassiveError",
|
|
188
|
+
"MassiveSession",
|
|
189
|
+
"OnError",
|
|
190
|
+
"Order",
|
|
191
|
+
"PollMode",
|
|
192
|
+
"Reread",
|
|
193
|
+
"SeriesType",
|
|
194
|
+
"SessionClosedError",
|
|
195
|
+
"Sip",
|
|
196
|
+
"Subscription",
|
|
197
|
+
"SymbolConvention",
|
|
198
|
+
"SymbolsLike",
|
|
199
|
+
"TickerType",
|
|
200
|
+
"Timeframe",
|
|
201
|
+
"Timespan",
|
|
202
|
+
"__version__",
|
|
203
|
+
"canonical_symbol",
|
|
204
|
+
"canonical_symbol_crypto",
|
|
205
|
+
"canonical_symbol_forex",
|
|
206
|
+
"canonical_symbol_future",
|
|
207
|
+
"canonical_symbol_future_spread",
|
|
208
|
+
"canonical_symbol_index",
|
|
209
|
+
"canonical_symbol_option",
|
|
210
|
+
"canonical_symbol_stock",
|
|
211
|
+
"canonical_symbol_stock_cms",
|
|
212
|
+
"canonical_symbol_stock_nasdaq",
|
|
213
|
+
"canonical_symbol_stock_yahoo",
|
|
214
|
+
"canonicalize_symbols",
|
|
215
|
+
"datasets",
|
|
216
|
+
"disable_debug_logging",
|
|
217
|
+
"enable_debug_logging",
|
|
218
|
+
]
|
|
219
|
+
|
|
220
|
+
__version__: str = _version("deephaven-massive")
|