Datasets

List of datasets

Dataset Name

URL

Description

All Daily News

https://paperswithbacktest.com/datasets/all-daily-news

Daily aggregated financial and macroeconomic news feed. Useful for sentiment analysis and event-driven strategies.

Bonds Daily Price

https://paperswithbacktest.com/datasets/bonds-daily-price

Historical daily bond price data across government and corporate bonds.

Commodities Daily Price

https://paperswithbacktest.com/datasets/commodities-daily-price

Daily price data for major commodities such as oil, gold, and agricultural products.

Cryptocurrencies Daily Price

https://paperswithbacktest.com/datasets/cryptocurrencies-daily-price

Historical daily prices for major cryptocurrencies.

ETFs Daily Price

https://paperswithbacktest.com/datasets/etfs-daily-price

Daily closing prices of exchange-traded funds (ETFs) globally.

Forex Daily Price

https://paperswithbacktest.com/datasets/forex-daily-price

Daily foreign exchange rates between major and emerging market currencies.

Indices Daily Price

https://paperswithbacktest.com/datasets/indices-daily-price

Historical daily prices for global stock market indices.

Stocks 1-Min Price

https://paperswithbacktest.com/datasets/stocks-1min-price

Intraday 1-minute price data for major equities. Ideal for high-frequency or intraday backtests.

Stocks Daily Price

https://paperswithbacktest.com/datasets/stocks-daily-price

Historical daily stock price dataset covering global exchanges.

Stocks Quarterly Balance Sheet

https://paperswithbacktest.com/datasets/stocks-quarterly-balancesheet

Company-level quarterly balance sheet fundamentals.

Stocks Quarterly Cash Flow

https://paperswithbacktest.com/datasets/stocks-quarterly-cashflow

Company-level quarterly cash flow statements.

Stocks Quarterly Earnings

https://paperswithbacktest.com/datasets/stocks-quarterly-earnings

Quarterly earnings reports and EPS data.

Stocks Quarterly Income Statement

https://paperswithbacktest.com/datasets/stocks-quarterly-incomestatement

Quarterly income statements providing revenue, expenses, and profit metrics.

Best Alternative Data

https://paperswithbacktest.com/datasets/best-alternative-data

Curated collection of alternative datasets (e.g., sentiment, macro signals, ESG metrics).

Arguments

Load daily stock price data for specific symbols using the load_dataset function. The first call retrieves data for Apple and Microsoft. The second call retrieves the same stocks but without price adjustments (adjust=False). The third call loads daily price data for the S&P 500 index:

import pwb.datasets as pwb_ds

df = pwb_ds.load_dataset(
    "Stocks-Daily-Price",
    ["AAPL", "MSFT"],
)

df = pwb_ds.load_dataset(
    "Stocks-Daily-Price",
    ["AAPL", "MSFT"],
    adjust=False,
)

df = pwb_ds.load_dataset(
    "Stocks-Daily-Price",
    ["sp500"],
)

The extend=True argument instructs the function to return an extended historical data using indices, commodities, and bonds data.

import pwb.datasets as pwb_ds

df = pwb_ds.load_dataset(
    "ETFs-Daily-Price",
    ["SPY", "IEF"],
    extend=True,
)

The argument rate_to_price=False specifies that bond yield rates should not be converted to price values in the returned data:

import pwb.datasets as pwb_ds

df = pwb_ds.load_dataset(
    "Bonds-Daily-Price",
    ["US10Y"],
    rate_to_price=False,
)

The argument to_usd=False indicates that the data should not be converted to U.S. dollars, implying that it might be available in another currency.

import pwb.datasets as pwb_ds

df = pwb_ds.load_dataset(
    "Indices-Daily-Price",
    ["US10Y"],
    to_usd=False,
)

Forex pairs: either spelling

Forex-Daily-Price holds each currency pair under one spelling, the one with the longest history (USDJPY since 1971, XAUUSD since 1970). A pair can be asked for under either spelling; the loader reads the series the table keeps and inverts it when the other spelling was asked for (open, close → 1/x, high → 1/low, low → 1/high, volume unchanged).

import pwb.datasets as pwb_ds

# Default to_usd=True: every pair comes back as dollars per unit of the other
# currency, named XXXUSD, whichever spelling was asked for.
pwb_ds.load_dataset("Forex-Daily-Price", ["USDJPY"])  # symbol JPYUSD, ~0.0063
pwb_ds.load_dataset("Forex-Daily-Price", ["JPYUSD"])  # the same series

# to_usd=False: each name as spelled.
pwb_ds.load_dataset("Forex-Daily-Price", ["USDJPY", "JPYUSD"], to_usd=False)
# USDJPY ~158 (raw) and JPYUSD ~0.0063 (its inverse)

Minute bars: bound the read with start, end and columns

Stocks-1Min-Price, Cryptocurrencies-1Min-Price and Forex-1Min-Price are stored as one parquet shard per month (data/train-YYYY-MM.parquet, about 350 MB a month for the stocks, ~75 GB in all). symbols= alone keeps memory bounded to the matching rows, but every month is still downloaded. Pass a window and the columns you use:

