Nightly docs
Aperiodic
Aperiodic publishes historical and live market microstructure aggregates for perpetual contracts. The NautilusTrader adapter loads typed Parquet history and streams closed aggregates for Binance USD-M, OKX perpetuals, and Hyperliquid perpetuals, including tokenized markets and Hyperliquid builder-deployed (HIP-3) markets.
Overview
The adapter is implemented in Rust with Python bindings. The Python package
nautilus_trader.adapters.aperiodic exports:
| Export | Purpose |
|---|---|
AperiodicDataClientConfig | Credentials, endpoints, and instrument ownership. |
AperiodicDataClientFactory | Registers the data client with a live node. |
AperiodicDataLoader | Discovers series and loads typed history. |
AperiodicDataset | Selects a dataset from the provider catalog. |
AperiodicSeries | Selects a venue, Atlas symbol, interval, and clock. |
AperiodicChannel | Selects all symbols in a live channel. |
AperiodicAggregate | A closed interval with typed provider fields. |
AperiodicOhlcv | The original BTCUSDT candle payload. |
AperiodicFlow | The original BTCUSDT taker-flow payload. |
AperiodicRowSource | Identifies how the adapter received a row. |
Supported capabilities
History accepts the true (Aperiodic arrival) and exchange clocks. Live subscriptions use
the arrival clock. The table lists the intervals you can request for each dataset over REST
and WebSocket. Live channels use dataset.exchange.interval. Eligible plans can omit the
Atlas symbol filter.
REST OpenAPI · WebSocket AsyncAPI
| Dataset IDs | Intervals | Minimum plan |
|---|---|---|
flow, trade_size, range, impact | 15s, 30s, 1m, 5m, 15m, 30m, 1h, 4h, 1d | Pro |
updownticks, run_structure, returns, slippage | 15s, 30s, 1m, 5m, 15m, 30m, 1h, 4h, 1d | Pro |
ohlcv, vtwap, l1_price | 15s, 30s, 1m, 5m, 15m, 30m, 1h, 4h, 1d | Pro |
basis, funding, open_interest, derivative_price | 1m, 5m, 15m, 30m, 1h, 4h, 1d | Pro |
l1_imbalance, l1_liquidity | 15s, 30s, 1m, 5m, 15m, 30m, 1h, 4h, 1d | Prime |
l2_imbalance, l2_liquidity | 15s, 30s, 1m, 5m, 15m, 30m, 1h, 4h, 1d | Prime |
flow_indices, positioning | 15m, 30m, 1h, 4h, 1d | Prime |
Requests for 15s and 30s history or live data require Institutional access and an eligible
dataset. A key without access can receive HTTP 403 over REST or not_entitled over WebSocket.
Published history varies by dataset, clock, symbol, date, and plan. Use
loader.describe() to check which files are available
for a series. See the wire evidence.
Use a native adapter for native bars, ticks, order books, or trading. Aperiodic serves aggregate data through this client. Its WebSocket supports closed live rows, snapshots, and retained replay for exact and all-symbol subscriptions. Raw history, previews, and institutional delivery use other provider interfaces.
Integrator attribution
The adapter automatically sends User-Agent: NautilusTrader/<version> on Aperiodic REST requests
and WebSocket handshakes, including retries and reconnects.
Create an account through the Aperiodic referral link to credit the signup to NautilusTrader. Signup and usage attribution are separate.
Examples
Run these commands from the repository root with an entitled APERIODIC_API_KEY. For Python,
use a NautilusTrader build with Aperiodic bindings in
python/.venv.
Request bounded history
Pass the dataset and two inclusive interval-close timestamps with UTC offsets and whole-second precision. The example defaults to Binance BTCUSDT on the 1m arrival clock. These commands request ten minutes of BTCUSDT 1-minute OHLCV, starting with the candle whose close is 00
UTC. Choose a completed window covered by your plan. Each example prints at most ten rows.CARGO_BUILD_JOBS=8 cargo run --locked -p nautilus-aperiodic --example historical_data -- \
ohlcv 2026-08-01T00:01:00Z 2026-08-01T00:10:00ZUse the provider exchange and Atlas symbol to select another market. These examples request the exchange-clock VWAP and TWAP for the Hyperliquid XYZ dex Tesla perpetual.
CARGO_BUILD_JOBS=8 cargo run --locked -p nautilus-aperiodic --example historical_data -- \
vtwap hyperliquid-perps perpetual-XYZ:TSLA-USDC:USDC 1m exchange \
2026-11-26T00:01:00Z 2026-11-26T00:10:00ZObserve the live feed
The data tester examples subscribe to Binance BTCUSDT OHLCV and flow, OKX BTC-USDT OHLCV, and Hyperliquid HIP-3 TSLA VWAP/TWAP. They request five minutes of retained replay, accept best-effort provider snapshots, and log rows with their delivery source for up to 150 seconds.
CARGO_BUILD_JOBS=8 cargo run --locked -p nautilus-aperiodic --features examples --example node_data_testerSee the Rust examples and Python examples for the full loader and actor setup.
Authentication and environments
Use your own Aperiodic subscription and an API key with access to the datasets and intervals you need. Downloaded and streamed data are subject to Aperiodic's data license.
Use the production Aperiodic REST and WebSocket endpoints. The adapter exposes no sandbox or preview mode. Aperiodic lists both candlesticks and flow metrics under Pro and above for 1-minute history and live. Historical availability depends on series coverage and your plan's retention. Check history by plan for the current limits.
Supply api_key explicitly or set APERIODIC_API_KEY in the process environment. The explicit
value takes precedence. The data client and loader resolve the key at construction. Importing the
Python package requires neither credentials nor a network connection.
The adapter sends the key in the X-API-KEY header for REST listings and WebSocket handshakes.
Signed Parquet downloads and public Binance instrument requests use no Aperiodic credentials.
Instruments and routing
The adapter attaches a native ID when the market and its units match a verified mapping. For other markets, the exchange and Atlas symbol identify the series and the payload has no instrument ID. Use this path for listed markets without complete native definitions and for inverse OKX BTC-USD, whose provider quote notional differs from the venue candle.
| Exchange | Atlas symbol | Native ID |
|---|---|---|
binance-futures | perpetual-BTC-USDT:USDT | BTCUSDT-PERP.BINANCE |
binance-futures | perpetual-TSLA-USDT:USDT | TSLAUSDT-PERP.BINANCE |
okx-perps | perpetual-BTC-USDT:USDT | BTC-USDT-SWAP.OKX |
okx-perps | perpetual-TSLA-USDT:USDT | TSLA-USDT-SWAP.OKX |
hyperliquid-perps | perpetual-BTC-USDC:USDC | BTC-USD-PERP.HYPERLIQUID |
hyperliquid-perps | perpetual-XYZ:TSLA-USDC:USDC | xyz:TSLA-USD-PERP.HYPERLIQUID |
The data client can publish the Binance BTCUSDT definition. Use each native venue client to publish its other definitions. Keep one publisher for each instrument in a node.
The adapter maps the Aperiodic exchange binance-futures and Atlas symbol
perpetual-BTC-USDT:USDT to BTCUSDT-PERP.BINANCE, the native Binance USD-M linear perpetual.
The series groups trades by arrival time at Aperiodic (timestamp=true on REST and
timestamp_type="true" in custom data metadata).
By default, the client fetches the definition from the Binance USD-M exchange information API
on connect and on instrument requests routed to the client. An instrument request with time bounds
can return the current definition only if the fetch starts within the window. When the data engine
has a catalog, pass force_instrument_update=true as a Boolean request parameter to fetch from Binance.
Build the DataType with series.data_type() for both history and live. For the original BTCUSDT
1m arrival-clock OHLCV and flow series, dataset.data_type(instrument_id) in Python and
AperiodicDataset::data_type in Rust still produce the same identities. Supply the Aperiodic client
ID for a node request or subscription. The default is APERIODIC. If you register a different
name, use that name as the client ID.
Coexistence with Binance
When a Binance USD-M client loads the same instrument, set publish_instrument=False
in Python or publish_instrument: false in Rust on the Aperiodic config. Route instrument
definitions and native bars to Binance, and route custom history and subscriptions to Aperiodic.
The two clients share the native instrument ID. Aperiodic's typed custom topics are separate from
Binance's BarType topics, so both can run in one node without competing for the same data topic.
from nautilus_trader.adapters.aperiodic import AperiodicDataClientConfig
from nautilus_trader.adapters.aperiodic import AperiodicDataClientFactory
from nautilus_trader.adapters.binance import BinanceDataClientConfig
from nautilus_trader.adapters.binance import BinanceDataClientFactory
from nautilus_trader.adapters.binance import BinanceInstrumentProviderConfig
from nautilus_trader.adapters.binance import BinanceProductType
from nautilus_trader.common import Environment
from nautilus_trader.live import LiveNode
from nautilus_trader.model import TraderId
node = (
LiveNode.builder("BINANCE-APERIODIC", TraderId("TESTER-001"), Environment.LIVE)
.add_data_client(
"BINANCE",
BinanceDataClientFactory(),
BinanceDataClientConfig(
product_type=BinanceProductType.USD_M,
instrument_provider=BinanceInstrumentProviderConfig(
load_all=False,
load_ids=["BTCUSDT-PERP.BINANCE"],
),
),
)
.add_data_client(
"APERIODIC",
AperiodicDataClientFactory(),
AperiodicDataClientConfig(publish_instrument=False),
)
.build()
)Discover datasets and inspect listings
Call loader.catalog() to list dataset IDs, live intervals, and field descriptions. Call
loader.symbols(exchange) for Atlas symbols and asset classes, including the dex for HIP-3 markets.
Use the Atlas symbol exactly as returned.
Call loader.describe(series, start_date, end_date) with inclusive UTC interval-open dates. It returns
partition dates and expiry, plus the provider's optional row count, ordered columns, and sample
cells. Samples describe entire listed partitions. The provider limits descriptions to 120 files
and may omit samples. The loader keeps signed download URLs inside the history transport.
Metadata API · REST OpenAPI
Historical requests
Use loader.request_series(series, start, end, limit) in Rust or await it in Python. Pass
None for an unlimited row count. request_history also accepts a verified native instrument
and uses the arrival clock with the shortest interval supported at 1m or above. To request
history through a node, have an actor call request_data with the series data type, client ID,
and both time bounds. The client correlates CustomDataResponse or
DataRequestFailed with the original request ID.
- Bounds. Supply inclusive interval-close bounds at most 31 days apart. Both standalone loaders
take Unix nanoseconds (
UnixNanosin Rust). - Partitions. The adapter requests inclusive UTC dates that cover the corresponding interval opens. A candle closing exactly at midnight belongs to the previous day's open partition. Aperiodic lists monthly files before 2026-08-01 and daily files from that date. A single listing can contain both.
- Downloads. The adapter downloads overlapping partitions through their signed URLs. If the listing expires, it can refresh once within the original deadline and requires the same partition coverage on refresh.
- Results. Rows arrive in ascending close order. Identical duplicates collapse and conflicting rows fail the request. An optional positive row limit keeps the earliest matching rows after downloading and decoding all selected partitions. Use a narrow time window to limit downloads.
- Failures. The request has a 60-second deadline and accepts at most 32 overlapping files. Download, decode, and conversion errors fail the whole request, including a non-finite metric in a matching row. For a non-finite metric, the error names the field and the partition's start date. Narrow the close bounds to locate the affected interval, then request ranges that exclude its close. The result is empty when the bounds or available files contain no matching rows.
In Python, data_type and request_history raise ValueError for an unsupported instrument.
request_history also rejects a zero limit with ValueError. Invalid ranges and retrieval failures
raise RuntimeError when you await the request.
The decoder applies file and row limits. Its uncompressed byte budget uses sizes declared in the Parquet footer. Malformed page data can exceed that budget during decoding. If the decoder panics, builds that unwind fail the request. A build that aborts on panic terminates the process.
Timestamps and historical availability
A row's provider time is the interval open. The supported Parquet and live row formats use epoch
microseconds. The adapter adds the selected interval to set ts_event to the exclusive close
in Unix nanoseconds. AperiodicAggregate.ts_open retains the inclusive open. Explicit history uses
the modeled close as ts_init. WebSocket rows retain their receipt time, including rows delivered
after buffering. REST recovery records the time the archive request completes.
Feed the CustomData wrappers from the loader into a backtest to retain the payload type and
routing metadata. Historical timestamps do not capture actual publication or late-arrival delay.
Use the arrival clock for the closest match to live interval assignment.
Impact's large_trade_reversal uses five subsequent trades. Aperiodic supplies no per-row
availability timestamp for that field. Standard history, WebSocket rows, and REST recovery omit it.
Use loader.request_archive_fields(series, start, end) to inspect the archived values by interval
close. In Python, each result is a pair of the exclusive close in Unix nanoseconds and a dictionary
keyed by provider field name. An explicit null has a value of None.
Provider precision
AperiodicAggregate.fields keeps the provider's field names and units. Prices, quantities, and
notionals use decimals. Integer columns retain integer values and continuous metrics retain their
floating-point precision. A present null stays null. An omitted live field has no entry.
The adapter drops a WebSocket row if it cannot decode a recognized field. If a Slippage row
contains a numeric slippage_mean that cannot be represented exactly as a Decimal, the adapter
publishes the row with that field set to null and logs a warning.
OKX OHLCV volume counts contracts. A linear BTC-USDT contract represents 0.01 BTC. The adapter does not multiply provider volume when it attaches a native ID.
AperiodicOhlcv carries prices in USDT per BTC, volume in BTC, and volume_notional in USDT.
The adapter keeps the provider's Float64 historical prices and Float32 historical volumes as decimals
that round-trip to the stored floats. Multiple native quantities can round to the same Float32, so
historical volume does not recover the exact Binance size. Live prices, quantities, and notionals
are parsed directly from JSON number tokens as decimals.
In AperiodicFlow, taker and size-bucket volumes use USDT notionals. volume_delta is in BTC and
volume_delta_notional is in USDT. Counts are integers, percentage fields are fractions, and a
missing toxicity score stays null. See flow metrics and the
checked Parquet schema.
Live subscriptions and gaps
For one symbol, subscribe with the same data type used for history. For all symbols in a dataset,
exchange, and interval, subscribe with the data type from AperiodicChannel and the Aperiodic
client ID. Pass options in the custom data subscription's params. The first subscription opens
the WebSocket.
| Option | Default | Behavior |
|---|---|---|
snapshot | false | Accept best-effort snapshots sent by the provider after subscribing. |
since | Omitted | Replay retained rows from this UTC epoch millisecond interval open. |
Use an integer aligned to the interval open. Convert a Unix nanosecond open to milliseconds by
dividing by 1,000,000. Replay covers intervals of 1m and longer. To backfill 15s and 30s, request
REST history once the daily file is available. Set since on the first subscription to a series
or channel. To request a new replay, release the subscription and subscribe again.
Each Aperiodic data client uses one WebSocket connection and tracks up to 5,000 distinct exact series. Aperiodic limits explicitly listed symbols to 1,000 per channel and 5,000 per connection. Pro allows 50 channels per connection and requires a list of up to 100 symbols per channel. Prime plans allow 200 channels per connection, and Institutional allows up to 1,000. Prime and Institutional plans support all-symbol subscriptions.
For workloads that need more series or channels, split subscriptions across clients with distinct client IDs and stay within your account's connection limits. Assign each live series to one client to avoid duplicate rows. When one client subscribes to all symbols in a channel, route any exact subscriptions for that channel to the same client.
Keep one publisher for the Binance BTCUSDT definition in a node. Disable publish_instrument
on the other Aperiodic clients.
Aperiodic can grant a channel even if the requested symbol is unknown. Check the Atlas symbol with
loader.symbols(exchange) when a subscription receives no rows.
Rows from an all-symbol grant keep their exact-series topics and payloads. In a Python actor,
call subscribe_data with each series data type and omit the client ID to receive its rows
without requesting another venue subscription. Add a subscription the same way for each new symbol
you want to consume. Rust consumers can also use message bus patterns to match exact-series topics.
An exact subscription added after the client sends an all-symbol request joins the live feed if
the provider grants the request. The client ignores its since and snapshot options and logs a
warning if either requests catch-up. If the provider denies the request, the exact subscription
keeps those options.
When the last all-symbol subscription to a channel ends, the client releases the all-symbol grant
and restores any remaining exact subscriptions.
The client buffers replay chunks and live rows that arrive during replay, then publishes in interval order.
For the same series and interval open, a retained replay row takes precedence over live data.
Either takes precedence over a snapshot. Rows expose source as AperiodicRowSource.
Buffered live rows retain their live source. Logs report missing intervals and incomplete coverage.
All-symbol replay skips opens at or before each series' last delivered open, even if the requested
since is earlier. If the client buffer fills, the client logs a gap, delivers the buffered rows
in order, and resumes live delivery.
After a transport interruption, the client restores active subscriptions with backoff. For intervals of 1m or longer it requests retained replay from the last delivered open of an exact series or the earliest delivered open among the tracked series in an all-symbol channel. If the connection drops between replay pages, replay resumes from the first open after the last completed page. It suppresses overlap by full series identity and interval open. Rows buffered during a handoff carry across interruptions while the same subscription remains active. For exact subscriptions, REST recovery requests matching arrival-clock Parquet before releasing buffered rows. A request spans up to 120 intervals from the first to the last missing open within the prior 24 hours, with an eight-second deadline. The adapter can resume live delivery with gaps if recovery fails or exceeds those bounds. Logs identify the affected series and interval opens.
Aperiodic retains 1m through 4h bars for 36 hours and 1d bars for 48 hours. A replay completion
reports the first and last covered interval opens in from and to. If from is later than
since, fetch the earlier bars from REST. Use REST for opens listed in missing as well.
Request those bars by their close timestamps once the daily files are available. Aperiodic
publishes each daily file after its UTC day closes.
A replay can truncate within the retention window. The adapter requests the next page from
to plus one interval.
Each replay on a connection can request up to 16 pages within a 30-second deadline.
For all-symbol subscriptions, the adapter publishes rows through to after each truncated page
and holds newer live rows for the next page. Exact subscriptions hold rows through the last page
and any bounded REST recovery.
The adapter logs the unresolved range of bar opens if the provider reports replay unavailable
or refuses a continuation, if a truncated page has no valid next cursor, or if a limit stops the
replay. If the deadline expires before a page completes, the client reconnects. Use REST to fill
the logged range once the daily files are available.
For a series that normally publishes every interval, track the opens you receive to detect gaps.
See Aperiodic's replay retention.
On reconnect, the client restores explicit series before it requests the all-symbol grant. Recovery for the remaining series depends on retained WebSocket replay and the provider's replay limits. See the provider's reconnect contract.
The client waits up to five seconds for a subscription acknowledgement. A top-level limit_exceeded
error triggers a one-second pause before the client retries on the same connection. Continuations
keep their original replay deadline during the pause. The client skips subscriptions you release
and requests for channels the provider revokes during the pause. A repeated refusal of a new
subscription leaves existing grants active. Release and resubscribe to try again. The client
reconnects if a second top-level limit_exceeded rejects the initial exact-series restore request.
A repeated throttle on a continuation ends WebSocket replay and keeps the live grant, with bounded
REST recovery for any eligible gap. A per-channel rejection of an exact series leaves the
connection open.
If the provider rejects an unsubscribe, the client reconnects.
If all-symbol restoration is refused, any restored exact subscriptions remain active. Release and
resubscribe to retry the all-symbol grant.
The client logs rejection codes and any advertised delivery delay. If the provider rejects or revokes a channel, check the key's plan, dataset, and interval entitlements.
If reconnect retries run out or authorization fails, correct the connection or credential problem, then disconnect and reconnect to resume active subscriptions. Recreate the client to use a changed key.
Configuration
Register AperiodicDataClientFactory and AperiodicDataClientConfig with the LiveNode builder.
Pass the same config to a standalone loader for REST access.
| Setting | Effective default | Purpose |
|---|---|---|
api_key | APERIODIC_API_KEY if omitted | Authenticates Aperiodic REST listings and WebSocket access. |
base_url_http | https://aperiodic.io/api/v1 | Sets the Aperiodic REST base URL, including the API prefix. |
base_url_ws | wss://stream.aperiodic.io/v1/stream | Sets the Aperiodic WebSocket endpoint. |
base_url_http_binance | https://fapi.binance.com | Overrides the origin for native Binance USD-M metadata. |
publish_instrument | true | Publishes the definition and serves instrument requests. |
Use https:// and wss:// for remote Aperiodic endpoints. For local test peers, plain HTTP and
WebSocket connections require a literal loopback IP, such as 127.0.0.1 or [::1]. The
authenticated HTTP client bypasses system proxy settings for loopback HTTP. It validates its
endpoint at construction. The WebSocket validates its endpoint when it first opens. See
configuration for node options and the
crate README for build flags.
Aperiodic documentation
Integrations
NautilusTrader uses modular adapters to connect to trading venues and data providers. The adapters translate raw APIs into a unified interface and...
AX Exchange
AX Exchange is a centralized and regulated derivatives exchange for traditional underlying asset classes. Architect Bermuda Ltd. operates AX under a license...