Skip to content

deephaven_massive

deephaven_massive

Market data from Massive as live and historical Deephaven tables, for traders and quants.

Testing a trading idea usually takes one program for history and another for the live feed. Here, one query of a streaming dataset gives both, with the same columns.

Every dataset works the same way. Create a session, call a dataset method to get a query, and call one of the query's methods to get a Deephaven table.

Example

In the Deephaven console, with your API key in MASSIVE_API_KEY:

import deephaven_massive as dm

m = dm.MassiveSession()

# Apple's daily bars for one week.
apple = m.stocks.bars("AAPL", dm.Timespan.DAY).history("2026-10-26", "2026-10-30")

# Each stock's latest minute bar, kept live.
latest = m.stocks.bars(["AAPL", "MSFT"], dm.Timespan.MINUTE).last_by()
Datasets

Each dataset is a method of a namespace on the session. The namespaces by asset class are m.stocks, m.options, m.futures, m.indices, m.forex, and m.crypto. The ones by topic are m.reference, m.indicators, m.economy, and m.partners. m.snapshots() reads symbols of several asset classes at once. dm.datasets() lists every dataset in a table, with each one's query methods in its Methods column.

To annotate your own code, import the class of a namespace, such as StocksNamespace for m.stocks, from deephaven_massive.namespaces, and the class of a query, such as StreamHistoryQuery, from deephaven_massive.queries. The types of the arguments, dm.SymbolsLike, dm.DateLike, and dm.FilterValue, are here, and so is dm.AllSymbols, the type of dm.ALL.

Query methods

A query reads nothing until you call one of its methods. It has only the methods its dataset supports:

  • history(start, end): a table of a past range.
  • fetch(): a table of what Massive has now.
  • poll(interval): a live table that fetches again every interval seconds.
  • blink(): a live table of a stream's rows from the latest update cycle.
  • append_only(): a live table of every row a stream sends after the call.
  • ring(capacity): a live table of a stream's latest capacity rows.
  • last_by(): a live table of each symbol's latest row from a stream.

columns() on any query lists its columns and what each one means.

A live table updates while anything uses it: a variable, a panel, or a table made from it. m.release(table) drops your variable's hold at once. The table then stops when no panel or table made from it is left. m.close() stops every live table of the session.

Settings

dm.MassiveConfig holds a session's settings. Pass it as dm.MassiveSession(config). Two settings match a session to your plans:

  • delayed_subscriptions lists the subscriptions whose data Massive serves you delayed. Their streams use Massive's delayed feed, and their fetch() and poll() tables accept delayed data.
  • rest_requests_per_minute keeps a subscription's requests within the limit Massive gives your plan from the first request.

help(dm.MassiveConfig) lists every setting. dm.ErrorPolicy decides what a bad symbol or row does, for the session or for one call.

Symbols

Datasets take Massive's tickers, spelled exactly: AAPL, BRK.B, O:SPY271217C00700000, I:SPX, C:EURUSD, X:BTCUSD, and ESZ6. dm.ALL means every symbol, in the datasets that take it. A table with a Symbol column works too. A live one is a watchlist, which the library follows as you add and delete rows. dm.canonical_symbol and dm.canonicalize_symbols convert other spellings, such as Yahoo's BRK-B.

Enums

An argument with a fixed set of values takes an enum member, such as dm.Timespan.MINUTE. dm.Timespan("minute") converts text to a member.

Errors

dm.MassiveError covers every error Massive reports and every failure inside a method of a query, such as fetch(). dm.AuthenticationError means your API key is missing or Massive refused your keys. dm.EntitlementError means your plan doesn't include the data. dm.SessionClosedError means the session is closed. Each error's source says what stopped the call, as a dm.ErrorSource. Its is_retryable says whether the same call may succeed later, and its is_bug whether a bug caused it. A wrong argument raises TypeError or ValueError at the call instead. dm.enable_debug_logging() records what the library does, for a bug report.

Server

The library runs inside a Deephaven server: in its console, in an application script, or in a Python program that starts one first. Importing the package without a running server fails with Deephaven's own error. In a plain Python program, start the server before the import:

from deephaven_server import Server

Server(port=10000, jvm_args=["-Xmx4g"]).start()

import deephaven_massive as dm
Next steps

Attributes:

Name Type Description
__version__ str

The installed version, such as "0.1.0".

Attributes

DateLike module-attribute

DateLike: TypeAlias = str | date | datetime | np.datetime64

A time bound: history()'s start and end, a list's start, end, and as_of, a day.