import pwb.datasets as pwb_ds

bars = pwb_ds.load_dataset(
    "Stocks-1Min-Price",
    symbols=["SPY", "QQQ"],
    start="2024-01-01",
    end="2024-03-31",
    columns=["adj_open", "adj_close", "volume"],
)
  • start, end (date-like, inclusive) select the shards to download by the month in their names, before anything is fetched, and filter the datetime column (or date) inside the parquet read. A bare date covers the whole day (end="2024-03-31" keeps the bars of 31 March); a bound with a time of day ("2024-03-15 09:30") is compared with the stored timestamps, which are naive. One shard on each side of the window may be opened as slack for bars shifted across a month boundary; their rows outside the window are dropped on read. Either bound may be left open.

  • columns reads only those columns plus the keys (symbol, datetime/date). Stock bars have adj_open, adj_high, adj_low, adj_close and volume; crypto and forex bars have open, high, low, close and volume. An unknown column is an error.

  • Rows and columns are filtered by Arrow before pandas sees them, so a shard is never materialised whole.

The same parameters work on every dataset whose shards are named by period (the daily price tables are monthly too). On the daily price tables columns selects among the adjusted result, since the adjustment needs every price column. Without start, end and columns, load_dataset behaves as before; on a minute dataset it then emits an UnboundedMinuteLoadWarning, because it is about to download every month.

Option chains: load_option_chain

Options-Daily-Price holds every US-listed option contract that traded since June 2014, one row per contract and session (about 560 million rows, ~20 GB). It is not loaded with load_dataset, which downloads every shard before filtering and refuses this dataset. Use load_option_chain, which downloads only what it is asked for:

from pwb.datasets import load_option_chain

chain = load_option_chain(
    ["SPY"], "2024-01-01", "2024-03-31",
    columns=["expiration", "strike", "option_type", "close", "volume", "implied_volatility", "delta"],
)
  • underlyings (required): the tickers as the table spells them, the name at the time ("FB" before June 2022, "SPX" for SPX and SPXW).

  • start, end (required): the session window, inclusive. Only the monthly shards that meet it are opened.

  • columns (optional): what to download besides symbol, date and underlying. Fewer columns, fewer bytes.

Inside each month only the row groups of the requested chains are fetched, by HTTP range requests: one chain-month costs a few MB (SPY, October 2026: 7.7 MB of a 274 MB shard). implied_volatility and the greeks are computed from the last trade of the day; see the dataset card for how far to trust them.

The loader does not answer an empty frame for a reason it could name:

  • a source that answers range requests with whole files raises RangeNotSupportedError (nothing is downloaded whole); through the API, with HF_ACCESS_TOKEN also set, it reads from the Hub instead and says so in a warning;

  • a file list whose names carry no month is sorted by the date statistics in each file’s footer (one range request per file), with a warning;

  • a window the table does not cover, or chains with no row in it, return an empty frame with a warning that says which.

Futures: load_futures and add_futures

Futures-Daily-Price holds every outright contract of CME, CBOT, NYMEX and COMEX since April 2017: one row per contract and session with its terms (daily), one row per contract (contracts), and continuous series of rank 1 to 6 per root rolled on volume (continuous). The layout is Tradewind’s tradewind.futures.future_table, so a backtest holds real contracts and rolls them with real orders.

from pwb.datasets import add_futures, load_futures

daily = load_futures("CL", start="2020-01-01")                        # one row per CL contract and session
terms = load_futures(["CL", "GC"], kind="contracts")                  # last trade date, multiplier, tick, currency
chain = load_futures("CL", kind="chain")                              # tradewind.futures.FutureChain, no feeds
front = load_futures("CL", kind="continuous", rank=1, adjust="ratio") # open/high/low/close/volume, signals only
curve = load_futures("CL", kind="continuous", rank=[1, 2])            # raw and both adjusted copies, two ranks
  • roots: product codes ("CL", "ES", "ZN"), None for every root.

  • kind: "daily" (default), "contracts", "continuous" or "chain" (needs tradewind.futures).

  • rank, adjust (kind="continuous" only): ranks 1 to 6; adjust=None keeps every column, "ratio", "difference" or "none" returns that series as open/high/low/close/volume. Rank 1 is the contract RollOnVolume(days_before=5) holds, decided on the previous close; rank k is the (k - 1)-th listed contract after it.

  • start, end: a date window (daily, continuous).

Never trade an adjusted series. An adjusted level was never quoted, and every one before the latest roll moves when a roll is added. Trade the contracts:

import tradewind as tw
from tradewind.futures import Roller, RollOnVolume
from pwb.datasets import add_futures

class Long(tw.Strategy):
    params = (("chain", None),)

    def __init__(self):
        self.roller = Roller(self, self.p.chain, RollOnVolume())

    def next(self):
        self.roller.target(1)          # one contract, rolled by two orders that each pay their cost

