Market data from Massive as live and historical Deephaven tables, for traders and quants who work in Python.
- Research faster. A year of bars, or every listed US stock on one day, is one line.
- Go live without a rewrite. The query that reads history also opens the live table.
- Build live boards, not infrastructure. Your stocks' live change since the previous close is about ten lines.
- Spend your time trading, not coding. Live tables that follow your watchlist are already built.
This charts a year of Apple's daily closes:
import deephaven.plot.express as dx
import deephaven_massive as dm
m = dm.MassiveSession()
apple = m.stocks.bars("AAPL", dm.Timespan.DAY).history("2025-11-03", "2026-10-30")
chart = dx.line(apple, x="Date", y="Close")Paste it into the Deephaven IDE's console to see the chart. You never download or manage a data file.
Install the library, then start the tutorial with a week of Apple's prices.
You install Deephaven's server and the library into one Python environment, then start the server from it.
You need:
| What | Check it with | Get it from |
|---|---|---|
| Python 3.11 or later | python3 --version |
python.org |
Java 17 or later, with JAVA_HOME set |
java -version and echo $JAVA_HOME |
Deephaven's pip install guide |
| Git and the GitHub CLI | git --version and gh --version |
git-scm.com and cli.github.com |
| A Massive account | Sign in at massive.com | Massive's plans |
The library installs from its GitHub repository. Sign in with the GitHub CLI, and let git use the same sign-in:
gh auth login
gh auth setup-gitCreate a virtual environment and install Deephaven's server, its chart and dashboard plugins, and the library's newest release. Use pip or uv.
With pip:
python3 -m venv ~/dh-massive
source ~/dh-massive/bin/activate
TAG=$(gh release list --repo chipkent/deephaven-massive --limit 1 --json tagName --jq '.[0].tagName')
pip install deephaven-server deephaven-plugin-ui deephaven-plugin-plotly-express \
"deephaven-massive @ git+https://github.com/chipkent/deephaven-massive.git@$TAG"With uv:
uv venv --python ">=3.11" ~/dh-massive
source ~/dh-massive/bin/activate
TAG=$(gh release list --repo chipkent/deephaven-massive --limit 1 --json tagName --jq '.[0].tagName')
uv pip install deephaven-server deephaven-plugin-ui deephaven-plugin-plotly-express \
"deephaven-massive @ git+https://github.com/chipkent/deephaven-massive.git@$TAG"Open your shell's startup file in a text editor: ~/.zshrc on macOS, ~/.bashrc on Linux.
Paste the lines below at its end. The first is required. Leave out the two S3 lines if your
Massive plan doesn't include flat files. Copy
each key from Massive's keys page over its placeholder,
and save the file:
export MASSIVE_API_KEY="your-api-key"
export MASSIVE_S3_ACCESS_KEY_ID="your-s3-access-key-id"
export MASSIVE_S3_SECRET_ACCESS_KEY="your-s3-secret-access-key"Every terminal you open from now on has the keys.
Open a new terminal, activate the environment, and start Deephaven's server with 4 GB of memory:
source ~/dh-massive/bin/activate
deephaven server --jvm-args "-Xmx4g"The server prints a line that starts with Deephaven is running at and opens the Deephaven IDE
in your browser. Keep the terminal open while you work, and press Control-C there to stop the
server.
Next, run the tutorial's first example. If a step fails, Troubleshooting lists common setup problems and their fixes.
Paste each example into the Console panel of the Deephaven IDE and run it. Examples 9 to 14 read the settings file that Example 8 saves.
Each example's Plan line names the Massive plans that run it. Plans shows how recent each plan's data is.
Plan: Any Stocks plan
Read Apple's daily bars for the last week of October 2026:
import deephaven_massive as dm
m = dm.MassiveSession()
apple = m.stocks.bars("AAPL", dm.Timespan.DAY).history("2026-10-26", "2026-10-30")apple fills in with five rows, one per trading day, with columns such as Date, Open,
High, Low, Close, and Volume.
m is the session, your connection to Massive. Every dataset works the same way through it.
m.stocks.bars(...) is a query, which names the data and reads nothing. history() and the
query's other methods read the data and return a Deephaven table, so Deephaven's
table operations work on
it. The
dataset index lists each dataset's arguments and columns.
history() returns apple at once and downloads its rows in the background, so the console
stays free. Deephaven fills the table when the rows arrive. To wait for the rows instead, pass
wait=True.
Next, one query for every listed stock at once.
Plan: Any Stocks plan
Find the stocks that traded the most dollars on October 30, 2026. Read that day's bar for every listed US stock, then rank them in Deephaven:
import deephaven_massive as dm
m = dm.MassiveSession()
day = m.stocks.bars(dm.ALL, dm.Timespan.DAY).history("2026-10-30", "2026-10-30")
busiest = (
day.update_view("DollarVolume = Vwap * Volume")
.sort_descending("DollarVolume")
.head(20)
)day has a row for every listed US stock that traded that day. Over-the-counter (OTC) stocks
are left out.
A dataset's symbols argument names what to read:
dm.ALLfor every symbol- one symbol as text
- several symbols as a list
Spell each symbol as Massive does. Each dataset's page says whether it takes dm.ALL.
Next, a list of three stocks over a longer range.
Plan: Any Stocks plan
Compare the price returns of Apple, Microsoft, and Nvidia over a year from their daily bars:
import deephaven_massive as dm
from deephaven import agg
m = dm.MassiveSession()
year = m.stocks.bars(["AAPL", "MSFT", "NVDA"], dm.Timespan.DAY).history(
"2025-11-03", "2026-10-30"
)
returns = year.agg_by(
[agg.sorted_first("Date", "Start = Close"), agg.sorted_last("Date", "End = Close")],
by="Symbol",
).update_view("ReturnPct = 100 * (End / Start - 1)")returns has one row per stock, with its close on the first and last day and its percent
return.
Dates are yyyy-MM-dd text in every table, so they sort by day and join across tables. A range
includes both of its dates. For stocks, a date is the trading day in New York.
Next, the same kind of table as a chart.
Plan: Any Stocks plan
Draw Nvidia's daily closes for a year, charted with Deephaven Express:
import deephaven.plot.express as dx
import deephaven_massive as dm
m = dm.MassiveSession()
nvda = m.stocks.bars("NVDA", dm.Timespan.DAY).history("2025-11-03", "2026-10-30")
closes = dx.line(nvda, x="Date", y="Close")closes is a line chart of Nvidia's close on each trading day of the year. Deephaven Express
charts any Deephaven table, so every table in this tutorial can be a chart, live ones included.
Next, a table that keeps changing.
Plan: Any Stocks plan
Follow the news on Apple, Nvidia, and Tesla. Ask Massive for each stock's newest headlines every five minutes:
import deephaven_massive as dm
m = dm.MassiveSession()
headlines = m.reference.news(["AAPL", "NVDA", "TSLA"], limit=10).poll(300)
latest = headlines.view(["PublishedUtc", "Symbol", "Title"]).sort_descending("PublishedUtc")latest starts with up to ten articles per stock, newest first. A new article arrives at the
first poll after Massive lists it.
poll() returns a live table. At each poll it asks Massive again, and a news table adds only
the articles it hasn't seen. latest updates with it.
The poll keeps running until you close its session with m.close(). The
last example shows the other ways to stop live tables.
Next, a live table whose stocks you change while it runs.
Loading data for new symbols without restarting: add and remove stocks from a live table of previous closes
Plan: Any Stocks plan
Keep a live table of previous closes that follows your list of stocks through the day:
import deephaven_massive as dm
from deephaven import input_table, new_table
m = dm.MassiveSession()
stocks = new_table({"Symbol": ["AAPL", "MSFT", "AMZN", "GOOGL"]})
watchlist = input_table(init_table=stocks, key_cols="Symbol")
closes = m.stocks.previous_day_bar(watchlist).poll(60)closes has a row for each stock with its previous trading day's bar. Each poll sends one
request per stock.
watchlist is a Deephaven input table,
which you edit by hand in its panel or in code. By hand, type a symbol into a new row of the
watchlist panel, press Enter, and click Commit. In code, run this in the same console
to add Nvidia and remove Microsoft:
watchlist.add(new_table({"Symbol": ["NVDA"]}))
watchlist.delete(new_table({"Symbol": ["MSFT"]}))At the next poll, Nvidia's row arrives and Microsoft's leaves, and the table keeps running.
Wherever a dataset takes symbols, it also takes a table with a Symbol column, and it follows a
live one as it changes.
Next, a list from another source.
Plan: Any Stocks plan
Read the previous closes of a list of Yahoo Finance tickers. Yahoo spells some tickers
differently: Yahoo's BRK-B is Massive's BRK.B, and Yahoo's BAC-PL is Massive's BACpL.
Convert the list first, and tell the converter whose tickers they are with convention=:
import deephaven_massive as dm
from deephaven import new_table
m = dm.MassiveSession()
yahoo = new_table({"Symbol": ["AAPL", "BRK-B", "BAC-PL", "^GSPC"]})
stocks = dm.canonicalize_symbols(
yahoo.update("Yahoo = Symbol"), dm.AssetClass.STOCKS, convention=dm.SymbolConvention.YAHOO
)
yahoo_closes = m.stocks.previous_day_bar(stocks).fetch()yahoo_closes has one row each for AAPL, BRK.B, and BACpL, with the previous trading
day's bar. stocks keeps all four rows. Symbol holds Massive's ticker, and Yahoo holds
the text you started with.
^GSPC isn't a stock ticker, so its Symbol is null and every dataset skips the row.
stocks.where("isNull(Symbol)") lists such rows.
A dataset reads only Massive's own tickers, so convert any list that comes from elsewhere.
Next, a settings file and a delayed snapshot.
Plan: Stocks Starter or higher
Read a snapshot of three stocks. First, save in a settings file whether your plan's data is delayed. The Snapshots row of the plans table shows which it is. In a new terminal, run the commands for your plan.
If the table shows your plan delayed:
mkdir -p ~/massive
echo "delayed_subscriptions: [stocks]" > ~/massive/settings.yamlIf it shows your plan real-time:
mkdir -p ~/massive
echo "delayed_subscriptions: []" > ~/massive/settings.yamlThen load the file and read the snapshot:
import deephaven_massive as dm
config = dm.MassiveConfig.from_file("~/massive/settings.yaml")
m = dm.MassiveSession(config)
snapshot = m.stocks.snapshots(["AAPL", "MSFT", "NVDA"]).fetch()snapshot has one row per stock, with columns such as DayClose, PrevDayClose, and
TodaysChangePerc. On a delayed plan without the setting, the snapshot table fails with
an error that names the setting to change.
To check whether your data is real-time or delayed, run m.connections() in the next example's
session. Its Recency is DELAYED with the delayed file and REALTIME with the real-time one.
The problems example shows the call.
Settings belong to dm.MassiveConfig, and a file keeps them in one place for every console and
script. Your keys stay in the environment, never in the file. Configuration
covers the settings a new user needs.
Next, a live table that streams instead of polling.
Plan: Stocks Starter or higher
Watch the latest minute bar of each stock on your list as it arrives:
import deephaven_massive as dm
from deephaven import input_table, new_table
m = dm.MassiveSession(dm.MassiveConfig.from_file("~/massive/settings.yaml"))
stocks = new_table({"Symbol": ["AAPL", "MSFT", "NVDA"]})
watchlist = input_table(init_table=stocks, key_cols="Symbol")
latest = m.stocks.bars(watchlist, dm.Timespan.MINUTE).last_by()latest gets a row for each stock with its first minute bar, and the row changes as each minute
ends.
last_by() streams instead of polling. Like Example 6's poll, the stream follows the watchlist.
Massive sends a minute bar only for a minute with trades, so a table you start while no stock
trades stays empty until trading resumes. Crypto trades around the clock, so
m.crypto.bars("X:BTCUSD", dm.Timespan.MINUTE).last_by() streams at any hour. The
crypto bars page lists the plans that include it.
Next, a calculation on the live bars.
Plan: Stocks Starter or higher
Find how far each stock has moved today. Join the live minute bars to the previous closes, and compute the change:
import deephaven_massive as dm
m = dm.MassiveSession(dm.MassiveConfig.from_file("~/massive/settings.yaml"))
symbols = ["AAPL", "MSFT", "NVDA"]
closes = m.stocks.previous_day_bar(symbols).fetch()
latest = m.stocks.bars(symbols, dm.Timespan.MINUTE).last_by()
changes = (
closes.view(["Symbol", "PrevClose = Close"])
.natural_join(latest, on="Symbol", joins="Close")
.update_view("ChangePct = 100 * (Close / PrevClose - 1)")
)changes has a row for each stock with a previous close. Its Close and ChangePct fill in
with the stock's first minute bar and change with every bar after it.
Deephaven recomputes changes whenever latest changes. Every table you build on a live table
stays live, and the code is the same as for static tables.
Next, other ways to keep a stream's rows.
Plan: Stocks Starter or higher
Stream SPY's minute bars into three tables that keep different rows:
import deephaven_massive as dm
m = dm.MassiveSession(dm.MassiveConfig.from_file("~/massive/settings.yaml"))
bars = m.stocks.bars("SPY", dm.Timespan.MINUTE)
newest = bars.last_by()
last_30 = bars.ring(30)
since_start = bars.append_only()| Table | Method | Keeps |
|---|---|---|
newest |
last_by() |
One row per symbol: its newest bar |
last_30 |
ring(30) |
The newest 30 bars: for a stock that trades every minute, the last 30 minutes |
since_start |
append_only() |
Every bar since you ran the code |
All three share one stream from Massive, so pick the method by the rows you need to keep.
since_start begins when you run the code. Next, fill in the bars before that.
Plan: Stocks Starter or higher
Start with every minute bar SPY has had today, then add each new one as it ends:
import deephaven_massive as dm
from deephaven import merge
from deephaven.time import dh_today, to_j_time_zone
m = dm.MassiveSession(dm.MassiveConfig.from_file("~/massive/settings.yaml"))
bars = m.stocks.bars("SPY", dm.Timespan.MINUTE)
live = bars.append_only()
past = bars.history(dh_today(to_j_time_zone("America/New_York")))
spy = merge([past, live]).last_by(["Symbol", "TimestampStart"])spy holds SPY's minute bars for the day so far, and it grows as each minute ends. On a day the
market is closed, it stays empty.
To backfill a live table, merge its history() with it and keep one row per bar with last_by.
Put the live table last, so its bar wins where both have one. history() with only a start date
reads through now.
Next, a live chart and a live table on one screen.
Plan: Stocks Starter or higher
Put a live chart and a live table side by side with deephaven.ui. The table is Example 10's change table:
import deephaven.plot.express as dx
import deephaven_massive as dm
from deephaven import ui
m = dm.MassiveSession(dm.MassiveConfig.from_file("~/massive/settings.yaml"))
symbols = ["AAPL", "MSFT", "NVDA"]
closes = m.stocks.previous_day_bar(symbols).fetch()
bars = m.stocks.bars(symbols, dm.Timespan.MINUTE)
changes = (
closes.view(["Symbol", "PrevClose = Close"])
.natural_join(bars.last_by(), on="Symbol", joins="Close")
.update_view("ChangePct = 100 * (Close / PrevClose - 1)")
)
chart = dx.line(bars.append_only(), x="TimestampEnd", y="Close", by="Symbol")
dashboard = ui.dashboard(ui.row(ui.panel(chart, title="Closes"), ui.panel(changes, title="Change")))dashboard opens with two panels side by side: a line per stock that grows each minute, and
the change table.
A dashboard arranges panels in rows and columns, and each panel holds any table or chart. Deephaven's guide to creating dashboards shows more layouts.
Next, options on the stocks you follow.
Plan: Options Starter or higher
Read Apple's calls of the nearest expiry, with their implied volatility and open interest. If the
Option chain row of the plans table shows your options plan delayed, first add
options to delayed_subscriptions in your settings file, as in [stocks, options]:
import deephaven_massive as dm
from deephaven import agg
m = dm.MassiveSession(dm.MassiveConfig.from_file("~/massive/settings.yaml"))
calls = m.options.chain("AAPL", contract_type=dm.ContractType.CALL).fetch(wait=True)
nearest = calls.where_in(calls.agg_by(agg.min_("ExpirationDate")), "ExpirationDate")
nearest_calls = nearest.view(
["StrikePrice", "DayClose", "ImpliedVolatility", "OpenInterest", "Delta"]
).sort("StrikePrice")nearest_calls has a row for each call of the nearest expiry. calls holds every expiry.
wait=True keeps calls static, which avoids a
Deephaven crash when where_in filters a live
table by a table made from it.
A chain is a snapshot of every contract of one underlying. Its arguments, such as
contract_type, narrow it.
Next, where to see what went wrong in your tables.
Plan: Any Stocks plan
Find out why a table has fewer rows than you asked for. This asks for the
details of Apple and of ZZZZ, a ticker Massive doesn't list:
import deephaven_massive as dm
m = dm.MassiveSession()
problems = m.problems() # each problem in your tables: Cause says why, Detail what happened
details = m.reference.ticker_details(["AAPL", "ZZZZ"]).fetch()details holds Apple's row. Massive answers the ticker-details request for ZZZZ with HTTP 404,
so problems gets a row whose Cause is unavailable_symbols and Symbol is ZZZZ. Its
Detail names the HTTP 404 and the endpoint the library called. Most other datasets answer an
unlisted ticker with no rows and no error, so problems gets no row for it.
Other problems, such as rows the library left out or a connection outage, add rows the same way. Troubleshooting's problems section says what each one means and what to do about it.
Four more live tables show what the session is doing:
streams = m.streams() # each live table and background read: its State, and Error if it failed
# each streaming connection: its Host, State, and Recency, REALTIME or DELAYED
connections = m.connections().view(["Transport", "AssetClass", "Host", "State", "Recency"])
rate_limits = m.rate_limits() # each subscription's rate-limit State: READY, PACED, or PAUSED
symbol_reads = m.symbol_reads() # each watchlist symbol read: its State, and Error if it failedHere streams has one row, for the ticker-details read, whose State ends DONE.
symbol_reads stays empty, because this example reads no watchlist. connections stays empty
too, because a fetch() doesn't stream. Once a table streams, connections gets a row for each
connection.
Troubleshooting's diagnostics section says when to check
each table. For a table's columns, run help() on its method, such as
help(m.connections).
Next, how to stop live tables when you're done with them.
Plan: Any Stocks plan
Stop the live tables you no longer need. This example starts two polls of its own:
import deephaven_massive as dm
m = dm.MassiveSession()
closes = m.stocks.previous_day_bar(["AAPL", "MSFT"]).poll(60)
headlines = m.reference.news(["AAPL", "NVDA"], limit=5).poll(300)To stop one table, release it:
m.release(closes)closes stops once you close its panel. A table built on it keeps it running until that table
stops too. The session and headlines keep running.
When you're done with them all, keep a copy of the rows you want and close the session:
kept = headlines.snapshot()
m.close()Closing stops every live table of the session. headlines keeps its rows and shows an error
saying the session was closed. kept is a static copy that you can filter and join like any
table. A closed session reads nothing more. To read more, open a new session with
m = dm.MassiveSession(). Every example opens its own.
The library reads your keys and a few options from environment variables, and every other
setting from dm.MassiveConfig.
Set these in your shell's startup file, where Install put your keys. A running server doesn't see a change. Restart it from a new terminal (Start the server).
| Variable | What you get | Default |
|---|---|---|
MASSIVE_API_KEY |
Access to Massive. Every session needs it, unless your code passes the key. | Unset |
MASSIVE_S3_ACCESS_KEY_ID, MASSIVE_S3_SECRET_ACCESS_KEY |
history() of trades, quotes, and as-traded 1-minute and daily bars (adjusted=False) for the whole market or 50 or more symbols, and index values' history, from Massive's flat files on plans that include them. Set both or neither. |
Unset |
DEEPHAVEN_MASSIVE_CONFIG_FILE |
Your settings file, read by dm.MassiveConfig.from_file() called with no path |
Unset |
DEEPHAVEN_MASSIVE_LOG |
The library's log at the level you name: DEBUG, INFO, WARNING, ERROR, or CRITICAL |
Warnings and errors only, in the server's terminal |
DEEPHAVEN_MASSIVE_LOG_FILE |
The log in this file instead of the terminal. Set alone, it logs at DEBUG. |
Unset |
HTTPS_PROXY, NO_PROXY |
A proxy for every connection to Massive, and the hosts that skip it | Your system's proxy on macOS; none on Linux |
SSL_CERT_FILE, SSL_CERT_DIR |
The certificate authorities to trust, such as your company's own. Flat-file reads use only SSL_CERT_FILE. |
The certifi bundle |
Turn on the debug log explains each log level and how to record what the library does, and Report a bug says how to attach the log to an issue.
Massive sells each subscription, such as Stocks or Options, on its own plans. These tables cover the data the tutorial reads. Each dataset's page has a table for its own data.
Each cell gives how recent a plan's data is and how far back its history goes, as Massive's pages state them.
| Data | Stocks Basic | Stocks Starter | Stocks Developer | Stocks Advanced | Stocks Business |
|---|---|---|---|---|---|
| Bars, history | End-of-day, 2 years | 15-minute delayed, 5 years | 15-minute delayed, 10 years | Real-time, All history | Real-time, All history |
| Minute bars, streamed | Not included | 15-minute delayed | 15-minute delayed | Real-time | Real-time |
| Previous day bar | End-of-day | 15-minute delayed | 15-minute delayed | Real-time | Real-time |
| News | Updated hourly, 2 years | Updated hourly, All history | Updated hourly, All history | Updated hourly, All history | Updated hourly, All history |
| Ticker details | Updated daily, 2 years | Updated daily, All history | Updated daily, All history | Updated daily, All history | Updated daily, All history |
| Snapshots | Not included | 15-minute delayed | 15-minute delayed | Real-time | Real-time |
| Data | Options Basic | Options Starter | Options Developer | Options Advanced | Options Business |
|---|---|---|---|---|---|
| Option chain | Not included | 15-minute delayed | 15-minute delayed | Real-time | Real-time |
dm.MassiveConfig holds a session's settings. Pass it as dm.MassiveSession(config), or leave
it out for the defaults. Three settings cover what a new user needs:
| Setting | Set it when | What changes |
|---|---|---|
delayed_subscriptions |
A subscription's plan gets Massive's delayed feed | Live tables and snapshots accept the delayed data. |
rest_requests_per_minute |
Massive limits a subscription's REST requests per minute | Its requests keep to your limit from the first one, with no pause to learn it. |
on_error |
A bad symbol or row should fail the table, instead of the default, which skips it and logs a warning | The table fails, as Bad symbols and rows describes for each kind of problem. |
This session streams stocks from Massive's delayed feed and keeps four other subscriptions to five requests a minute:
import deephaven_massive as dm
config = dm.MassiveConfig(
delayed_subscriptions={dm.Subscription.STOCKS},
rest_requests_per_minute={
dm.Subscription.OPTIONS: 5,
dm.Subscription.INDICES: 5,
dm.Subscription.CURRENCIES: 5,
dm.Subscription.FUTURES: 5,
},
)
m = dm.MassiveSession(config)Leave a limited subscription out, and the session learns its limit from Massive's first
rate-limit error, after a pause. m.rate_limits() then shows the learned limit in
RequestsPerMinute. Copy that number into the setting to skip the pause next time.
dm.MassiveConfig.from_file() reads the same settings from a YAML file
(Example 8). The settings page lists every
setting, its values, and its default, with an example settings file.
- Call
help()on any object for its full documentation, such ashelp(m.stocks.bars). - The dataset index has a page for each dataset, with its
arguments, its columns, and the plans that include it.
dm.datasets()lists them in the console. - Troubleshooting covers the problems whose message doesn't say how to fix them, and how to report a bug.
CONTRIBUTING.md explains how to set up a development checkout, run the checks, and propose a change.