Every argument that names a date or an instant takes any of these forms, so a caller can pass text, a Python or Java time, or a numpy or pandas one, whichever their code holds. Annotate your own code with it, as dm.DateLike, when you pass a time through to a dataset method. One of:

  • text, read by one of two parsers:
  • ISO-8601: a date in any ISO form ("2025-03-03", "20250303", "2025-W10-1"), or a date and time with an offset ("2025-03-03T09:30:00-05:00"), whose digits below the microsecond are rounded outward like a Java instant's;
  • otherwise Deephaven's own date text, as deephaven.time.to_j_local_date reads it ("2025-3-3"), or its date and time text with a zone, as to_j_zdt reads it ("2025-03-03T09:30 America/New_York", "2025-03-03T09:30:00 ET"). Deephaven text that names a day and a zone but no time ("2025-03-03 ET") is refused, since Deephaven reads it as that midnight. Deephaven's instant parser is never used: it reads bare digits as an epoch count;
  • a date, or a timezone-aware datetime, a pandas.Timestamp among them (its nanoseconds are kept and moved outward to a microsecond like a Java instant's);
  • a Java java.time.LocalDate (a date), or a Java Instant or ZonedDateTime (an instant, moved outward to a microsecond: a start down, an end up), the values Deephaven's own time functions return, such as deephaven.time.dh_now() and to_j_local_date("2025-03-03"), and Instant and LocalDate cells read as Java values (through iter_dict, for one). dh_today() returns ISO text, the first form;
  • a numpy.datetime64: a date at day precision (numpy.datetime64("2025-03-03")), otherwise an instant in UTC, as Deephaven reads it (to_numpy gives an Instant column so), moved outward to a microsecond like a Java instant. A week, month, or year is refused: as an end it would shrink the range to its first day, and a numpy week starts on a Thursday.

These are the inputs Deephaven's own deephaven.time converters take, except a bare integer (epoch nanoseconds there, which would silently misread a date written as 20250303) and text Deephaven reads only as such a count.

Type checkers see Deephaven's Java values as Any, so the alias does not name them. A naive datetime or pandas.Timestamp, or an ISO string with a time but no UTC offset, raises a ValueError that names the parameter and the fix ("needs a timezone: pass an aware datetime or a date"), since a time without a zone cannot be placed. A date-only value is a whole day in the asset class's day zone.

FilterValue module-attribute

FilterValue: TypeAlias = str | int | float | bool | date | datetime | np.datetime64 | Sequence[str | int | float | date | np.datetime64]

A value in the filters mapping, which narrows a dataset by any of Massive's parameters.

filters passes Massive's own query parameters that a dataset method has no argument for, keyed by the wire parameter name with its dots written as underscores, such as strike_price_gte or ticker_any_of. Annotate your own code with it, as dm.FilterValue, when you build such a mapping.

A sequence is the value of an _any_of key: text items, numbers for a list of numbers (strike_price_any_of), or dates for a list of dates (date_any_of). A date or time takes every object DateLike names: a date, an aware datetime or pandas.Timestamp, a Java LocalDate, Instant, or ZonedDateTime, or a numpy.datetime64; a sequence of dates takes the day forms. Whether text is a date or a time depends on the parameter, so a filter reads only ISO-8601 text as one.

ALL module-attribute

ALL: Final = AllSymbols.ALL

Every symbol: a stream of the whole market, a whole flat file, or a full-market snapshot.

ALL is accepted by the stream methods, by every per-class snapshots(), and by history() when a flat file or a grouped-daily REST path exists. Everywhere else it raises ValueError naming the alternative.

SymbolsLike module-attribute

SymbolsLike: TypeAlias = str | Sequence[str] | Table | AllSymbols

What a market-data dataset method takes as its symbols: the instruments it reads.

Annotate your own code with it when you pass symbols through to a dataset method, such as a helper that takes either a list of tickers or a watchlist table. It is one of:

  • a str: one symbol, such as "AAPL";
  • a sequence of str: several symbols, read when the query is built;
  • a Deephaven Table with a Symbol column: a static table is read when a query method runs, and a live table works as a watchlist, which the query's methods follow as you add and delete rows;
  • dm.ALL: every symbol, in the datasets that take it.

Each symbol, and each row of a table, is Massive's exact ticker, such as "C:EURUSD", not "EUR/USD"; dm.canonical_symbol and dm.canonicalize_symbols convert other spellings.

Example
from deephaven.table import Table

import deephaven_massive as dm


def latest_quotes(m: dm.MassiveSession, symbols: dm.SymbolsLike) -> Table:
    return m.stocks.quotes(symbols).last_by()

Classes

MassiveConfig dataclass

MassiveConfig(*, api_key: str = _env_api_key(), s3_access_key_id: str | None = _env_s3_access_key_id(), s3_secret_access_key: str | None = _env_s3_secret_access_key(), websocket_hosts: Mapping[AssetClass, str] = dict(), subscription_confirmation_timeout: float = 5.0, reconnect_backoff: float = 30.0, max_reconnect_backoff: float = 120.0, connection_taken: ConnectionTaken = ConnectionTaken.FAIL, max_outage: float = 300.0, flat_file_symbol_threshold: int = 50, max_concurrency: int = 8, rest_requests_per_minute: Mapping[Subscription, int] = dict(), delayed_subscriptions: Set[Subscription] = frozenset(), flush_interval: float = 0.05, rest_base_url: str = 'https://api.massive.com', s3_endpoint_url: str = 'https://files.massive.com', s3_bucket: str = 'flatfiles', on_error: ErrorPolicy = ErrorPolicy())

Everything a MassiveSession needs to know: credentials, plan, hosts, timeouts, limits.

Construct it with keyword arguments; any field left out takes its default, and the credentials default to the environment. Every value is checked when you create it, and none can change afterward, so one config can serve several sessions. Its repr leaves out your secrets.

Example
import deephaven_massive as dm

cfg = dm.MassiveConfig()  # MASSIVE_API_KEY from the environment
# Real-time stocks; options from Massive's delayed feed.
mixed = dm.MassiveConfig(delayed_subscriptions={dm.Subscription.OPTIONS})
# Stocks streams always from Massive's real-time host, socket.massive.com; at
# most 4 REST requests or flat-file reads at once.
pinned = dm.MassiveConfig(
    websocket_hosts={dm.AssetClass.STOCKS: "socket.massive.com"},
    max_concurrency=4,
)
m = dm.MassiveSession(pinned)

MassiveConfig.from_file() builds one from a settings file instead; see there. Every setting, with its settings-file spelling, its values, and its default, is on https://github.com/deephaven-examples/deephaven-massive/blob/main/docs/configuration.md.

Attributes:

Name Type Description
api_key str

The Massive API key. Defaults to the MASSIVE_API_KEY environment variable; with neither, construction raises AuthenticationError. A key with a space, a line break, or a character outside ASCII raises ValueError, which never shows the key.

s3_access_key_id str | None

The flat-file S3 access key id. Defaults to the MASSIVE_S3_ACCESS_KEY_ID environment variable, else None. Flat-file history needs both S3 credentials; without them, history() cannot read flat files.

s3_secret_access_key str | None

The flat-file S3 secret. Defaults to the MASSIVE_S3_SECRET_ACCESS_KEY environment variable, else None.

delayed_subscriptions Set[Subscription]

Lists the subscriptions whose data Massive serves you delayed, so their streams use Massive's delayed feed and their snapshots accept its DELAYED label. Defaults to an empty set.

Massive labels such data DELAYED in its answers, and its delayed feed runs 15 minutes late, or 10 for futures. Never list dm.Subscription.CURRENCIES, the one subscription for forex and crypto: Massive has no delayed feed for it.

Leave a delayed subscription out, and a call for its current data fails with EntitlementError. The message gives the line of Python to add. A stream and fetch(wait=True) raise it at the call. A fetch() or poll() table fails with it. A stream from a host you set in websocket_hosts is the exception. It opens, and its Recency in m.connections() shows Massive's label, DELAYED.

history() and other past data don't depend on this setting.

rest_requests_per_minute Mapping[Subscription, int]

Gives each subscription's REST request limit on your plan, so its requests keep to it from the first one. Defaults to an empty mapping.

List each subscription Massive limits, with its limit in requests a minute, such as 5 for dm.Subscription.STOCKS. Leave out a subscription Massive doesn't limit. Massive's article on its request limits gives each limit: https://massive.com/knowledge-base/article/what-is-the-request-limit-for-massives-restful-apis.

Leave a limited subscription out, and the session learns its limit from Massive's first rate-limit error, after a pause. m.rate_limits() shows the limit a session learned. Copy it here to skip the pause next time. A limit you list wins over a learned one.

Every session in this server that uses your key shares one limit per subscription. When sessions list different limits, the lowest applies.

websocket_hosts Mapping[AssetClass, str]

Streams an asset class from a WebSocket host you name instead of the one the library picks, such as business.massive.com for index values. Defaults to an empty mapping.

Set indices to business.massive.com to stream index values. Massive's documentation lists no other host for them, delayed or real-time. Set nothing else unless Massive tells you to.

A host you set moves every stream of its asset class. Fair market value streams are the exception: they always use business.massive.com.

The host you set is used as given, whatever Massive's label says. When Massive doesn't serve your key there, the stream fails with Massive's refusal.

Recency in m.connections() shows how Massive labels the data it serves you there:

  • DELAYED: Massive labels the data DELAYED.
  • REALTIME: Massive labels the data REAL-TIME.
  • UNKNOWN: Massive gave no label the library knows.

Write the lower-case hostname alone: business.massive.com, not wss://business.massive.com/indices or Business.massive.com. A host whose name starts with delayed., such as delayed.massive.com, is refused for forex and crypto, and for any other class whose subscription delayed_subscriptions doesn't list.

subscription_confirmation_timeout float

Sets how many seconds Massive has to confirm a stream's channel before the library asks again. Defaults to 5 seconds.

Raise it on a slow network, where confirmations arrive late. It must be below 60 seconds.

reconnect_backoff float

Sets the shortest wait, in seconds, before reconnecting a dropped stream. Defaults to 30 seconds.

Lower it to reconnect sooner after a brief drop. It must be at least 15 seconds, which limits reconnect churn, and at most max_reconnect_backoff.

Each failure in a row doubles the wait, up to max_reconnect_backoff, and the count resets once a connection stays up for 60 seconds. A failure no retry can fix, such as a rejected key, isn't retried.

max_reconnect_backoff float

Sets the longest wait, in seconds, before reconnecting a dropped stream. Defaults to 120 seconds.

Lower it to retry more often during a long outage, or raise it to retry less often. It must be at least reconnect_backoff.

connection_taken ConnectionTaken

Decides what a live table does when another connection with the same API key takes over its own. Defaults to FAIL.

Massive allows your account one WebSocket connection per asset class, and keeps the newest. When another program, or a session with different streaming settings, connects with the same key, Massive closes this session's connection.

  • dm.ConnectionTaken.FAIL fails the live tables at once, with an error that names the time and the fix.
  • dm.ConnectionTaken.RECONNECT reconnects after the reconnect backoff, which takes the connection back. If the other program does the same, the two take turns, and each loses data while the other holds the connection.

Sessions with the same key and streaming settings share one connection whatever this setting. See https://github.com/deephaven-examples/deephaven-massive/blob/main/docs/troubleshooting.md#live-table-messages.

max_outage float

Sets how many seconds a live table waits out an outage or Massive's rate limits before it fails. Defaults to 300 seconds.

Set a larger value when your tables should ride out longer outages, or 0 when a table must fail at the first one. A stream or poll() table fails once its outage lasts max_outage:

  • A stream's outage is the time its connection is down.
  • A poll() table's outage is the time its polls keep failing, keep getting only rows the library can't read, or wait for Massive's answer.

A symbol whose reads keep failing with a temporary error, or with an error code Massive's documentation doesn't list, stops being read after max_outage, in a poll() and in a fetch() or history() of a watchlist. In a poll(), so does a symbol whose rows the library can't read, cycle after cycle. Its row in m.problems() says why.

A failed table stays failed, so call the method again for a new one. See https://github.com/deephaven-examples/deephaven-massive/blob/main/docs/troubleshooting.md#live-table-messages.

flat_file_symbol_threshold int

Sets how many symbols in a list make a history() call read Massive's flat files instead of a request per symbol, when both can serve it. Defaults to 50.

Lower it to read flat files for shorter lists, or raise it to keep them on requests. Each flat file holds a whole day of data, and a flat-file read downloads all of it, however few symbols you ask for. A call for this many symbols or more reads flat files when all of these hold:

  • MASSIVE_S3_ACCESS_KEY_ID and MASSIVE_S3_SECRET_ACCESS_KEY are set.
  • Massive publishes flat files for the dataset.
  • The call names no source.
  • For bars that take adjusted, the call passes adjusted=False.

A history() of dm.ALL reads flat files under the same conditions. A history() of a live table reads REST whenever REST can serve it.

max_concurrency int

Sets how many REST requests the session runs at a time, and separately how many flat files it reads at a time. Defaults to 8.

Raise it to run more at once, or lower it to open fewer connections. Each limit covers all the session's calls together. The same number limits the downloads of fetch() and history() that run at a time, counting each symbol of a watchlist read. The others wait their turn, and m.streams() shows them LOADING. A subscription with a request limit still keeps to it.

flush_interval float

Sets how many seconds pass between the batches of streamed rows added to live tables. Defaults to 0.05 seconds (50 ms).

A shorter interval shows each row sooner, and a longer one adds more rows in each update.

rest_base_url str

Sets the URL REST requests go to. Defaults to https://api.massive.com.

Change it only to reach a server other than Massive's, such as a local test server. The config refuses a URL with a path, a query, a fragment, a user and password, or port 0. It also refuses an http URL of a host that isn't on your own machine. The error shows *** in place of the URL's query and password.

s3_endpoint_url str

Sets the URL flat files are read from. Defaults to https://files.massive.com.

Change it only to reach a server other than Massive's.

s3_bucket str

Sets the S3 bucket flat files are read from. Defaults to flatfiles.

Change it only with s3_endpoint_url.

on_error ErrorPolicy

Decides what one bad symbol or row does: fail the table, or skip it and keep going. Defaults to dm.ErrorPolicy(), which leaves every cause at dm.ErrorPolicy.DEFAULTS.

Set a cause to dm.OnError.RAISE when a table must not run past it. help(dm.ErrorPolicy) lists the causes. By default each logs, except refused_venues, which raises.

A dataset method's on_error= sets causes for one call. Each cause the call leaves unset follows this policy, and each cause unset here follows dm.ErrorPolicy.DEFAULTS.

Methods:
from_file classmethod
from_file(path: str | PathLike[str] | None = None) -> MassiveConfig

Build a configuration from a YAML settings file, for settings shared between scripts.

The file is a mapping of setting names, the attribute names of this class, to values; a setting it leaves out takes its default. Precedence is code, then the file, then the defaults: override a setting of the file in code with dataclasses.replace. The credentials are never read from the file; they come from code or from their environment variables, as for MassiveConfig(). Every scalar is read as text and converted by the setting's own rule, so a ticker such as ON or NO stays text, and an enum word is taken only as spelled exactly (raise, not Raise). Every setting's spelling, values, and default, with an example file, are on https://github.com/deephaven-examples/deephaven-massive/blob/main/docs/configuration.md.

Example
import dataclasses

import deephaven_massive as dm

# settings.yaml holds, for example:
#   delayed_subscriptions: [options]
#   max_outage: 600
cfg = dm.MassiveConfig.from_file("~/massive/settings.yaml")
cfg = dataclasses.replace(cfg, max_concurrency=4)  # code wins over the file
m = dm.MassiveSession(cfg)

Parameters:

Name Type Description Default
path str | PathLike[str] | None

The file, as a str or path; a leading ~ is expanded to the home folder. Defaults to the path in the DEEPHAVEN_MASSIVE_CONFIG_FILE environment variable, the way a console or container names its file without code. MassiveConfig() never reads a file.

None

Returns:

Type Description
MassiveConfig

The validated configuration.

Raises:

Type Description
ValueError

If path is not given and DEEPHAVEN_MASSIVE_CONFIG_FILE is unset or blank (or has surrounding whitespace); if the file is not UTF-8 or not valid YAML; if it holds more than one document, a top level that is not a mapping (an empty file included), a duplicate key, a tag (!!python/... or any other), an anchor or alias, lists and mappings nested more than 10 deep, a credential (the message names the environment variable to use and never shows the value), or an unknown setting (the message suggests the closest name, and shows at most the key's first 40 characters); if a value is empty or cannot be converted; or if the constructor refuses a value. Each message names the file, and the setting and its line and column where known, except one about an environment variable (a credential with surrounding whitespace, or one S3 credential without the other), which names the variable instead.

FileNotFoundError

If the file does not exist; the message names it, and the environment variable when the path came from there.

OSError

If the file exists but cannot be read.

AuthenticationError

If no API key is in the environment.

Side effects

Reads the file once, and logs one INFO line naming it and the settings it set.

AllSymbols

The type of dm.ALL, the value that asks a dataset for every symbol.

Pass dm.ALL itself, as in m.stocks.trades(dm.ALL); name dm.AllSymbols only in a type hint, as dm.SymbolsLike does. dm.ALL is its one member, and an enum member stays itself through a copy or an unpickle, so code tests for it with symbols is dm.ALL. It is not a str, so it is never mistaken for a ticker.

LogOutput

Where enable_debug_logging writes the log, when it is not a file.

Pass a member, or a file path (str or os.PathLike), as output.

Example
import deephaven_massive as dm

dm.enable_debug_logging(dm.LogOutput.STDERR)  # the default
dm.enable_debug_logging("/tmp/massive.log")  # a file instead
Attributes
STDERR class-attribute instance-attribute
STDERR = 'stderr'

sys.stderr as it is when the log is turned on, which Deephaven copies into its log, the container's log, and the Deephaven IDE's log panel.

AssetClass

An asset class, such as stocks or crypto.

Pin a streaming host with it in MassiveConfig.websocket_hosts, and filter the reference datasets m.reference.ticker_types, m.reference.exchanges, and m.reference.conditions by it. The diagnostics tables show it too.

Example
import deephaven_massive as dm

config = dm.MassiveConfig(websocket_hosts={dm.AssetClass.STOCKS: "socket.massive.com"})

ConditionDataType

The kind of tick a condition code applies to (m.reference.conditions).

Example
import deephaven_massive as dm

assert dm.ConditionDataType("trade") is dm.ConditionDataType.TRADE

ConnectionTaken

What a live table does when another connection with the same API key takes over its own.

Massive allows your account one WebSocket connection per asset class. When another program connects with the same key, Massive keeps the newer connection and closes the older one. Another session on this server does the same when its streaming settings, such as max_outage, differ from this one's. MassiveConfig.connection_taken picks what the older connection's live tables do:

  • FAIL, the default: they fail at once, with a MassiveError that names the time and the fix.
  • RECONNECT: they reconnect after reconnect_backoff and take the connection back. Meanwhile, their m.streams() row's Error says when the connection was taken and when it is taken back. They miss the data of each gap, and if the other program does the same, the two take turns indefinitely.

Sessions with the same key and streaming settings share one connection whatever this setting, and each table follows its own session's setting.

Example
import deephaven_massive as dm

assert dm.ConnectionTaken("reconnect") is dm.ConnectionTaken.RECONNECT
config = dm.MassiveConfig(connection_taken=dm.ConnectionTaken.RECONNECT)

ContractType

The type of an options contract, for the contract_type argument of the options datasets.

The chain, the contracts, and the open interest filter by it. Its values are the contract_type values those endpoints accept: calls and puts.

Example
import deephaven_massive as dm

m = dm.MassiveSession()
puts = m.options.chain("AAPL", contract_type=dm.ContractType.PUT).fetch()
assert dm.ContractType("call") is dm.ContractType.CALL

Direction

Which side of the market movers() returns.

Example
import deephaven_massive as dm

m = dm.MassiveSession()
gainers = m.crypto.movers(dm.Direction.GAINERS).poll(60)
assert dm.Direction("losers") is dm.Direction.LOSERS

FuturesVenue

A futures exchange, which picks the flat files a futures history() reads.

A futures dataset's venues argument takes a set of members. Left out, a read takes every exchange the plan allows and skips each one Massive refuses with a warning; the refused_venues cause of dm.ErrorPolicy says what happens when Massive refuses an exchange the call names. Both apply only to flat files: streams cover every exchange.

Example
import deephaven_massive as dm

assert dm.FuturesVenue("cme") is dm.FuturesVenue.CME

HistorySource

Where history() reads from.

  • AUTO: the library picks flat files or REST. The choice depends on whether you set S3 keys, the dataset, the bars and adjusted, and how many symbols you ask for. When REST can serve them, it reads from REST any day whose file is missing or isn't in your plan.
  • REST: Massive's REST API.
  • FLAT_FILES: Massive's flat files, the daily CSV files it publishes on S3. They need S3 keys. Each file holds a whole day of data, and a read downloads all of it, however few symbols or short a range you ask for.
Example
import deephaven_massive as dm

assert dm.HistorySource("flat_files") is dm.HistorySource.FLAT_FILES

Locale

The locale the reference endpoints filter by.

Example
import deephaven_massive as dm

assert dm.Locale("us") is dm.Locale.US

Market

The market m.reference.tickers filters by.

Example
import deephaven_massive as dm

assert dm.Market("otc") is dm.Market.OTC

OnError

What a problem does: fail, or keep going with or without a log record.

One bad symbol or row never stops a table by default. The members:

  • RAISE: fail whatever met the problem. A check at the call raises, and so does a call with wait=True. A live table fails, a watchlist read by fetch() or history() included: one symbol's problem fails the whole table, not only that symbol.
  • LOG: skip the value and keep going. m.problems() lists each problem, and the first of each cause on each table logs one WARNING that points there; the rest log at DEBUG. A row of Massive's data the library can't read whole is never published, under any setting.
  • IGNORE: keep going as LOG does, with nothing logged above DEBUG.

Each cause has its own setting in dm.ErrorPolicy, set for the session (MassiveConfig.on_error) or for one call (a dataset method's on_error=); its docstring lists the causes. The symbol converters take a member directly: the on_error argument of canonicalize_symbols (default LOG), and of canonical_symbol and the per-class converters (default RAISE, where LOG and IGNORE return None), for a value that doesn't convert.

Example
import deephaven_massive as dm

assert dm.OnError("log") is dm.OnError.LOG
strict = dm.MassiveConfig(
    on_error=dm.ErrorPolicy(noncanonical_symbols=dm.OnError.RAISE)
)

Order

The sort direction of a REST list endpoint (the order parameter).

Example
import deephaven_massive as dm

assert dm.Order("desc") is dm.Order.DESC

PollMode

How a poll() table combines one poll's rows with the last.

  • AUTO, the default of poll(): the mode the dataset's page names. It's APPEND for the news and filings feeds, UPSERT for IPOs, and REPLACE for the rest.
  • REPLACE: a keyed table that holds exactly the latest poll's rows. A key the poll doesn't return is deleted, even when the poll returns no rows.
  • UPSERT: a keyed table that adds and updates rows but never deletes them.
  • APPEND: an append-only table that adds only rows it hasn't seen. The dataset's keys identify a row, such as a news article's id. A snapshot's update time is part of its key, so APPEND on a snapshot records each new state of a symbol. A later revision that changes none of the key columns isn't added. UPSERT follows revisions.
Example
import deephaven_massive as dm

assert dm.PollMode("append") is dm.PollMode.APPEND

Reread

Whether history() of a watchlist downloads a symbol again when you add it back.

A history() of a watchlist reads each symbol you add over the call's range. It drops each symbol you delete. This setting decides what happens when a deleted symbol comes back. It has no effect when symbols isn't a live table.

  • ALWAYS, the default: the symbol is downloaded again and shows Massive's current data. It has no rows until the download lands.
  • NEVER: the symbol gets its earlier rows back at once, with no request. The result keeps every download in memory for as long as it lives, and ReadAt in m.symbol_reads() says when each was made.

A symbol whose download failed is downloaded again when it comes back, under either member.

Example
import deephaven_massive as dm

assert dm.Reread("never") is dm.Reread.NEVER

SeriesType

The bar price an indicator is computed from.

Example
import deephaven_massive as dm

assert dm.SeriesType("close") is dm.SeriesType.CLOSE

Sip

The securities information processor a condition code belongs to.

The values are upper case, as Massive spells them.

Example
import deephaven_massive as dm

assert dm.Sip("OPRA") is dm.Sip.OPRA

Subscription

One of Massive's five subscriptions, each with its own plan.

Massive sells its data as five subscriptions, one per asset class, with forex and crypto sharing CURRENCIES. A subscription's plan may limit how many REST requests a minute it makes. All the API keys of your account share the limits.

Give each limited subscription's limit in MassiveConfig.rest_requests_per_minute, so its requests keep to it from the first one. Without it, the library slows down after Massive's first rate-limit error. m.rate_limits() shows each subscription's state. Datasets Massive assigns to no subscription share a limit of their own, other. Reference, economy, and partner data are among them. The library learns that limit from Massive's rate-limit errors.

Example
import deephaven_massive as dm

# Options and currencies (forex and crypto) limited to 5 requests a minute.
config = dm.MassiveConfig(
    rest_requests_per_minute={dm.Subscription.OPTIONS: 5, dm.Subscription.CURRENCIES: 5}
)

SymbolConvention

The convention a symbol is written in, which canonical_symbol converts from.

Massive writes a share class as .B (BRK.B) and a preferred as a lower-case p and its series (KIMpL), as the CTA's CQS convention does, so CQS text needs no conversion. The other members name the exact grammar of one other US stock convention; only plain tickers, share classes, and preferreds convert, because Massive documents no spelling for warrants, units, rights, or when-issued shares.

  • MASSIVE: Massive's own spelling, the default. A canonical ticker comes back unchanged; a forex, crypto, index, or option symbol in another unambiguous spelling of its class converts (EUR/USD to C:EURUSD, SPX to I:SPX for the indices class); a stock ticker in another convention's spelling raises, since - means a class to Yahoo and a preferred to Nasdaq. It is the only member every class takes.
  • YAHOO: Yahoo Finance; a class is -B (BRK-B), a preferred -P and its series (BAC-PL).
  • NASDAQ: the Nasdaq Integrated Platform symbology (the "NASDAQ Symbol" column of nasdaqtraded.txt); a class is .B, a preferred - and its optional series (KIM-L).
  • CMS: the root, a space, and a suffix, as many broker and FIX systems write it; a class is B (BRK B), a preferred PR and its optional series (BAC PRL).

YAHOO, NASDAQ, and CMS apply to stocks only. Each names a source of symbols, not an exchange: pick the one the tickers came from, not where the stock trades. NASDAQ reads BRK-B as a preferred, BRKpB, whatever exchange lists Berkshire.

Example
import deephaven_massive as dm

dm.canonical_symbol(
    "BAC-PL", dm.AssetClass.STOCKS, convention=dm.SymbolConvention.YAHOO
)  # 'BACpL'

TickerType

The type code of a ticker, which m.reference.tickers filters by.

The values are Massive's codes, upper case as Massive spells them; m.reference.ticker_types() lists them with their descriptions.

Example
import deephaven_massive as dm

assert dm.TickerType("ETF") is dm.TickerType.ETF

Timeframe

The reporting period of the m.stocks.financials statements.

ANNUAL is a fiscal year and QUARTERLY a fiscal quarter. TRAILING_TWELVE_MONTHS sums the four most recent quarters. The income and cash flow statements offer it, and a balance sheet, which is a snapshot at the period's end, doesn't.

Example
import deephaven_massive as dm

assert dm.Timeframe("annual") is dm.Timeframe.ANNUAL

Timespan

The unit of a bar or an indicator window.

For bars(), the timespan also decides whether the bars stream: one-second and one-minute bars (SECOND and MINUTE with multiplier=1) stream, and every other bar is history only. SESSION is a futures trading session, and Massive serves it only for futures bars. A futures DAY bar also spans one session. The previous day's bar is a dataset of its own, previous_day_bar().

Example
import deephaven_massive as dm

span = dm.Timespan("minute")  # text converts to a member
assert span is dm.Timespan.MINUTE

ErrorPolicy dataclass

ErrorPolicy(every: OnError | None = None, /, *, noncanonical_symbols: OnError | None = None, unreadable_symbols: OnError | None = None, unavailable_symbols: OnError | None = None, refused_symbols: OnError | None = None, undocumented_errors: OnError | None = None, unrequested_symbols: OnError | None = None, unreadable_keys: OnError | None = None, unconvertible_values: OnError | None = None, malformed_rows: OnError | None = None, unlisted_contracts: OnError | None = None, unscheduled_products: OnError | None = None, refused_venues: OnError | None = None)

What each kind of problem does: fail the table, or skip it and keep going.

A problem is one bad symbol, row, file line, or refused futures exchange, such as a watchlist row that isn't Massive's ticker. Each kind of problem is a cause. Each cause takes one dm.OnError member:

  • dm.OnError.RAISE fails the call or the live table that met it.
  • dm.OnError.LOG skips it, keeps going, and logs a warning.
  • dm.OnError.IGNORE does the same, logging only at DEBUG.

m.problems() lists each problem a table met, with its cause and the setting that applied. Under RAISE, the error that fails the call names the problem. Under LOG, the first problem of each cause on each table logs one warning that points to m.problems(); the later ones log at DEBUG only.

A row of Massive's data the library can't read whole is never published, whatever the setting: its cause's setting decides only whether the table fails and how loudly the log reports it. When the library can read none of the rows of your symbols inside your call's window whole, across all the pages or files the call read, the call fails whatever the setting, since the table would otherwise hold nothing and show no error. Rows outside the window, and rows of a symbol the call didn't ask for, count neither way. In a fetch() or history(), neither do the rows of a symbol that failed, nor REST rows of a day the flat files serve. Under LOG and IGNORE, one symbol's failure never takes another's rows: a call that names symbols returns the rows of those that didn't fail, and m.problems() lists each that did. Under RAISE, a symbol's problem of that cause fails the whole call or table. Whatever the setting, a call fails when every symbol it names fails. A live stream judges runs of rows, and https://github.com/deephaven-examples/deephaven-massive/blob/main/docs/configuration.md#read-failures lists how each read and stream judges.

Set a session's policy with dm.MassiveConfig(on_error=...). Set one call's policy with any dataset method's on_error= argument. Each cause takes the first setting it finds: the call's, then the session's, then ErrorPolicy.DEFAULTS. A call that leaves on_error out, or passes None, sets no cause, so the session decides. By default every cause logs, except refused_venues, which raises. A live call whose policy changes any cause's setting gets its own stream in m.streams().

Example
import deephaven_massive as dm

# Fail on a bad watchlist row; every other cause keeps its default.
cfg = dm.MassiveConfig(on_error=dm.ErrorPolicy(noncanonical_symbols=dm.OnError.RAISE))
# Fail on everything but a symbol Massive has no data for.
strict = dm.ErrorPolicy(dm.OnError.RAISE, unavailable_symbols=dm.OnError.LOG)
m = dm.MassiveSession(cfg)
trades = m.stocks.trades(["AAPL", "MSFT"], on_error=strict)  # this call only
day = trades.history("2026-10-30", "2026-10-30")

Attributes:

Name Type Description
noncanonical_symbols OnError | None

Decides what happens to a row of a watchlist or other table you pass whose value isn't Massive's exact ticker or futures product code, such as SPX for I:SPX. Defaults to LOG.

Set dm.OnError.RAISE to catch a typo in a watchlist at once. A bad row added later then fails the whole live table, even a watchlist read by fetch() or history(). Under the other values, a row you fix is read like a new one.

This setting covers only tables. A symbol you pass in code must be Massive's exact ticker, or the call raises ValueError. A table whose every row is bad raises ValueError too, whatever this setting says.

unreadable_symbols OnError | None

Decides whether a row of Massive's data whose symbol the library can't read as Massive's ticker fails the table; the row is left out either way. Defaults to LOG.

Set dm.OnError.RAISE to fail the table at the first such row. Such a symbol is Massive's data: m.problems() gives what Massive sent, for a report to Massive.

A listed crypto pair is unreadable too when its ticker isn't its two currencies written together. Under dm.OnError.LOG or dm.OnError.IGNORE it gets no rows, and m.problems() lists it. A watchlist read by fetch() also names it in Error in m.symbol_reads().

unavailable_symbols OnError | None

Decides what happens to a symbol Massive has no data for. Defaults to LOG.

Set dm.OnError.RAISE when a missing symbol means your list is wrong. Under dm.OnError.LOG and dm.OnError.IGNORE, the call skips the symbol and reads the others, and m.problems() lists it. Massive has no data for a symbol when it gives one of these answers:

  • HTTP 404 for the symbol's request;
  • a snapshot row whose error is NOT_FOUND;
  • a crypto ticker list without the pair.

A symbol Massive answers with no rows and no error has no rows, whatever this setting says.

refused_symbols OnError | None

Decides what happens to a symbol Massive refuses, usually because your plan doesn't serve it. Defaults to LOG.

Set dm.OnError.RAISE when a fetch(), history(), poll(), or stream must not run without every symbol you named. Under dm.OnError.LOG and dm.OnError.IGNORE, the symbol gets no rows, the others are read, and m.problems() lists it with Massive's answer.

undocumented_errors OnError | None

Decides what happens to a symbol Massive answers with an error code its documentation doesn't list. Defaults to LOG.

Set dm.OnError.RAISE when a call or table must not run without every symbol you named. Under dm.OnError.LOG and dm.OnError.IGNORE, the symbol gets no rows, the others are read, and m.problems() quotes Massive's code and message.

Such an answer may not last, so a poll() and a fetch() or history() of a watchlist read the symbol again, as after a server error. The symbol fails only once the answer has lasted max_outage, and only then does dm.OnError.RAISE fail the table. A fetch() or history() of symbols in code or of dm.ALL reads each symbol once, so under dm.OnError.RAISE it raises at once.

A snapshot answers a ticker it can't serve with an error code in place of its data. Massive documents two codes, each under its own setting:

  • NOT_FOUND: unavailable_symbols;
  • NOT_ENTITLED: refused_symbols.

Every other code follows this setting.

unrequested_symbols OnError | None

Decides whether a row Massive returns for a symbol the call didn't ask for fails the table; the row is left out either way. Defaults to LOG.

Set dm.OnError.RAISE to fail the call or table when Massive sends a row of a symbol the call didn't ask for. m.problems() lists each such row with its symbol and count. Massive sends such rows in these cases:

  • m.options.open_interest_by_underlying() or an exposure dataset, such as m.options.exposure_by_strike(), asked for SPX gets rows of I:SPX.
  • A dataset whose rows list their tickers, such as m.partners.benzinga.news(), sends a row that lists none of the tickers the call named.
  • An options dataset sends rows of another underlying. For example, m.options.contracts("I:DJT") leaves out the stock DJT's contracts.
  • A futures read by a table of product codes gets a row of another code.
unreadable_keys OnError | None

Decides whether a row of Massive's data whose key the library can't read fails the table; the row is left out either way. Defaults to LOG.

A key can't be read when it is one of these:

  • the row's symbol, its time, or another column its dataset needs, missing or of the wrong type;
  • a time of 0, or one outside 1990 to 2100;
  • a poll() table's key column, null or NaN, which would merge unrelated rows.

A symbol that is present but isn't Massive's ticker is unreadable_symbols. Set dm.OnError.RAISE to fail the table at the first such row. Such a row is a sign that Massive's format changed.

unconvertible_values OnError | None

Decides whether a row of Massive's data holding a value the library can't read as its column's type fails the table; the row is left out either way. Defaults to LOG.

A value the library can't read is one of these:

  • a value of another type, or a whole number that a double column would round;
  • a time outside 1990 to 2100 in any column but the row's own time;
  • the start of a bar of a day or longer stamped at a time Massive isn't known to use.

In those other columns a time of 0 is a null, as Massive means it, and the row is kept.

Set dm.OnError.RAISE when a table must fail rather than leave out a row with a value it can't read.

malformed_rows OnError | None

Decides what happens to a line of a Massive flat file that isn't a readable row: it doesn't split into the header's fields, or it isn't UTF-8 text. Defaults to LOG.

Set dm.OnError.RAISE when a history() read from flat files must have every row of each file it reads.

  • dm.OnError.LOG skips the line, keeps the file's other rows, and logs one warning. m.problems() gives each file's count of such lines and the first one's row number, never the line itself.
  • dm.OnError.IGNORE does the same, logging only at DEBUG.
  • dm.OnError.RAISE makes history() raise MassiveError, naming the file and the first such line's row. A history() of a live table fails the table instead.

Only a history() that reads flat files meets such a line. Under any setting, a file whose every line is malformed fails the read.

unlisted_contracts OnError | None

Decides what happens to the rows of a futures ticker Massive streams that neither its futures snapshot nor its contracts list has held for 30 minutes. Defaults to LOG.

A futures stream dates each row from its product's trading schedule, which it finds through those lists, and holds the rows until then. Massive's lists sometimes lag its stream, so a ticker missing from both waits and is asked about again, at 2, 8, and 30 seconds and then every minute. After 30 minutes its rows are left out, then and later, until a list holds it.

  • dm.OnError.RAISE fails the stream at that point.
  • dm.OnError.LOG leaves the rows out and logs one warning per stream.
  • dm.OnError.IGNORE does the same, logging only at DEBUG.

m.problems() lists the rows left out under unlisted_contracts.

unscheduled_products OnError | None

Decides what happens to the rows of a futures product that Massive's schedules give no session for: none at all, or none that holds the row's time. Defaults to LOG.

A futures stream dates each row from its product's trading schedule. A row no session holds waits while the library loads the schedule again. If Massive's answer still has no session for it, the library can't date the row, so it leaves the row out. A product with no session at all is asked about again each day, and once Massive publishes its sessions, its rows are dated and published again.

  • dm.OnError.RAISE fails the stream at the first row left out.
  • dm.OnError.LOG leaves the rows out and logs one warning per stream.
  • dm.OnError.IGNORE does the same, logging only at DEBUG.

m.problems() lists the rows left out under unscheduled_products.

refused_venues OnError | None

Decides what a futures history() does when Massive refuses the flat files of an exchange the call names in venues, as it does for an exchange the plan doesn't include. Defaults to RAISE.

It applies only to exchanges a call names. A call that leaves venues out reads every exchange the plan allows: where only flat files can serve it, it skips each one Massive refuses with a warning, whatever this setting says. Set dm.OnError.LOG when your calls name exchanges your plan may not cover and should read the ones it does.

  • dm.OnError.RAISE makes history() raise EntitlementError, naming the exchange and the setting.
  • dm.OnError.LOG skips every file of each refused exchange over the whole range and logs one warning. m.problems() lists the exchanges with Massive's status and text.
  • dm.OnError.IGNORE does the same, logging only at DEBUG.

It applies only when REST can't serve the call: dm.ALL, or source=dm.HistorySource.FLAT_FILES. Otherwise history() reads REST when Massive refuses the flat files. Under any setting, a call whose every exchange is refused raises EntitlementError.

Set each cause you name, and every other one to every.

Parameters:

Name Type Description Default
every OnError | None

The setting for every cause you don't name. Pass it by position. Defaults to None, which leaves those causes unset.

None
noncanonical_symbols OnError | None

A watchlist row that isn't Massive's exact ticker.

None
unreadable_symbols OnError | None

A symbol in Massive's data that the library can't read.

None
unavailable_symbols OnError | None

A symbol Massive has no data for.

None
refused_symbols OnError | None

A symbol Massive refuses.

None
undocumented_errors OnError | None

A symbol Massive answers with an error code its documentation doesn't list.

None
unrequested_symbols OnError | None

A row Massive returns for a symbol the call didn't ask for.

None
unreadable_keys OnError | None

A row of Massive's data whose key the library can't read.

None
unconvertible_values OnError | None

A row of Massive's data with a value the library can't read.

None
malformed_rows OnError | None

A flat-file line that isn't a readable row.

None
unlisted_contracts OnError | None

A futures ticker Massive streams that its lists don't hold.

None
unscheduled_products OnError | None

A futures row Massive's schedules give no session for.

None
refused_venues OnError | None

A futures exchange the call names whose flat files Massive refuses.

None

Raises:

Type Description
TypeError

If an argument is neither None nor a dm.OnError member. A string such as "raise" raises too, so pass dm.OnError.RAISE.

Attributes
DEFAULTS class-attribute
DEFAULTS: ErrorPolicy

The setting of each cause that neither the call nor the session sets.

AuthenticationError

AuthenticationError(*args: object, status: int | None = None, request_id: str | None = None, source: ErrorSource | None = None, is_retryable: bool | None = None, is_bug: bool | None = None)

Your API key is missing, or Massive refused your API key or your flat-file S3 keys.

dm.MassiveConfig() raises it when MASSIVE_API_KEY isn't set and you pass no api_key. A fetch() or history() with wait=True raises it when Massive rejects the API key (HTTP 401); without wait=True, the table fails with it instead. A live table fails with it when Massive's streaming server rejects the key, and so does every other stream on that connection. Massive may give the same answer to a plan without streams of the asset class, so the message says that too.

If S3 rejects your flat-file keys, history() reads REST instead and logs a warning. It raises this error only under source=dm.HistorySource.FLAT_FILES, or when REST can't serve the read. The message names s3_access_key_id and s3_secret_access_key.

Its source is ErrorSource.USER when the key is missing, and ErrorSource.MASSIVE when Massive refused it.

Example
import deephaven_massive as dm

try:
    config = dm.MassiveConfig()
except dm.AuthenticationError:
    config = dm.MassiveConfig(api_key="...")

Create the error.

Parameters:

Name Type Description Default
*args object

The exception's arguments, as for Exception; normally one message.

()
status int | None

The HTTP status of the response the error came from, or None when it did not come from an HTTP response.

None
request_id str | None

The request_id of Massive's response, or None when there was no response or it carried none.

None
source ErrorSource | None

What stopped the call, or None (absent) for the class's default_source, which is ErrorSource.MASSIVE unless a subclass sets another. A LIBRARY error's message is ended with LIBRARY_BUG unless it holds it.

None
is_retryable bool | None

Whether the same call may succeed later, or None (absent) to decide: true for the class's default_is_retryable, a status in RETRYABLE_STATUSES, or a NETWORK source. A bug is never retryable, whatever this says.

None
is_bug bool | None

Whether a defect caused the error, or None (absent) for the class's default_is_bug. A LIBRARY error is a bug whatever this says.

None
Attributes
default_source class-attribute
default_source: ErrorSource = ErrorSource.MASSIVE

The source of an error of this class created without one; a subclass whose every instance has another source sets its own.

default_is_retryable class-attribute
default_is_retryable: bool = False

Whether every error of this class created without is_retryable may succeed later, an answer that means "try again" whatever its status; a subclass of such answers sets it.

default_is_bug class-attribute
default_is_bug: bool = False

Whether an error of this class created without is_bug is a bug; a subclass whose every instance is a user's bug sets it. A LIBRARY error is a bug whatever this says.

status property
status: int | None

The HTTP status of the response behind the error, or None when there was none.

Usually Massive's, such as 404 or 429. A flat file's comes from S3, and a proxy that refused its credentials gives its own 407.

request_id property
request_id: str | None

The request_id of Massive's response, for a support request to Massive, or None.

source property
source: ErrorSource

What stopped the call: Massive, the network, your code or settings, or a bug.

is_retryable property
is_retryable: bool

Whether the same call may succeed if you make it again later.

True for:

  • a rate limit (HTTP 429);
  • a failure on Massive's side (HTTP 500, 502, 503, or 504);
  • no answer (ErrorSource.NETWORK);
  • HTTP 404 on a later page of one symbol's REST read;
  • S3's RequestTimeout on a flat file;
  • a flat file Massive hasn't published yet;
  • a page Massive answered with another adjusted than the call asked for;
  • a poll() cycle in which the library couldn't read any row Massive sent for a symbol, or for dm.ALL, since the next cycle may read them whole.

A fetch() or history() of a watchlist whose every symbol failed is retryable only when every symbol's error is. False for any other HTTP status, an AuthenticationError, an EntitlementError, a SessionClosedError, or a bug.

Before it raises, the library has retried a server failure or a failed connection a few times. A read that Massive keeps refusing fails with a rate-limit error once waiting out the refusals would take longer than:

  • for a call you wait for (wait=True, or opening a stream with append_only() or last_by()): 10 minutes, or 90 seconds inside a console command;
  • for a read that feeds a live table (a fetch() or history() without wait=True, a watchlist's reads after the call returns, a poll() cycle, or a stream's lookups): max_outage in MassiveConfig.

Wait before you call again.

is_bug property
is_bug: bool

Whether a defect caused the error: a bug in the library, or one in your code.

True for every ErrorSource.LIBRARY error; its message says how to report it. True too for a bug in your code that the library caught, such as a watchlist table that failed or an argument that one of the watchlist's symbols doesn't take; its message names the fix. The library logs a bug at ERROR, and any other error below ERROR.

EntitlementError

EntitlementError(*args: object, status: int | None = None, request_id: str | None = None, source: ErrorSource | None = None, is_retryable: bool | None = None, is_bug: bool | None = None)

Your key is valid, but your plan doesn't include what you asked for.

Massive refused a REST request with HTTP 403, a flat file, or a stream subscription. A refused subscription fails only the table that asked, and other tables on the same connection keep running. The library raises it too when Massive marks the data delayed and the data's subscription isn't in MassiveConfig.delayed_subscriptions. The message then names the setting to change. Its source is ErrorSource.MASSIVE when Massive refused, and ErrorSource.USER when delayed_subscriptions refused delayed data.

When Massive refused, the message quotes its answer. A refused flat-file history() also names source=dm.HistorySource.REST when REST can serve the read.

Example

Read a day of trades, and report it when your plan lacks them:

import deephaven_massive as dm

m = dm.MassiveSession()
try:
    day = m.stocks.trades("AAPL").history("2025-06-06", "2025-06-06", wait=True)
except dm.EntitlementError as e:
    print(f"not on this plan: {e}")

Create the error.

Parameters:

Name Type Description Default
*args object

The exception's arguments, as for Exception; normally one message.

()
status int | None

The HTTP status of the response the error came from, or None when it did not come from an HTTP response.

None
request_id str | None

The request_id of Massive's response, or None when there was no response or it carried none.

None
source ErrorSource | None

What stopped the call, or None (absent) for the class's default_source, which is ErrorSource.MASSIVE unless a subclass sets another. A LIBRARY error's message is ended with LIBRARY_BUG unless it holds it.

None
is_retryable bool | None

Whether the same call may succeed later, or None (absent) to decide: true for the class's default_is_retryable, a status in RETRYABLE_STATUSES, or a NETWORK source. A bug is never retryable, whatever this says.

None
is_bug bool | None

Whether a defect caused the error, or None (absent) for the class's default_is_bug. A LIBRARY error is a bug whatever this says.

None
Attributes
default_source class-attribute
default_source: ErrorSource = ErrorSource.MASSIVE

The source of an error of this class created without one; a subclass whose every instance has another source sets its own.

default_is_retryable class-attribute
default_is_retryable: bool = False

Whether every error of this class created without is_retryable may succeed later, an answer that means "try again" whatever its status; a subclass of such answers sets it.

default_is_bug class-attribute
default_is_bug: bool = False

Whether an error of this class created without is_bug is a bug; a subclass whose every instance is a user's bug sets it. A LIBRARY error is a bug whatever this says.

status property
status: int | None

The HTTP status of the response behind the error, or None when there was none.

Usually Massive's, such as 404 or 429. A flat file's comes from S3, and a proxy that refused its credentials gives its own 407.

request_id property
request_id: str | None

The request_id of Massive's response, for a support request to Massive, or None.

source property
source: ErrorSource

What stopped the call: Massive, the network, your code or settings, or a bug.

is_retryable property
is_retryable: bool

Whether the same call may succeed if you make it again later.

True for:

  • a rate limit (HTTP 429);
  • a failure on Massive's side (HTTP 500, 502, 503, or 504);
  • no answer (ErrorSource.NETWORK);
  • HTTP 404 on a later page of one symbol's REST read;
  • S3's RequestTimeout on a flat file;
  • a flat file Massive hasn't published yet;
  • a page Massive answered with another adjusted than the call asked for;
  • a poll() cycle in which the library couldn't read any row Massive sent for a symbol, or for dm.ALL, since the next cycle may read them whole.

A fetch() or history() of a watchlist whose every symbol failed is retryable only when every symbol's error is. False for any other HTTP status, an AuthenticationError, an EntitlementError, a SessionClosedError, or a bug.

Before it raises, the library has retried a server failure or a failed connection a few times. A read that Massive keeps refusing fails with a rate-limit error once waiting out the refusals would take longer than:

  • for a call you wait for (wait=True, or opening a stream with append_only() or last_by()): 10 minutes, or 90 seconds inside a console command;
  • for a read that feeds a live table (a fetch() or history() without wait=True, a watchlist's reads after the call returns, a poll() cycle, or a stream's lookups): max_outage in MassiveConfig.

Wait before you call again.

is_bug property
is_bug: bool

Whether a defect caused the error: a bug in the library, or one in your code.

True for every ErrorSource.LIBRARY error; its message says how to report it. True too for a bug in your code that the library caught, such as a watchlist table that failed or an argument that one of the watchlist's symbols doesn't take; its message names the fix. The library logs a bug at ERROR, and any other error below ERROR.

ErrorSource

What stopped a call that raised a MassiveError: Massive, the network, you, or a bug.

Read it from an error's source to decide what to do. Massive's refusals and errors are MASSIVE, an answer that never came is NETWORK, a problem in your code or settings is USER, and a bug in the library is LIBRARY. Later versions may add members, so end a match on it with case _:. The values are the library's own names, not values Massive sends.

Example

Tell a library bug from a problem in your code or settings:

import deephaven_massive as dm

m = dm.MassiveSession()
try:
    dividends = m.stocks.dividends(["AAPL", "MSFT"]).fetch(wait=True)
except dm.MassiveError as e:
    if e.source is dm.ErrorSource.LIBRARY:
        print(f"please report: {e}")
    elif e.source is dm.ErrorSource.USER:
        print(f"fix this: {e}")
    else:
        print(f"failed: {e}")
Attributes
MASSIVE class-attribute instance-attribute
MASSIVE = 'massive'

Massive refused or failed the request: an HTTP error such as 403 or 503, a rejected key, a plan without the data, a WebSocket status message, Massive's reference data lacking what you asked for, or a row Massive sent that the library can't read. When Massive answered, the message quotes it.

NETWORK class-attribute instance-attribute
NETWORK = 'network'

No answer came: a connection failed through every retry the library made, or a live table got nothing for longer than MassiveConfig.max_outage.

USER class-attribute instance-attribute
USER = 'user'

Your code or settings stopped the call, such as a missing API key, delayed data your MassiveConfig doesn't allow, a certificate or proxy setting that fails, a closed session, or a watchlist table of yours that failed. The message names the fix.

LIBRARY class-attribute instance-attribute
LIBRARY = 'library'

A bug in the library, or data from Massive it can't read. The message says how to report it.

MassiveError

MassiveError(*args: object, status: int | None = None, request_id: str | None = None, source: ErrorSource | None = None, is_retryable: bool | None = None, is_bug: bool | None = None)

The base class of every error Massive or the library reports.

One except dm.MassiveError catches them all. Its subclasses AuthenticationError, EntitlementError, and SessionClosedError name three failures you can act on. Every other failure raises MassiveError itself, such as a network error, an HTTP error other than 401 or 403, a rate limit longer than the read waits out, or a bug. The message names what failed, and quotes Massive's text when Massive answered. To branch on the failure, read is_retryable, is_bug, source, or status instead of the message.

A fetch() or history() with wait=True raises the error. Without wait=True, a failure after the call returns fails their table instead, as it fails a live table: the table shows the error, the log records it, and m.streams() lists it. A closed session or a wrong argument still raises at the call.

Example

Catch any MassiveError, and branch on the HTTP status:

import deephaven_massive as dm

m = dm.MassiveSession()
try:
    dividends = m.stocks.dividends(["AAPL", "MSFT"]).fetch(wait=True)
except dm.MassiveError as e:
    if e.status == 429:
        print(f"slow down (request {e.request_id}): {e}")

Create the error.

Parameters:

Name Type Description Default
*args object

The exception's arguments, as for Exception; normally one message.

()
status int | None

The HTTP status of the response the error came from, or None when it did not come from an HTTP response.

None
request_id str | None

The request_id of Massive's response, or None when there was no response or it carried none.

None
source ErrorSource | None

What stopped the call, or None (absent) for the class's default_source, which is ErrorSource.MASSIVE unless a subclass sets another. A LIBRARY error's message is ended with LIBRARY_BUG unless it holds it.

None
is_retryable bool | None

Whether the same call may succeed later, or None (absent) to decide: true for the class's default_is_retryable, a status in RETRYABLE_STATUSES, or a NETWORK source. A bug is never retryable, whatever this says.

None
is_bug bool | None

Whether a defect caused the error, or None (absent) for the class's default_is_bug. A LIBRARY error is a bug whatever this says.

None
Attributes
default_source class-attribute
default_source: ErrorSource = ErrorSource.MASSIVE

The source of an error of this class created without one; a subclass whose every instance has another source sets its own.

default_is_retryable class-attribute
default_is_retryable: bool = False

Whether every error of this class created without is_retryable may succeed later, an answer that means "try again" whatever its status; a subclass of such answers sets it.

default_is_bug class-attribute
default_is_bug: bool = False

Whether an error of this class created without is_bug is a bug; a subclass whose every instance is a user's bug sets it. A LIBRARY error is a bug whatever this says.

status property
status: int | None

The HTTP status of the response behind the error, or None when there was none.

Usually Massive's, such as 404 or 429. A flat file's comes from S3, and a proxy that refused its credentials gives its own 407.

request_id property
request_id: str | None

The request_id of Massive's response, for a support request to Massive, or None.

source property
source: ErrorSource

What stopped the call: Massive, the network, your code or settings, or a bug.

is_retryable property
is_retryable: bool

Whether the same call may succeed if you make it again later.

True for:

  • a rate limit (HTTP 429);
  • a failure on Massive's side (HTTP 500, 502, 503, or 504);
  • no answer (ErrorSource.NETWORK);
  • HTTP 404 on a later page of one symbol's REST read;
  • S3's RequestTimeout on a flat file;
  • a flat file Massive hasn't published yet;
  • a page Massive answered with another adjusted than the call asked for;
  • a poll() cycle in which the library couldn't read any row Massive sent for a symbol, or for dm.ALL, since the next cycle may read them whole.

A fetch() or history() of a watchlist whose every symbol failed is retryable only when every symbol's error is. False for any other HTTP status, an AuthenticationError, an EntitlementError, a SessionClosedError, or a bug.

Before it raises, the library has retried a server failure or a failed connection a few times. A read that Massive keeps refusing fails with a rate-limit error once waiting out the refusals would take longer than:

  • for a call you wait for (wait=True, or opening a stream with append_only() or last_by()): 10 minutes, or 90 seconds inside a console command;
  • for a read that feeds a live table (a fetch() or history() without wait=True, a watchlist's reads after the call returns, a poll() cycle, or a stream's lookups): max_outage in MassiveConfig.

Wait before you call again.

is_bug property
is_bug: bool

Whether a defect caused the error: a bug in the library, or one in your code.

True for every ErrorSource.LIBRARY error; its message says how to report it. True too for a bug in your code that the library caught, such as a watchlist table that failed or an argument that one of the watchlist's symbols doesn't take; its message names the fix. The library logs a bug at ERROR, and any other error below ERROR.

SessionClosedError

SessionClosedError(*args: object, status: int | None = None, request_id: str | None = None, source: ErrorSource | None = None, is_retryable: bool | None = None, is_bug: bool | None = None)

The session is closed, so it reads nothing more.

After m.close(), a query method such as fetch() raises it, and so do m.streams() and a call that the close cut short. A live table that was running when the session closed fails with it. The message says so and names the fix: "This session is closed. Open a new dm.MassiveSession() to read again.". Its source is ErrorSource.USER, and is_retryable is False.

Example
import deephaven_massive as dm

m = dm.MassiveSession()
m.close()
try:
    m.stocks.dividends("AAPL").fetch()
except dm.SessionClosedError:
    m = dm.MassiveSession()

Create the error.

Parameters:

Name Type Description Default
*args object

The exception's arguments, as for Exception; normally one message.

()
status int | None

The HTTP status of the response the error came from, or None when it did not come from an HTTP response.

None
request_id str | None

The request_id of Massive's response, or None when there was no response or it carried none.

None
source ErrorSource | None

What stopped the call, or None (absent) for the class's default_source, which is ErrorSource.MASSIVE unless a subclass sets another. A LIBRARY error's message is ended with LIBRARY_BUG unless it holds it.

None
is_retryable bool | None

Whether the same call may succeed later, or None (absent) to decide: true for the class's default_is_retryable, a status in RETRYABLE_STATUSES, or a NETWORK source. A bug is never retryable, whatever this says.

None
is_bug bool | None

Whether a defect caused the error, or None (absent) for the class's default_is_bug. A LIBRARY error is a bug whatever this says.

None
Attributes
default_is_retryable class-attribute
default_is_retryable: bool = False

Whether every error of this class created without is_retryable may succeed later, an answer that means "try again" whatever its status; a subclass of such answers sets it.

default_is_bug class-attribute
default_is_bug: bool = False

Whether an error of this class created without is_bug is a bug; a subclass whose every instance is a user's bug sets it. A LIBRARY error is a bug whatever this says.

status property
status: int | None

The HTTP status of the response behind the error, or None when there was none.

Usually Massive's, such as 404 or 429. A flat file's comes from S3, and a proxy that refused its credentials gives its own 407.

request_id property
request_id: str | None

The request_id of Massive's response, for a support request to Massive, or None.

source property
source: ErrorSource

What stopped the call: Massive, the network, your code or settings, or a bug.

is_retryable property
is_retryable: bool

Whether the same call may succeed if you make it again later.

True for:

  • a rate limit (HTTP 429);
  • a failure on Massive's side (HTTP 500, 502, 503, or 504);
  • no answer (ErrorSource.NETWORK);
  • HTTP 404 on a later page of one symbol's REST read;
  • S3's RequestTimeout on a flat file;
  • a flat file Massive hasn't published yet;
  • a page Massive answered with another adjusted than the call asked for;
  • a poll() cycle in which the library couldn't read any row Massive sent for a symbol, or for dm.ALL, since the next cycle may read them whole.

A fetch() or history() of a watchlist whose every symbol failed is retryable only when every symbol's error is. False for any other HTTP status, an AuthenticationError, an EntitlementError, a SessionClosedError, or a bug.

Before it raises, the library has retried a server failure or a failed connection a few times. A read that Massive keeps refusing fails with a rate-limit error once waiting out the refusals would take longer than:

  • for a call you wait for (wait=True, or opening a stream with append_only() or last_by()): 10 minutes, or 90 seconds inside a console command;
  • for a read that feeds a live table (a fetch() or history() without wait=True, a watchlist's reads after the call returns, a poll() cycle, or a stream's lookups): max_outage in MassiveConfig.

Wait before you call again.

is_bug property
is_bug: bool

Whether a defect caused the error: a bug in the library, or one in your code.

True for every ErrorSource.LIBRARY error; its message says how to report it. True too for a bug in your code that the library caught, such as a watchlist table that failed or an argument that one of the watchlist's symbols doesn't take; its message names the fix. The library logs a bug at ERROR, and any other error below ERROR.

MassiveSession

MassiveSession(config: MassiveConfig | None = None)

Your connection to Massive: its datasets and the live tables you make from them.

Create a session inside a Deephaven server, in its console or an application script. Its settings come from dm.MassiveConfig. Without one, it reads your API key from MASSIVE_API_KEY.

Each dataset is a method of a namespace, such as m.stocks.bars, and returns a query. A method of the query, such as history() or last_by(), returns a table. A live table updates while anything uses it. m.release(table) drops your variable's hold on one, and m.close() stops them all. In a with block, the session closes when the block ends. See https://github.com/deephaven-examples/deephaven-massive/blob/main/README.md#stop-live-tables.

No public attribute or repr of the session shows your key, so the key stays out of the console's variables.

You can use a session from several threads at once.

Messages name the session by its label, such as MassiveSession #1.

You can open several sessions with the same API key, and they share Massive's limits for that key. They share one request rate, and Massive allows your account one streaming connection per asset class. Sessions share that connection when their streaming settings match, such as websocket_hosts and max_outage. Otherwise each opens its own, and the newer connection takes the older one's place. The live tables on the older one then fail, or reconnect if their session's MassiveConfig.connection_taken is RECONNECT. A WARNING names the clash when you create the second session. A session that no variable holds and that runs no live table closes by itself, with no warning.

Example
import deephaven_massive as dm

m = dm.MassiveSession()
apple = m.stocks.bars("AAPL", dm.Timespan.DAY).history("2026-10-26", "2026-10-30")
streams = m.streams()  # each live table's state and errors
m.close()

Create a session.

Parameters:

Name Type Description Default
config MassiveConfig | None

The session's settings. Leave it out for dm.MassiveConfig(), which reads your keys from the environment.

None

Raises:

Type Description
TypeError

If config isn't a dm.MassiveConfig.

AuthenticationError

If config is left out and MASSIVE_API_KEY isn't set.

ValueError

If: - it runs on a Deephaven update-graph thread, such as inside a table listener; - for the first session of the process, DEEPHAVEN_MASSIVE_LOG isn't a log level name, or either log variable has spaces around it; - config is left out and an environment variable isn't valid, such as a key with spaces around it, or only one of the two MASSIVE_S3_* variables set.

OSError

For the first session of the process, if DEEPHAVEN_MASSIVE_LOG_FILE names a file that can't be opened.

MassiveError

If it runs on a thread with no Deephaven execution context, or in one made by make_user_exec_ctx(freeze_vars=...), which the library can't use.

Attributes
stocks property
stocks: StocksNamespace

US equities: trades, quotes, bars, snapshots, fundamentals, and filings.

options property
options: OptionsNamespace

US options: trades, quotes, bars, chains, snapshots, and contracts.

futures property
futures: FuturesNamespace

US futures: trades, quotes, bars, snapshots, contracts, products, and schedules.

indices property
indices: IndicesNamespace

Indices: values, bars, and snapshots.

forex property
forex: ForexNamespace

Forex: quotes, bars, snapshots, movers, and currency conversion.

crypto property
crypto: CryptoNamespace

Crypto: trades, quotes, bars, fair market value, snapshots, and movers.

reference property
reference: ReferenceNamespace

Reference data: tickers, news, exchanges, conditions, market status, and holidays.

indicators property
indicators: IndicatorsNamespace

Technical indicators: SMA, EMA, RSI, and MACD.

economy property
economy: EconomyNamespace

US economic data: treasury yields, inflation, labor market, and funding conditions.

partners property
partners: PartnersNamespace

Datasets from Massive's partners: benzinga, etf_global, tmx, and fable.

Methods:
snapshots
snapshots(symbols: SymbolsLike, *, sort: str | None = None, order: Order | None = None, limit: int | None = None, filters: Mapping[str, FilterValue] | None = None, on_error: ErrorPolicy | None = None) -> FetchQuery

The current state of tickers of any asset class, from Massive's unified snapshot.

Each row holds one ticker's latest trade, quote, and minute bar, and its session's open, high, low, close, and change. An option's row adds its greeks, implied volatility, and open interest. A column of another asset class is null. A ticker Massive doesn't know gets no row, and m.problems() lists it as unavailable_symbols. One your plan doesn't cover gets no row either, and m.problems() lists it as refused_symbols with Massive's answer. One Massive answers with an error its documentation doesn't list gets no row either, listed as undocumented_errors with Massive's answer.

Parameters:

Name Type Description Default
symbols SymbolsLike

Tickers of any asset class, such as ["AAPL", "X:BTCUSD", "I:SPX"]. dm.ALL is refused; use one class's snapshots(dm.ALL) instead.

required
sort str | None

The field to sort by, such as "ticker". Massive sorts each request of up to 250 tickers on its own, so a longer list isn't sorted as a whole.

None
order Order | None

The direction of sort.

None
limit int | None

The most rows to return, in total. A watchlist's fetch() caps every request instead.

None
filters Mapping[str, FilterValue] | None

Further endpoint parameters, except type, which Massive refuses beside tickers.

None
on_error ErrorPolicy | None

What a bad symbol or row does in this call (dm.ErrorPolicy). None, the default, takes each cause from the session's MassiveConfig.on_error.

None

Returns:

Type Description
FetchQuery

Raises:

Type Description
TypeError

If an argument has the wrong type.

ValueError

If: - symbols is None, dm.ALL, or empty; - a ticker isn't Massive's exact ticker, or a table has no Symbol column; - limit isn't positive; - filters holds type, a key the endpoint doesn't take, or a value that doesn't fit.

Example
mixed = m.snapshots(["AAPL", "C:EURUSD", "X:BTCUSD", "I:SPX"]).fetch()
connections
connections() -> Table

Return a live table of the session's streaming connections to Massive.

Look here when a stream gets no data. Each row says whether a connection is up, whether its data is real-time or delayed, and its last error. A connection that another session with the same key shares shows in both sessions' tables. The table also has a REST row for each asset class and kind of data whose feed the session has found. Each call returns a new table, which keeps its final rows after close(). What to do about each state: https://github.com/deephaven-examples/deephaven-massive/blob/main/docs/troubleshooting.md#diagnostics.

Returns:

Type Description
Table

A live table keyed by Transport, AssetClass, and Family, with these columns:

  • Host and Path: where the connection goes.
  • Recency: REALTIME, DELAYED, or UNKNOWN. UNKNOWN means the library can't tell, and it never treats such data as real-time.
  • Evidence: what showed the library that recency.
  • State: RESOLVING, WAITING, CONNECTING, CONNECTED, WAITING_SLOT, RECONNECTING, FAILED, or CLOSED. WAITING means the library hasn't connected, because no live table on the connection has a symbol to stream yet. It connects at the first symbol.
  • Topics, ConfirmedTopics, PendingTopics, and UnconfirmedTopics: the subscriptions sent, confirmed by Massive, waiting for confirmation, and never confirmed.
  • BufferedRows: rows waiting to reach their tables. Past 1,000,000, a WARNING is logged.
  • Reconnects, LastMessageAt, NextReconnectAt, UpdatedAt, and LastError. LastError is the latest error. A WebSocket connection keeps it after it reconnects.

A connection's problems, such as an outage, are rows of m.problems(), one for each live table on it.

Raises:

Type Description
SessionClosedError

If the session is closed.

MassiveError

If the session's diagnostics tables failed when their writer thread died.

streams
streams() -> Table

Return a live table of the session's streams, polls, and background reads.

Start here when a live table looks wrong. Each row is one stream, poll() table, or background read. The tables of identical queries share one stream and one row. Each call returns a new table, which keeps its final rows after close(). What to do about each state: https://github.com/deephaven-examples/deephaven-massive/blob/main/docs/troubleshooting.md#diagnostics.

Returns:

Type Description
Table

A live table keyed by StreamId, with these columns:

  • Kind: stream for a stream method's table, and poll for a poll() table. read is a history() or fetch() that reads in the background (without wait=True) or follows a watchlist.
  • Dataset: the dataset's name, such as stocks.trades.
  • Query: the call that built the query, such as m.stocks.trades('AAPL').
  • Symbols: the symbols it reads now; empty for a dataset that takes none.
  • SymbolCount: how many symbols it reads; null for dm.ALL and for a dataset that takes none.
  • HeldResults: how many of the stream's tables are still in use.
  • Deferred: how many option contracts wait for room on the options connection.
  • Transport: WebSocket, REST, flat files, or flat files and REST.
  • Host and Path: where a stream connects.
  • Recency: REALTIME, DELAYED, or UNKNOWN. UNKNOWN means the library can't tell, and it never treats such data as real-time. The column is null for a background read and for reference, economy, and partner data.
  • RowsPublished: how many rows it has delivered.
  • Loading: how many symbols a watchlist's read has yet to read.
  • RequestsPerCycle: the REST requests of the latest poll.
  • State: RUNNING, LOADING, DONE, FAILED, RELEASED, or CLOSED.
  • Error: why it failed or closed; null while it runs.
  • CreatedAt: when it started.

The problems of a table that keeps running, such as rows the library withheld or an outage, are rows of m.problems() with its StreamId.

Raises:

Type Description
SessionClosedError

If the session is closed.

MassiveError

If the session's diagnostics tables failed when their writer thread died.

rate_limits
rate_limits() -> Table

Return a live table of Massive's REST request limits, one row per subscription.

Massive may limit each subscription's REST requests per minute, at a number your plan sets. The limit counts every request your account makes, from every key and session. Each row is one subscription, or other for the datasets Massive assigns to none. Sessions in this server that use the same key share these rows. Each call returns a new table, which keeps its final rows after close(). What to do about each state: https://github.com/deephaven-examples/deephaven-massive/blob/main/docs/troubleshooting.md#diagnostics.

Returns:

Type Description
Table

A live table keyed by Bucket, which is stocks, options, indices, currencies, futures, or other. It has these columns:

  • State: READY; PACED, to fit a known limit; or PAUSED until PausedUntil, after Massive refused a request for coming too fast.
  • RequestsPerMinute: the limit the library keeps to; null until one is known.
  • LimitSource: DECLARED, from MassiveConfig.rest_requests_per_minute, or LEARNED, from the requests Massive answered in the minute it refused one.
  • InFlight, Waiting, RecentRequests (in the last 61 seconds), Attempts, and Refusals.
  • PausedUntil, LastRefusal, and UpdatedAt.

Raises:

Type Description
SessionClosedError

If the session is closed.

MassiveError

If the session's diagnostics tables failed when their writer thread died.

symbol_reads
symbol_reads() -> Table

Return a live table of each symbol of each history() or fetch() of a watchlist.

A history() or fetch() of a watchlist reads each symbol you add and drops each one you delete. This table shows each symbol's read, so you can find the ones that failed and why.

A read that fails with a temporary error, such as a rate limit or a network error, is RETRYING. It's tried again 2, 8, and 30 seconds later, then every minute. It's FAILED once it has failed for MassiveConfig.max_outage seconds. Any other failure is FAILED at once. To read a failed symbol again, delete its row from the watchlist and add it back.

The rows stay for the session's life. Each call returns a new table, which keeps its final rows after close(). What to do about each state: https://github.com/deephaven-examples/deephaven-massive/blob/main/docs/troubleshooting.md#diagnostics.

Returns:

Type Description
Table

A live table keyed by StreamId and Symbol, with these columns:

  • StreamId: the result's row in m.streams().
  • Dataset: the dataset's name.
  • State: QUEUED, LOADING, RETRYING, DONE, FAILED, REMOVED, STOPPED, or CLOSED. DONE can mean 0 rows, when Massive has no data for the symbol. REMOVED means its row left the watchlist, and STOPPED that the result was released.
  • Transport: REST, flat files, or flat files and REST when some days' files were missing. A futures read that skipped exchanges Massive refused, under refused_venues, names them: flat files without NYMEX (refused).
  • AddedAt: when its row last joined the watchlist.
  • ReadAt: when the download behind its rows began.
  • Rows: its rows in the result.
  • Attempts: reads started since it was last added.
  • NextAttemptAt: the next try, while it's RETRYING.
  • Error: its latest failure, with the HTTP status, path, and request_id. Once a read succeeds, it's null, unless the library skipped the symbol: a crypto pair whose ticker it can't read from Massive's crypto ticker list is DONE with no rows, and Error says why.
  • UpdatedAt: when the row last changed.

Raises:

Type Description
SessionClosedError

If the session is closed.

MassiveError

If the session's diagnostics tables failed when their writer thread died.

Example
failed = m.symbol_reads().where("State = `FAILED`")
problems
problems() -> Table

Return a live table of every problem with the session's data feed.

Start here when a table looks wrong. Each row is one problem of one table: rows the library left out because it couldn't read them whole, a watchlist value that isn't Massive's ticker, a symbol Massive has no data for, a connection outage, a rate-limit pause, a failed table. Rows of a problem that happens again add up in place. A problem that lasts, such as an outage or a skipped watchlist value, is a span: its row gets an EndedAt when it clears, such as when you fix or delete the watchlist row. Valid data is never a problem: a null Massive sent, or a symbol with no rows in the range, has no row here. The rows stay for the session's life. Each call returns a new table, which keeps its final rows after close(). Every cause, and what to do about it: https://github.com/deephaven-examples/deephaven-massive/blob/main/docs/troubleshooting.md#problem-causes.

Returns:

Type Description
Table

A live table keyed by StreamId, Cause, Symbol, Field, and SpanStart, with these columns:

  • FirstSeen and LastSeen: when the problem first and last happened.
  • SpanStart: when a span began; null for a problem that is no span.
  • EndedAt: when a span ended; null while it lasts, and for a problem that is no span.
  • Dataset: the dataset's name, such as stocks.trades; null for a rate-limit pause, which is the session's.
  • StreamId: the table's row in m.streams(), or a wait=True read's own id.
  • Query: the call that made the table, such as m.stocks.trades('AAPL').
  • Symbol: the symbol the problem concerns, as Massive sent it or you gave it.
  • Field: the column or field the problem concerns. For a flat-file line, the file; for a rate-limit pause, its Bucket in m.rate_limits(); for a refused exchange, its name.
  • Cause: why, such as unconvertible_values or outage. A cause named for an dm.ErrorPolicy setting follows that setting. A value dm.canonicalize_symbols couldn't convert follows that call's on_error instead.
  • Action: what the library did: WITHHELD rows of Massive's data, SKIPPED a symbol, exchange, or file line, FAILED, GAP (rows may be missing over the span), DELAYED (rows come late), PUBLISHED (rows published without a field Massive's documentation lacks), or OVERFLOW: the problems of a cause past the 10,000 rows one table keeps of it, or past 1,000 in one batch of rows, added up in one row.
  • Rows: the rows it counts: rows withheld, lines skipped, or contracts deferred.
  • Occurrences: how many times it happened.
  • Policy: the setting of its cause that applied, log, ignore, or raise; null for a cause with no setting.
  • Source: whose problem it is: massive, user for your input, or library.
  • Detail: what happened, with the value, Massive's answer, or the reason.

Raises:

Type Description
SessionClosedError

If the session is closed.

MassiveError

If the session's diagnostics tables failed when their writer thread died.

Example
problems = m.problems()
lasting = problems.where("!isNull(SpanStart) && isNull(EndedAt)")
per_table = m.streams().natural_join(
    problems.count_by("Problems", "StreamId"), "StreamId"
)
release
release(table: Table) -> None

Release one live table now, instead of waiting for Python to reclaim it.

The table stops updating once nothing else uses it, such as a table made from it or a panel open in the Deephaven IDE. Its poll or background read then stops. Its stream unsubscribes once no other table of the stream is in use. In a console command, the release takes effect when the command ends. Releasing a table twice does nothing, and release() works after close(). A static table needs no release. See https://github.com/deephaven-examples/deephaven-massive/blob/main/README.md#stop-live-tables.

Parameters:

Name Type Description Default
table Table

A live table that a query method of this session returned. For a table made from one, release the table it came from.

required

Raises:

Type Description
TypeError

If table isn't a Deephaven Table.

ValueError

If table isn't a live table of this session: a static table, or a refreshing table that is derived from a live table or belongs to another session.

close
close() -> None

Stop every live table of the session. Calling it again does nothing.

Each live table, and each table made from one, fails with MassiveError("This session was closed, so this table no longer updates. Open a new dm.MassiveSession() to read again."). It keeps its rows, and t.snapshot() gives a static copy to keep working with. In a console command, close() returns at once. The tables show their final state when the command ends.

Connections that no other session uses are closed. Afterward, the query methods and the diagnostics methods, such as m.streams(), raise MassiveError. Building queries and release() still work. See https://github.com/deephaven-examples/deephaven-massive/blob/main/README.md#stop-live-tables.

Raises:

Type Description
ValueError

If called on a Deephaven update-graph thread, such as inside a table listener.

Example
trades = m.stocks.trades("AAPL").append_only()
m.close()
kept = trades.snapshot()  # a static copy of the rows received before the close

Functions:

datasets

datasets() -> Table

List every dataset the library serves, one row each, as a static table.

Use it to find a dataset without reading the namespaces one by one: filter it in the console, or open a row's Documentation link for its columns and plans. It reads only the dataset catalog, which exists once the library is imported, so it needs no session and no API key and makes no network call.

Returns:

Type Description
Table

A static table, in the order the namespaces declare their datasets, with the columns Dataset (String, such as stocks.trades), Call (String, how a session m reaches it, such as m.stocks.trades), Summary (String, one sentence), Methods (String[], the methods its queries have, in the order fetch, poll, blink, append_only, ring, last_by, history; a bars dataset lists history, then each stream method with the bars it works for, such as blink (1-second and 1-minute bars at multiplier=1)), Transports (String[], where the library reads it from, spelled REST, flat files, and WebSocket, as columns() spells them), and Documentation (String, the web address of its page of the dataset reference). Each column carries a description, shown as its tooltip in the Deephaven IDE.

Example
import deephaven_massive as dm

catalog = dm.datasets()
streams = catalog.where("Arrays.asList(Methods).contains(`blink`)")
news = catalog.where("Summary.toLowerCase().contains(`news`)")

canonical_symbol

canonical_symbol(text: str | None, asset_class: AssetClass, *, convention: SymbolConvention = SymbolConvention.MASSIVE, on_error: OnError = OnError.RAISE) -> str | None

Convert a symbol of a named asset class to Massive's exact REST ticker.

Use it to turn symbols from another source into the form every dataset takes and every Symbol column holds, before passing them as symbols=. Under SymbolConvention.MASSIVE, the default, canonical text comes back unchanged; another spelling of the class converts (EUR/USD to C:EURUSD, SPX to I:SPX); anything else raises. Under another convention, only that convention's grammar applies, so text it does not spell raises even when it happens to be a Massive ticker. For futures, a single contract (ESZ5) or a spread in one of Massive's spellings (GCQ6-GCZ6) comes back unchanged and anything else raises, with the message of canonical_symbol_future; a futures dataset's symbols take the same two forms. The class is never guessed: SPX is an index only because the caller says so. Text that does not convert does what on_error says: raises, the default, or comes back as None with one log record per distinct value, so a column of mixed spellings in Python can be converted without failing on the first bad one. The same verdict and on_error apply to every row of dm.canonicalize_symbols. A Deephaven query string passes positional arguments only: call a convention's function (canonical_symbol_stock_yahoo), or give on_error= through a functools.partial of the function, imported under a bare name. A function called through the module (dm.canonical_symbol(...)) makes an Object column unless cast with (String). Thread-safe.

Example
import deephaven_massive as dm

dm.canonical_symbol("EUR/USD", dm.AssetClass.FOREX)  # 'C:EURUSD'
dm.canonical_symbol(
    "BRK-B", dm.AssetClass.STOCKS, convention=dm.SymbolConvention.YAHOO
)  # 'BRK.B'

Parameters:

Name Type Description Default
text str | None

The symbol, or None.

required
asset_class AssetClass

The symbol's class, whose rules apply. Required: nothing is inferred.

required
convention SymbolConvention

The convention the text comes from. SymbolConvention.MASSIVE, the default, accepts Massive's own spelling and the unambiguous spellings of the class; YAHOO, NASDAQ, and CMS, for stocks only, convert from that convention's grammar alone. A stock ticker converts only from a named convention, because - means a class in Yahoo's and a preferred in Nasdaq's.

MASSIVE
on_error OnError

What text that does not convert does. OnError.RAISE, the default, raises ValueError; OnError.LOG returns None and logs the value once at WARNING, at most LOGGED_VALUES values a process; OnError.IGNORE returns None and logs it at DEBUG only.

RAISE

Returns:

Type Description
str | None

The canonical ticker; None for None, or, under OnError.LOG and IGNORE, for text that does not convert.

Raises:

Type Description
TypeError

If asset_class is not a dm.AssetClass, convention is not a dm.SymbolConvention, on_error is not a dm.OnError, or text is neither a str nor None.

ValueError

If convention is a stock convention and the class is not stocks, or, under OnError.RAISE, the default, if the text is not a symbol of the class in any accepted spelling. The message gives the reason and, where one exists, the fix: a ticker with another class's prefix names that class's function.

canonical_symbol_crypto

canonical_symbol_crypto(text: str | None, *, on_error: OnError = OnError.RAISE) -> str | None

Convert a crypto pair to Massive's ticker: BTC-USD to X:BTCUSD.

Accepts BTC-USD, BTC/USD, and BTCUSD, with or without X:, in any case, whatever the quote currency, and joins the two codes; any such ticker is canonical. A stream, the last-trade path, and the daily open/close path need the pair split into its two codes, and take the split only from Massive's crypto ticker list, so they refuse a pair that list does not hold; every other verb takes any pair. Thread-safe.

In a Deephaven query string, import it by bare name (from deephaven_massive import canonical_symbol_crypto) for a String column; called through the module it makes an Object column unless cast: (String) dm.canonical_symbol_crypto(Col).

Parameters:

Name Type Description Default
text str | None

The pair, or None.

required
on_error OnError

What text that does not convert does. OnError.RAISE, the default, raises ValueError; OnError.LOG returns None and logs the value once at WARNING, at most LOGGED_VALUES values a process; OnError.IGNORE returns None and logs it at DEBUG only. A query string passes positional arguments only, so there a bad value fails the whole formula unless the function is in scope as a functools.partial that binds on_error (lenient = partial(canonical_symbol_crypto, on_error=dm.OnError.LOG), then lenient(Ticker)); dm.canonicalize_symbols converts a whole table.

RAISE

Returns:

Type Description
str | None

X: and the joined pair, or None for None or, under OnError.LOG and IGNORE, for text that does not convert.

Raises:

Type Description
TypeError

If text is neither a str nor None, or on_error is not a dm.OnError.

ValueError

Under OnError.RAISE, the default, if the text is not a pair of letters and digits, is too short to hold a base and a three-letter quote (BTC names one currency, not a pair), or carries another class's prefix (C: is forex).

canonical_symbol_forex

canonical_symbol_forex(text: str | None, *, on_error: OnError = OnError.RAISE) -> str | None

Convert a currency pair to Massive's forex ticker: EUR/USD to C:EURUSD.

Accepts EUR/USD, EUR-USD, and EURUSD, with or without C:, in any case. Thread-safe.

Example
from deephaven import new_table
from deephaven.column import string_col

from deephaven_massive import canonical_symbol_forex

pairs = new_table([string_col("Pair", ["EUR/USD", "GBP-USD"])])
pairs = pairs.update(["Symbol = canonical_symbol_forex(Pair)"])

In a Deephaven query string, import it by bare name (from deephaven_massive import canonical_symbol_forex) for a String column; called through the module it makes an Object column unless cast: (String) dm.canonical_symbol_forex(Col).

Parameters:

Name Type Description Default
text str | None

The pair, or None.

required
on_error OnError

What text that does not convert does. OnError.RAISE, the default, raises ValueError; OnError.LOG returns None and logs the value once at WARNING, at most LOGGED_VALUES values a process; OnError.IGNORE returns None and logs it at DEBUG only. A query string passes positional arguments only, so there a bad value fails the whole formula unless the function is in scope as a functools.partial that binds on_error (lenient = partial(canonical_symbol_forex, on_error=dm.OnError.LOG), then lenient(Ticker)); dm.canonicalize_symbols converts a whole table.

RAISE

Returns:

Type Description
str | None

C: and the two codes, or None for None or, under OnError.LOG and IGNORE, for text that does not convert.

Raises:

Type Description
TypeError

If text is neither a str nor None, or on_error is not a dm.OnError.

ValueError

Under OnError.RAISE, the default, if the text is not two three-letter codes, or carries another class's prefix (X: is crypto). Yahoo Finance's spelling, EURUSD=X, is refused with a message that shows Massive's form: nothing is guessed from another vendor's grammar.

canonical_symbol_future

canonical_symbol_future(text: str | None, *, on_error: OnError = OnError.RAISE) -> str | None

Check a single futures contract ticker, which Massive's text is exactly: ESZ5.

A contract ticker is a root of upper-case letters and digits, a month code, and one to three digits, taken as written: nothing is converted or re-cased. Most contracts end in a one- or two-digit year (ESZ5, NGZ26), and daily contracts in three digits (0AF704, GCBX602). A spread is refused with the function that takes it (canonical_symbol_future_spread). Beware the year: Massive writes it with one digit for most products (ESZ5 is December 2025) and with two for some (NGZ26, 0NGH39), so ESZ25 is not ESZ5. Thread-safe.

In a Deephaven query string, import it by bare name (from deephaven_massive import canonical_symbol_future) for a String column; called through the module it makes an Object column unless cast: (String) dm.canonical_symbol_future(Col).

Parameters:

Name Type Description Default
text str | None

The contract ticker, or None.

required
on_error OnError

What text that does not convert does. OnError.RAISE, the default, raises ValueError; OnError.LOG returns None and logs the value once at WARNING, at most LOGGED_VALUES values a process; OnError.IGNORE returns None and logs it at DEBUG only. A query string passes positional arguments only, so there a bad value fails the whole formula unless the function is in scope as a functools.partial that binds on_error (lenient = partial(canonical_symbol_future, on_error=dm.OnError.LOG), then lenient(Ticker)); dm.canonicalize_symbols converts a whole table.

RAISE

Returns:

Type Description
str | None

The ticker unchanged, or None for None or, under OnError.LOG and IGNORE, for text that does not convert.

Raises:

Type Description
TypeError

If text is neither a str nor None, or on_error is not a dm.OnError.

ValueError

Under OnError.RAISE, the default, if the text is a combo, or not a root, a month code, and one to three digits.

canonical_symbol_future_spread

canonical_symbol_future_spread(text: str | None, *, on_error: OnError = OnError.RAISE) -> str | None

Check a futures combo ticker, exactly as Massive writes it: GCQ6-GCZ6, BOB 02-01 U6.

Any combo (spread, strip, pack, or bundle) Massive writes is accepted: runs of upper-case letters and digits joined by single -, :, or spaces (GCQ6-GCZ6, BOB 02-01 U6, CL:BF Q6-U6-V6, 6A:XF:AUDUSD:Q6). Massive documents no grammar for combos, so the shape is checked rather than a list of forms. Canonical text comes back unchanged; no ticker is built from its legs. A single contract is refused with canonical_symbol_future. Thread-safe.

In a Deephaven query string, import it by bare name (from deephaven_massive import canonical_symbol_future_spread) for a String column; called through the module it makes an Object column unless cast: (String) dm.canonical_symbol_future_spread(Col).

Parameters:

Name Type Description Default
text str | None

The spread ticker, or None.

required
on_error OnError

What text that does not convert does. OnError.RAISE, the default, raises ValueError; OnError.LOG returns None and logs the value once at WARNING, at most LOGGED_VALUES values a process; OnError.IGNORE returns None and logs it at DEBUG only. A query string passes positional arguments only, so there a bad value fails the whole formula unless the function is in scope as a functools.partial that binds on_error (lenient = partial(canonical_symbol_future_spread, on_error=dm.OnError.LOG), then lenient(Ticker)); dm.canonicalize_symbols converts a whole table.

RAISE

Returns:

Type Description
str | None

The ticker unchanged, or None for None or, under OnError.LOG and IGNORE, for text that does not convert.

Raises:

Type Description
TypeError

If text is neither a str nor None, or on_error is not a dm.OnError.

ValueError

Under OnError.RAISE, the default, if the text is a single contract, or not in Massive's combo shape (the message describes it).

canonical_symbol_index

canonical_symbol_index(text: str | None, *, on_error: OnError = OnError.RAISE) -> str | None

Convert an index ticker to Massive's: SPX to I:SPX.

The prefix is added because the caller names the class by calling this function; no ticker is ever recognized as an index by its name. Case is kept. Thread-safe.

In a Deephaven query string, import it by bare name (from deephaven_massive import canonical_symbol_index) for a String column; called through the module it makes an Object column unless cast: (String) dm.canonical_symbol_index(Col).

Parameters:

Name Type Description Default
text str | None

The index ticker, with or without I:, or None.

required
on_error OnError

What text that does not convert does. OnError.RAISE, the default, raises ValueError; OnError.LOG returns None and logs the value once at WARNING, at most LOGGED_VALUES values a process; OnError.IGNORE returns None and logs it at DEBUG only. A query string passes positional arguments only, so there a bad value fails the whole formula unless the function is in scope as a functools.partial that binds on_error (lenient = partial(canonical_symbol_index, on_error=dm.OnError.LOG), then lenient(Ticker)); dm.canonicalize_symbols converts a whole table.

RAISE

Returns:

Type Description
str | None

I: and the ticker, or None for None or, under OnError.LOG and IGNORE, for text that does not convert.

Raises:

Type Description
TypeError

If text is neither a str nor None, or on_error is not a dm.OnError.

ValueError

Under OnError.RAISE, the default, if the text is not an index ticker or carries another class's prefix.

canonical_symbol_option

canonical_symbol_option(text: str | None, *, on_error: OnError = OnError.RAISE) -> str | None

Convert an OCC option symbol to Massive's: AAPL250117C00150000 to O:AAPL250117C00150000.

Accepts the symbol with or without O: and the 21-character OSI form whose root is padded with spaces, in any case. The root is never changed: SPXW stays SPXW and an adjusted root such as AAPL1 stays AAPL1. Thread-safe.

In a Deephaven query string, import it by bare name (from deephaven_massive import canonical_symbol_option) for a String column; called through the module it makes an Object column unless cast: (String) dm.canonical_symbol_option(Col).

Parameters:

Name Type Description Default
text str | None

The option symbol, or None.

required
on_error OnError

What text that does not convert does. OnError.RAISE, the default, raises ValueError; OnError.LOG returns None and logs the value once at WARNING, at most LOGGED_VALUES values a process; OnError.IGNORE returns None and logs it at DEBUG only. A query string passes positional arguments only, so there a bad value fails the whole formula unless the function is in scope as a functools.partial that binds on_error (lenient = partial(canonical_symbol_option, on_error=dm.OnError.LOG), then lenient(Ticker)); dm.canonicalize_symbols converts a whole table.

RAISE

Returns:

Type Description
str | None

O: and the OCC symbol, or None for None or, under OnError.LOG and IGNORE, for text that does not convert.

Raises:

Type Description
TypeError

If text is neither a str nor None, or on_error is not a dm.OnError.

ValueError

Under OnError.RAISE, the default, if the text is no OCC symbol with a real expiry date (an underlying such as AAPL is named as one), or carries another class's prefix.

canonical_symbol_stock

canonical_symbol_stock(text: str | None, *, on_error: OnError = OnError.RAISE) -> str | None

Check a stock ticker in Massive's own spelling, for Python code and query strings.

Massive's spelling is the only one accepted: a ticker from Yahoo, Nasdaq, or a CMS feed goes through the function of its convention (canonical_symbol_stock_yahoo), because the same - means a class in one and a preferred in another. Thread-safe.

Example
from deephaven import new_table
from deephaven.column import string_col

from deephaven_massive import canonical_symbol_stock

t = new_table([string_col("Ticker", ["AAPL", "KIMpL"])])
t = t.update(["Symbol = canonical_symbol_stock(Ticker)"])

In a Deephaven query string, import it by bare name (from deephaven_massive import canonical_symbol_stock) for a String column; called through the module it makes an Object column unless cast: (String) dm.canonical_symbol_stock(Col).

Parameters:

Name Type Description Default
text str | None

The ticker, or None.

required
on_error OnError

What text that does not convert does. OnError.RAISE, the default, raises ValueError; OnError.LOG returns None and logs the value once at WARNING, at most LOGGED_VALUES values a process; OnError.IGNORE returns None and logs it at DEBUG only. A query string passes positional arguments only, so there a bad value fails the whole formula unless the function is in scope as a functools.partial that binds on_error (lenient = partial(canonical_symbol_stock, on_error=dm.OnError.LOG), then lenient(Ticker)); dm.canonicalize_symbols converts a whole table.

RAISE

Returns:

Type Description
str | None

The ticker unchanged, or None for None or, under OnError.LOG and IGNORE, for text that does not convert.

Raises:

Type Description
TypeError

If text is neither a str nor None, or on_error is not a dm.OnError.

ValueError

Under OnError.RAISE, the default, if the text is not a Massive stock ticker; the message names the conventions for text with their separators, and the upper-case form for lower-case text.

canonical_symbol_stock_cms

canonical_symbol_stock_cms(text: str | None, *, on_error: OnError = OnError.RAISE) -> str | None

Convert a CMS stock ticker to Massive's: BRK B to BRK.B, BAC PRL to BACpL.

The CMS convention (the root, a space, and a suffix, as many broker and FIX systems write it) spells a class as X and a preferred as PR and its optional series. Its other suffixes (WS, U, RT, WI) are refused, since Massive documents no spelling for them. Thread-safe.

In a Deephaven query string, import it by bare name (from deephaven_massive import canonical_symbol_stock_cms) for a String column; called through the module it makes an Object column unless cast: (String) dm.canonical_symbol_stock_cms(Col).

Parameters:

Name Type Description Default
text str | None

The CMS ticker, or None.

required
on_error OnError

What text that does not convert does. OnError.RAISE, the default, raises ValueError; OnError.LOG returns None and logs the value once at WARNING, at most LOGGED_VALUES values a process; OnError.IGNORE returns None and logs it at DEBUG only. A query string passes positional arguments only, so there a bad value fails the whole formula unless the function is in scope as a functools.partial that binds on_error (lenient = partial(canonical_symbol_stock_cms, on_error=dm.OnError.LOG), then lenient(Ticker)); dm.canonicalize_symbols converts a whole table.

RAISE

Returns:

Type Description
str | None

Massive's ticker, or None for None or, under OnError.LOG and IGNORE, for text that does not convert. Only the convention's grammar is read: text it does not spell is refused even when it is a Massive ticker.

Raises:

Type Description
TypeError

If text is neither a str nor None, or on_error is not a dm.OnError.

ValueError

Under OnError.RAISE, the default, if the text is not a plain, class, or preferred CMS ticker.

canonical_symbol_stock_nasdaq

canonical_symbol_stock_nasdaq(text: str | None, *, on_error: OnError = OnError.RAISE) -> str | None

Convert a Nasdaq Integrated Platform stock ticker to Massive's: KIM-L to KIMpL.

Nasdaq's own symbology (the "NASDAQ Symbol" column of nasdaqtraded.txt) writes a class as .X and a preferred as - and its optional series. Its other suffixes (+ warrants, = units, ^ rights, # when issued) are refused, since Massive documents no spelling for them. The ACT symbology of the same files writes .W for warrants and .V for both a class and when-issued, so it is ambiguous and not supported. Thread-safe.

In a Deephaven query string, import it by bare name (from deephaven_massive import canonical_symbol_stock_nasdaq) for a String column; called through the module it makes an Object column unless cast: (String) dm.canonical_symbol_stock_nasdaq(Col).

Parameters:

Name Type Description Default
text str | None

The Nasdaq ticker, or None.

required
on_error OnError

What text that does not convert does. OnError.RAISE, the default, raises ValueError; OnError.LOG returns None and logs the value once at WARNING, at most LOGGED_VALUES values a process; OnError.IGNORE returns None and logs it at DEBUG only. A query string passes positional arguments only, so there a bad value fails the whole formula unless the function is in scope as a functools.partial that binds on_error (lenient = partial(canonical_symbol_stock_nasdaq, on_error=dm.OnError.LOG), then lenient(Ticker)); dm.canonicalize_symbols converts a whole table.

RAISE

Returns:

Type Description
str | None

Massive's ticker, or None for None or, under OnError.LOG and IGNORE, for text that does not convert. Only the convention's grammar is read: text it does not spell is refused even when it is a Massive ticker.

Raises:

Type Description
TypeError

If text is neither a str nor None, or on_error is not a dm.OnError.

ValueError

Under OnError.RAISE, the default, if the text is not a plain, class, or preferred Nasdaq ticker.

canonical_symbol_stock_yahoo

canonical_symbol_stock_yahoo(text: str | None, *, on_error: OnError = OnError.RAISE) -> str | None

Convert a Yahoo Finance stock ticker to Massive's: BRK-B to BRK.B, BAC-PL to BACpL.

Yahoo writes a share class as -X and a preferred as -P and its series. Only plain tickers, classes, and preferreds with a series convert: Yahoo's bare -P is refused (a generic preferred and class P read alike), and warrants (-WT), units (-UN), and rights (-RI) are refused, since Massive documents no spelling for them, and so is a ticker with a dot, Yahoo's mark of a listing outside the US (VOD.L). Thread-safe.

In a Deephaven query string, import it by bare name (from deephaven_massive import canonical_symbol_stock_yahoo) for a String column; called through the module it makes an Object column unless cast: (String) dm.canonical_symbol_stock_yahoo(Col).

Parameters:

Name Type Description Default
text str | None

The Yahoo ticker, or None.

required
on_error OnError

What text that does not convert does. OnError.RAISE, the default, raises ValueError; OnError.LOG returns None and logs the value once at WARNING, at most LOGGED_VALUES values a process; OnError.IGNORE returns None and logs it at DEBUG only. A query string passes positional arguments only, so there a bad value fails the whole formula unless the function is in scope as a functools.partial that binds on_error (lenient = partial(canonical_symbol_stock_yahoo, on_error=dm.OnError.LOG), then lenient(Ticker)); dm.canonicalize_symbols converts a whole table.

RAISE

Returns:

Type Description
str | None

Massive's ticker, or None for None or, under OnError.LOG and IGNORE, for text that does not convert. Only the convention's grammar is read: text it does not spell is refused even when it is a Massive ticker.

Raises:

Type Description
TypeError

If text is neither a str nor None, or on_error is not a dm.OnError.

ValueError

Under OnError.RAISE, the default, if the text is not a plain, class, or preferred Yahoo ticker.

disable_debug_logging

disable_debug_logging() -> None

Turn the library's log off again, whichever switch turned it on and at whatever level.

Call it once a bug report has its lines, or to quiet a console after enable_debug_logging() or DEEPHAVEN_MASSIVE_LOG. It logs one INFO line saying the log is off, removes the output either switch added, and sets the deephaven_massive logger's level back to NOTSET. WARNING and ERROR records then reach stderr through Python's last-resort handler, as they do at import, and lower levels are dropped. A handler you added yourself stays, but the logger's level goes back to NOTSET even if you set it. A later first session doesn't turn the log back on from the environment variables; enable_debug_logging() does. With the log already off, it changes nothing.

Example
import deephaven_massive as dm

dm.enable_debug_logging()
# ... run the failing code, save the lines ...
dm.disable_debug_logging()

enable_debug_logging

enable_debug_logging(output: LogOutput | str | PathLike[str] = LogOutput.STDERR) -> None

Send every record of the library, DEBUG and up, to stderr or to a file.

Call it from a Deephaven console when something goes wrong, run the failing code again, and attach the lines to the bug report: they hold what the library decided and why, the requests it made with their status and request_id, and the values it could not read. They never hold the API key or the S3 secret.

It sets the deephaven_massive logger to DEBUG and logs one INFO line describing the environment. A second call replaces the first one's output. Once you call it, the environment variable DEEPHAVEN_MASSIVE_LOG no longer applies.

A file that cannot be opened for appending raises its OSError (from open), and the previous handler, if any, stays.

Parameters:

Name Type Description Default
output LogOutput | str | PathLike[str]

LogOutput.STDERR (the default) for sys.stderr as it is at the call, or a file to append the lines to, in UTF-8, created if missing.

STDERR

Raises:

Type Description
TypeError

If output is neither a LogOutput nor a path.

Example
import deephaven_massive as dm

dm.enable_debug_logging()  # or dm.enable_debug_logging("/tmp/massive.log")
m = dm.MassiveSession()
t = m.stocks.last_trade(["AAPL"]).fetch()  # its requests are now in the log

canonicalize_symbols

canonicalize_symbols(table: Table, asset_class: AssetClass, *, column: str = 'Symbol', convention: SymbolConvention = SymbolConvention.MASSIVE, on_error: OnError = OnError.LOG) -> Table

Return a table whose symbol column holds Massive's exact tickers, converted row by row.

Use it to turn a watchlist written in another ticker format (EUR/USD, Yahoo's BRK-B) into one you can pass as symbols=. Each row converts as dm.canonical_symbol(value, asset_class, convention=convention) would. A null stays null. The current rows convert when you call. On a live table, each row added or changed later converts as it arrives.

By default, a value that doesn't convert gets a null symbol. Every query skips a null symbol, so one such value never stops your table.

A query that reads the returned table lists each such value in m.problems() under the cause noncanonical_symbols. A table you make from the returned one, with where or rename_columns, doesn't list them, so filter or rename before you convert.

Set on_error=dm.OnError.RAISE to fail instead. A value in the current rows then raises ValueError from this call. A row added later with such a value fails the returned table and every live table that reads it as symbols=.

Example
from deephaven import new_table
from deephaven.column import string_col

import deephaven_massive as dm

pairs = new_table([string_col("Symbol", ["EUR/USD", "GBP-USD"])])
watchlist = dm.canonicalize_symbols(pairs, dm.AssetClass.FOREX)
# watchlist.Symbol: C:EURUSD, C:GBPUSD

Parameters:

Name Type Description Default
table Table

Any table with a String column of symbols.

required
asset_class AssetClass

The class of every symbol in the column. Required: nothing is inferred, so a table that mixes classes is converted one class's rows at a time.

required
column str

The column to convert, "Symbol" by default. symbols= and underlying= read Symbol, so rename yours first: table.rename_columns("Symbol = Ticker").

'Symbol'
convention SymbolConvention

The convention the symbols come from: SymbolConvention.MASSIVE, the default, for Massive's own spelling and the unambiguous spellings of the class, or, for stocks only, YAHOO, NASDAQ, or CMS: the source the tickers came from, not the exchange they trade on.

MASSIVE
on_error OnError

What happens to a value that doesn't convert:

  • OnError.LOG, the default: a null symbol. Each value is logged once at WARNING, up to 20 values per call.
  • OnError.IGNORE: a null symbol, and the value is logged at DEBUG only.
  • OnError.RAISE: ValueError, or a failed live table, as above.

The noncanonical_symbols setting of dm.ErrorPolicy doesn't apply here.

LOG

Returns:

Type Description
Table

A table with the same rows and columns, whose column holds canonical tickers (or nulls): static for a static table, live for a live one.

Raises:

Type Description
ValueError

Under OnError.RAISE, if a current value of the table does not convert (the message lists up to five values and their reasons).

A table that is not a Deephaven Table, a column that is not a str, or an asset_class, convention, or on_error of the wrong type raises TypeError (an enum's names the member to use); a column that is not a String column of the table, or a stock convention for a class other than stocks, raises ValueError.