Python API / native extension
API reference
Complete reader, database, and broker documentation for stocks, crypto, currencies, indices, futures, and options.
Choose a reference
The package has two data representations: compressed CSV archives and fixed-record, per-instrument databases. Both expose typed records. Database replay adds a broker where that instrument family supports one.
Every parser, its exact parameters, all record fields, raw bytes, packing, conditions, and window aggregators.
Databases →All database constructors and layouts, conversion tools and options, indexing, timestamp search, and multi-day access.
Broker & replay →Stock, futures, and option event loops, order submission, execution policy, result fields, and the limits of causal visibility.
Instrument coverage
Each row links to the parser's complete record fields and its database constructor. Trades and quotes are separate datasets. Massive-provided minute and daily aggregate files are not parsed; build bars from tick records with the aggregators.
| Record | CSV reader | Database | Time key | Broker |
|---|---|---|---|---|
StockTrade | FlatFiles.Stock.Trade | StockTradeDatabase | sip_timestamp | SimpleMarket |
StockQuote | FlatFiles.Stock.Quote | StockQuoteDatabase | sip_timestamp | SimpleMarket |
CryptoTrade | FlatFiles.Crypto.Trade | CryptoTradeDatabase | participant_timestamp | No built-in broker |
CurrencyQuote | FlatFiles.currency.Quote | CurrencyQuoteDatabase | participant_timestamp | No built-in broker |
IndexValue | FlatFiles.Indices.Value | IndexValueDatabase | timestamp | No built-in broker |
FuturesTrade | FlatFiles.Futures.Trade | FuturesTradeDatabase | timestamp | FuturesMarket |
FuturesQuote | FlatFiles.Futures.Quote | FuturesQuoteDatabase | timestamp | FuturesMarket |
OptionTrade | FlatFiles.Options.Trade | OptionTradeDatabase | sip_timestamp | OptionMarket |
OptionQuote | FlatFiles.Options.Quote | OptionQuoteDatabase | sip_timestamp | OptionMarket |
Shared conventions
| Concern | Contract |
|---|---|
| Imports | import massive_speedup as ms. Names in signatures use this alias. |
| Files | str or os.PathLike for native file paths; database readers use MASSIVE_SPEEDUP_DB_PATH unless overridden by database_path=.... |
| Time | Record and search timestamps are integer nanoseconds since Unix epoch. Market event tuples expose floating-point seconds. Each reference states its sort key. |
| Date | YYYY-MM-DD or datetime.date for database/session dates. Futures dates represent the session's ending date. |
| Iteration | CSV and replay iterators advance once and are exhausted at the end. Daily database objects can create fresh iterators. Records expose read-only attributes. |
| Native extension | Database construction, mmap access, aggregators, and broker replay require the compiled extension. The Python fallback does not implement all native APIs. |
| Examples | Examples use 2026-09-11 and representative instrument keys. Substitute dates and identifiers that exist in your downloaded/built files; no example fetches missing data automatically. |
Keep each decision in its own time
Feed one observed event into your state, then decide. This matches the incremental update model used by RTTA: historical replay can drive the same update loop as live observations.
Market broker calls return no future fill price, and market summaries are gated until replay finishes. Direct database searches and the lower-level TradeEmulator expose broader access. Follow the documented visibility boundary when writing strategy code.
For an end-to-end workflow, start with the seven-step quick start. This reference follows the native Python bindings and Python helpers.