Skip to content

Per-venue trading calendars and extension points for venues and data addresses (2.11.0) - #40

Merged
arbuzovv merged 2 commits into
devfrom
feat/venue-calendars-algopack
Oct 14, 2026
Merged

arbuzovv merged 2 commits into
devfrom
feat/venue-calendars-algopack

Conversation

@arbuzovv

@arbuzovv arbuzovv commented Oct 14, 2026 •

Copy link
Copy Markdown

What changes

Each listing is now judged by its own venue's hours, so one backtest can hold instruments from markets that keep different hours. Extensions can now add venues, calendars and scheme:// data addresses without patching the engine. Version bumped to 2.11.0; release notes are in release-notes.md.

  • ziplime.utils.venue_calendars
    • The MIC → calendar table covers US equity venues, CME, NYMEX, ICE and the crypto venues.
    • clock_calendar_name() gives one clock for a run that spans venues: 24/5 when their hours differ, 24/7 when one never closes.
    • ZIPLIME_VENUE_CALENDARS overrides the table.
  • ExchangeAsset.trading_calendar. BarData._venue_is_open asks the listing's own venue: by session day on a daily run, by minute intraday.
  • rebalance() leaves a leg alone while its market is shut. Before, the run failed on the first such bar.
  • The no-price error names the closed venue and both calendars. Before, it blamed delisting.
  • Extension point for venues. register_venue_calendars() / unregister_venue_calendars(), and the ziplime.venue_calendars entry point group, loaded on first lookup. Precedence: shipped table, then extensions, then the environment override.
  • Extension point for data addresses. ziplime.data.data_sources.address_schemes: register_address_scheme(scheme, mount) and the ziplime.address_schemes entry point group. _resolve_named_data_source mounts scheme://... through it; hf:// stays built in.

Single-market backtests are unchanged.

Where it comes from

The per-venue mechanism is the part of the 1.20.9 build that the backtesting service has run in production since September and that 2.10.3 lacks. It was ported by three-way merge against a283eadf, the commit that build branched from, with its tests.

Verified

  • Core suite. pytest tests with all extras: 1228 passed, 2 xfailed, nothing failing. New tests: tests/data/test_address_schemes.py, plus the extension tests in tests/utils/test_venue_calendars.py.
  • Real backtests in the service's images (the first commit of this PR; the engine code of the mechanism is unchanged since):

The last row is the regression this fixes.

To release

Merge into dev, then into master. Then push a v2.11.0 tag: publish-to-pypi.yml publishes on tags. zipfinam 1.26.10.1 requires ziplime>=2.11.0, so release this first.

🤖 Generated with Claude Code

arbuzovv and others added 2 commits October 14, 2026 09:44
Each listing is now judged by its own venue's hours. Before, every listing
was judged by the simulation's calendar, so on an hourly run clocked on
Moscow an American ETF counted as tradeable at 10:01 Moscow (03:01 in New
York) and the order failed with CannotOrderDelistedAsset.

- ziplime.utils.venue_calendars: MIC -> calendar table, a FORTS calendar
  built on XMOS, clock_calendar_name() for a run that spans venues (24/5
  when their hours differ), ZIPLIME_VENUE_CALENDARS overrides.
- ExchangeAsset.trading_calendar; BarData asks the listing's venue (by
  session day on a daily run, by minute intraday).
- rebalance() leaves a leg alone while its market is shut, instead of
  failing the run on the first such bar.
- The no-price error names the closed venue and both calendars.
- algopack://market/dataset[/granularity] mounts and
  context.algopack_dataset(), adapted to the DataSource API that takes a
  trading calendar. New extra: ziplime[algopack] (moexalgo).

Single-market backtests are unchanged. Ported from the 1.20.9 build the
backtesting service has run since September, with its tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and addresses

The Moscow-specific parts of the previous commit belong in zipfinam, the
Russian-market extension, not in the core:

- AlgoPack is removed from ziplime (connector, algopack_dataset(), the
  algopack extra and its tests). zipfinam ships it.
- The FORTS calendar and the MISX/RTSX venues are removed from the venue
  table. zipfinam registers them.

What stays is the engine mechanism and two ways for an extension to plug in:

- ziplime.utils.venue_calendars: register_venue_calendars() /
  unregister_venue_calendars(), and the ziplime.venue_calendars entry point
  group, loaded on first lookup. Precedence: shipped table < extensions <
  ZIPLIME_VENUE_CALENDARS.
- ziplime.data.data_sources.address_schemes: register_address_scheme() and
  the ziplime.address_schemes entry point group. _resolve_named_data_source
  mounts scheme://... through it; hf:// stays built in. Extensions no longer
  need to patch TradingAlgorithm.

Installing an extension is enough; nothing has to import it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@arbuzovv arbuzovv changed the title Per-venue trading calendars and MOEX AlgoPack datasets (2.11.0) Per-venue trading calendars and extension points for venues and data addresses (2.11.0) Oct 14, 2026
@arbuzovv
arbuzovv merged commit 7263995 into dev Oct 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant