Skip to content

v0.4.0: Phase7 v1.6.0 Schema with 10 Global Exchange Sessions

Choose a tag to compare

@terrylica terrylica released this 18 Oct 02:36
· 107 commits to main since this release

Release v0.4.0: Phase7 v1.6.0 Schema - Production Ready

🎯 Summary

This release implements the Phase7 v1.6.0 OHLC schema with 10 global exchange session flags, validated against 355,970 bars of real Exness EURUSD data (12 months, 1.92 GB).

⚠️ BREAKING CHANGES

Schema Changes

  • v1.6.0 schema: 30 columns (up from 19 in v1.5.0)
  • 10 new exchange session flags:
    • is_nyse_session (New York Stock Exchange)
    • is_lse_session (London Stock Exchange)
    • is_xswx_session (SIX Swiss Exchange)
    • is_xfra_session (Frankfurt Stock Exchange)
    • is_xtse_session (Toronto Stock Exchange)
    • is_xnze_session (New Zealand Exchange)
    • is_xtks_session (Tokyo Stock Exchange)
    • is_xasx_session (Australian Securities Exchange)
    • is_xhkg_session (Hong Kong Stock Exchange)
    • is_xses_session (Singapore Exchange)

Implementation Changes

  • Session detection: Now uses exchange_calendars.is_open_on_minute() for minute-level precision
  • Critical bug fix: Fixed midnight detection bug (was checking 00:00:00, now checks each minute individually)

✨ Features

Lunch Break Support

  • Tokyo: 11:30-12:30 JST (automatically excluded from trading hours)
  • Hong Kong: 12:00-13:00 HKT
  • Singapore: 12:00-13:00 SGT

Automatic Handling

  • ✅ DST transitions: DuckDB timezone functions handle automatically
  • ✅ Holiday detection: NYSE and LSE holidays (excludes weekends)
  • ✅ Major holidays: Both NYSE and LSE closed
  • ✅ Schedule changes: Tokyo extended hours (Nov 5, 2024: 15:00→15:30) detected automatically
  • ✅ Concurrent flags: Multiple exchanges can be open simultaneously (not mutually exclusive)

🔬 Validation Results

100% accuracy on 355,970 bars of real Exness EURUSD data

Test 1: Tokyo Lunch Breaks ✅

  • Lunch period (11:30-12:29 JST): 0/59 minutes flagged
  • Morning session (9:00-11:29 JST): 150/150 minutes flagged (100%)
  • Afternoon session (12:30-15:00 JST): 151/151 minutes flagged (100%)

Test 2: Holiday Detection ✅

  • US Thanksgiving: NYSE closed (0 session flags)
  • Christmas: Both NYSE+LSE closed
  • UK August Bank Holiday: LSE closed, NYSE open
  • Regular trading days: No false positives

Test 3: DST Transitions ✅

  • Before DST (Nov 1): NYSE at 13:30 UTC
  • After DST (Nov 4): NYSE at 14:30 UTC
  • Automatic shift detection verified

Test 4: Weekend Gaps ✅

  • Saturday: 0 bars (forex market closed)
  • Sunday: Market reopens at 22:05 UTC
  • New Zealand opens first (Monday 11:05 NZDT)
  • 48.1-hour gap validated

Test 5: Tokyo Extended Hours ✅

  • Nov 1 (before): Last minute 14:59 JST
  • Nov 5 (transition): Last minute 15:29 JST
  • Nov 6 (after): Last minute 15:29 JST

Test 6: Multi-Exchange Overlaps ✅

  • London-NY overlap: 120 minutes concurrent trading
  • Asian triple overlap: 150 minutes (Tokyo + HK + Singapore)
  • Maximum 5 exchanges open simultaneously (13.6% of time)

🏗️ Architecture

exchange_calendars Integration

  • Delegates all session/holiday logic to exchange_calendars.is_open_on_minute()
  • Handles lunch breaks, DST, holidays, schedule changes automatically
  • Zero code changes needed when exchange schedules update
  • Hybrid approach: date-level holidays + minute-level sessions

Validation Documentation

  • E2E Validation Report: docs/validation/E2E_VALIDATION_RESULTS_v1.6.0.md (11K)
  • Weekend Gap Analysis: docs/validation/WEEKEND_GAP_VALIDATION_SUMMARY.md (4K)
  • Workspace Survey: docs/validation/WORKSPACE_SURVEY_2025-10-17.md (8K)
  • Trading Hours Research: Comprehensive industry research backing architecture decisions
  • Migration Guide: Documenting midnight bug fix and breaking changes

🐛 Fixes

  • Critical midnight detection bug: Session flags were checked at 00:00:00 and applied to entire day
    • Impact: All session flags were incorrectly 0 for Asian exchanges
    • Fix: Now checks each minute individually using exact timestamp match
  • Resolve 7 critical functionality issues (CLI, versions, schema)
  • Fix session column names (is_xtks_session not is_jpx_session)

📊 Statistics

  • Commits: 18 since v0.3.1
  • Test Data: 355,970 OHLC bars, 1.92 GB database
  • Date Range: 12 months (Nov 2024 - Oct 2025)
  • Exchanges: 10 global exchanges with session flags
  • CI Status: All tests passing
  • Validation: 100% accuracy on all 6 test suites

📚 Documentation

  • Complete E2E validation report with real data
  • Trading hours research backing architecture
  • Migration guide for v1.6.0 breaking changes
  • Updated MODULE_ARCHITECTURE.md with session_detector.py
  • Updated DATABASE_SCHEMA.md with 30-column schema

🚀 Production Ready

This release is production ready with:

  • ✅ 100% validation accuracy on real market data
  • ✅ All CI tests passing
  • ✅ Comprehensive documentation
  • ✅ Off-the-shelf exchange_calendars library proven reliable
  • ✅ Zero code changes needed for future schedule updates

Full Changelog: v0.3.1...v0.4.0