engine = tw.Engine()
chains = add_futures(engine, ["CL"], start="2018-01-01", margins={"CL": 6000}, commission=2.5)
engine.addstrategy(Long, chain=chains["CL"])
engine.broker.setcash(100_000)
engine.run()

add_futures loads the daily rows of the roots, builds a FutureSpec per root from the terms (futures_specs: multiplier, tick, currency; margins and commission are yours to give, the dataset has none) and calls tradewind.futures.add_futures: one feed per contract, the expiries (at_expiry="raise" stops a run that holds a contract past its last trade date; "close" closes it), the margin model, and the chain each Roller rolls on. A settlement flagged settlement_suspect (another session’s settlement, stamped a day early: CLK20 reads -37.63 on 17 April 2020) is dropped, so that session settles on its traded close. Only the contracts the rolled series hold at ranks=(1, 2) (default) are added, each with all its sessions (contract_symbols); ranks=None adds every listed month. A strategy in the usual card shape trades futures through run_strategy(..., futures=[...]) (see the backtesting page). tradewind.futures is on Tradewind’s main after 0.0.2; the reads (daily, contracts, continuous) need no Tradewind.

Chains, listed contracts and costs, point in time: load_futures_chain, load_futures_contracts

from pwb.datasets import load_futures_chain, load_futures_contracts, load_futures_costs

chain = load_futures_chain("CL", "2020-01-01", "2024-12-31", ranks=(1, 2), roll_rule="volume", adjustment="none")
listed = load_futures_contracts("ES", as_of="2023-06-30")       # contracts whose first trade date is reached
costs = load_futures_costs("rank")                              # a yearly cost table, available_from as a date
  • load_futures_chain rebuilds each rank with a Tradewind rule ("volume": RollOnVolume(), "date": RollOnDate(), or a rule instance), decided at the previous close among the contracts already listed. Rank 2 is the next contract of the root’s liquid cycle and rolls on the same bar as rank 1. One row per date, root and rank: symbol, last_trade_date, rolled, open/high/low/close (adjusted when adjustment is "ratio" or "difference"), volume, adjustment, price (raw settlement), multiplier, maturity_rank (rank among the root’s contracts printing that session, serial months counted).

  • Costs per contract and session (costs=): "rank" (default) reads Futures-Yearly-MaturityRankCostParams at the contract’s maturity rank, "contract" the contract’s own row of Futures-Yearly-TransactionCostParams, "front" Futures-Yearly-FrontMonthCostParams; a missing row falls back to the next table. Columns half_spread_bps, cost_basis, cost_year, cost_per_contract (half the spread x price x multiplier, per contract and side). A row is used only from its available_from date: a 2023 session pays 2022 figures at best (costs_as_of). spread= picks the measure ("spread_bps", "spread_rth_bps", "spread_med_bps", "eff_spread_bps").

  • load_futures_contracts drops first_session, last_session, n_sessions and total_volume, known only once the contract stops trading (realised=True keeps them).

  • dataset= (or PWB_FUTURES_DATASET) reads another dataset with the same daily and contracts tables through the loader of load_dataset.

Kenneth French’s Data Library: load_french

The Fama-French factors, the momentum and reversal factors, the industry portfolios and the sorted portfolios of Kenneth R. French’s Data Library are loaded on the fly from the author’s site. They are not on the Hub and not behind the PWB API: the library grants no redistribution right, so the zip is downloaded on your machine and kept in a local cache. Cite the library in anything you build on it.

from pwb.datasets import load_french, load_french_blocks, french_datasets

ff5 = load_french("ff5")                                  # monthly, decimal returns
mom = load_french("mom", frequency="daily")
ind48_ew = load_french("ind48", weighting="equal")
ff3_annual = load_french("ff3", frequency="annual")
firms = load_french("25_size_bm", block="number_of_firms_in_portfolios")
french_datasets()                                         # every file of the library
  • name: an alias (ff3, ff5, mom, st_rev, lt_rev, ind5 … ind49, 25_size_bm, 100_size_bm) or any file name of the library, e.g. Portfolios_Formed_on_ME or 6_Portfolios_ME_Prior_12_2.

  • frequency: monthly, annual (both read the main file), daily, weekly.

  • weighting: value (default) or equal, for portfolio files.

  • block: any other table of the file (load_french_blocks(name) lists them: number of firms, average size, BE/ME…). Those are left as published; return tables are divided by 100.

  • -99.99 and -999 are NaN. Monthly rows are dated at the month end, annual rows at December 31.

No point-in-time. The library is recomputed at each update (about monthly) and the whole history changes with it; only the latest computation is served, so no historical vintage can be loaded. Each frame carries attrs["downloaded_at"] and attrs["crsp_vintage"] (e.g. "202609") to tie a result to the copy it was computed on.

Cache. $PWB_FRENCH_CACHE_DIR, else $PWB_CACHE_DIR/french, else ~/.cache/pwb/french; copies are timestamped. A copy younger than max_age_days (7) is used without any request, refresh=True downloads again, and when the site is unreachable a stale copy is used with a warning.