exness-data-preprocess 0.3.1__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/.cz.toml +1 -1
- exness_data_preprocess-0.5.0/CHANGELOG.md +169 -0
- exness_data_preprocess-0.5.0/CLAUDE.md +197 -0
- exness_data_preprocess-0.5.0/DOCUMENTATION.md +270 -0
- exness_data_preprocess-0.5.0/Makefile +62 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/PKG-INFO +63 -29
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/README.md +62 -28
- exness_data_preprocess-0.5.0/RELEASE_NOTES.md +26 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/DATABASE_SCHEMA.md +39 -23
- exness_data_preprocess-0.5.0/docs/MODULE_ARCHITECTURE.md +1016 -0
- exness_data_preprocess-0.5.0/docs/PHASE2_SESSION_VECTORIZATION_PLAN.yaml +268 -0
- exness_data_preprocess-0.5.0/docs/PHASE3_SQL_GAP_DETECTION_PLAN.yaml +298 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/README.md +60 -16
- exness_data_preprocess-0.5.0/docs/RESEARCH_PATTERNS.md +223 -0
- exness_data_preprocess-0.5.0/docs/TRADING_HOURS_RESEARCH.md +1620 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/UNIFIED_DUCKDB_PLAN_v2.md +12 -7
- exness_data_preprocess-0.5.0/docs/optimization/OPTIMIZATION_OPPORTUNITIES_2025-10-18.md +525 -0
- exness_data_preprocess-0.5.0/docs/plans/CLAUDE_MD_AUDIT_2025-10-16_PASS2.md +356 -0
- exness_data_preprocess-0.5.0/docs/plans/CLAUDE_MD_VERIFICATION_CHECKLIST_2025-10-16.md +382 -0
- exness_data_preprocess-0.5.0/docs/plans/CLAUDE_MD_VERIFICATION_FINDINGS_2025-10-16.md +312 -0
- exness_data_preprocess-0.5.0/docs/plans/DOCUMENTATION_AUDIT_2025-10-15.md +331 -0
- exness_data_preprocess-0.5.0/docs/plans/DOCUMENTATION_AUDIT_PASS2_2025-10-15.md +192 -0
- exness_data_preprocess-0.5.0/docs/plans/DOCUMENTATION_BEST_PRACTICES_LINE_COUNTS.md +512 -0
- exness_data_preprocess-0.5.0/docs/plans/EXCHANGE_SESSION_AUDIT_2025-10-17.md +480 -0
- exness_data_preprocess-0.5.0/docs/plans/FUNCTIONALITY_VALIDATION_REPORT_2025-10-15.md +382 -0
- exness_data_preprocess-0.5.0/docs/plans/FUNCTIONALITY_VALIDATION_REPORT_2025-10-16.md +362 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/plans/PHASE7_v1.6.0_REFACTORING_PROGRESS.md +47 -26
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/plans/REFACTORING_CHECKLIST.md +20 -20
- exness_data_preprocess-0.5.0/docs/plans/RESEARCH_PATTERNS_CANONICALIZATION_2025-10-17.md +291 -0
- exness_data_preprocess-0.5.0/docs/plans/SCHEMA_v1.6.0_AUDIT_FINDINGS.md +399 -0
- exness_data_preprocess-0.5.0/docs/plans/SCHEMA_v1.6.0_MIGRATION_GUIDE.md +545 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/plans/SESSION_2025-10-15_SUMMARY.md +64 -54
- exness_data_preprocess-0.5.0/docs/research/GAP_DETECTION_COMPARISON.md +478 -0
- exness_data_preprocess-0.5.0/docs/research/GAP_DETECTION_SQL_APPROACH.md +410 -0
- exness_data_preprocess-0.5.0/docs/research/HYBRID_SESSION_DETECTION_ANALYSIS.md +858 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/01-methodology.md +3 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/02-mode-truncated-analysis.md +2 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/05-final-recommendations.md +4 -2
- exness_data_preprocess-0.5.0/docs/research/gap_detection_implementation_example.py +193 -0
- exness_data_preprocess-0.5.0/docs/validation/ARCHITECTURE_AUDIT_2025-10-17.md +384 -0
- exness_data_preprocess-0.5.0/docs/validation/ARCHITECTURE_EFFICIENCY_AUDIT_2025-10-18.md +350 -0
- exness_data_preprocess-0.5.0/docs/validation/DOCUMENTATION_SURVEY_v1.7.0.md +260 -0
- exness_data_preprocess-0.5.0/docs/validation/E2E_VALIDATION_RESULTS_v1.6.0.md +288 -0
- exness_data_preprocess-0.5.0/docs/validation/SPIKE_TEST_RESULTS_PHASE1_2025-10-18.md +250 -0
- exness_data_preprocess-0.5.0/docs/validation/SPIKE_TEST_RESULTS_PHASE2_2025-10-18.md +322 -0
- exness_data_preprocess-0.5.0/docs/validation/WEEKEND_GAP_VALIDATION_SUMMARY.md +96 -0
- exness_data_preprocess-0.5.0/docs/validation/WORKSPACE_SURVEY_2025-10-17.md +246 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/examples/basic_usage.py +3 -3
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/examples/batch_processing.py +1 -1
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/pyproject.toml +2 -1
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/__init__.py +2 -2
- exness_data_preprocess-0.5.0/src/exness_data_preprocess/api.py +290 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/database_manager.py +4 -4
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/exchanges.py +52 -4
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/gap_detector.py +37 -60
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/ohlc_generator.py +96 -30
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/processor.py +22 -12
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/query_engine.py +1 -1
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/schema.py +9 -8
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/session_detector.py +82 -15
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/tests/test_functional_regression.py +0 -1
- exness_data_preprocess-0.3.1/CHANGELOG.md +0 -60
- exness_data_preprocess-0.3.1/CLAUDE.md +0 -475
- exness_data_preprocess-0.3.1/RELEASE_NOTES.md +0 -6
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/.github/workflows/ci.yml +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/.github/workflows/pre-commit-autoupdate.yml +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/.github/workflows/publish.yml +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/.gitignore +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/.pre-commit-config.yaml +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/AUTHORS.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/CONTRIBUTING.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/GITHUB_PYPI_SETUP.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/LICENSE +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/cliff-release-notes.toml +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/cliff.toml +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/EXNESS_DATA_SOURCES.md +0 -0
- /exness_data_preprocess-0.3.1/PYDANTIC_REFACTORING_PLAN.md → /exness_data_preprocess-0.5.0/docs/archive/PYDANTIC_REFACTORING_PLAN_v0.2.0_COMPLETE.md +0 -0
- /exness_data_preprocess-0.3.1/PYDANTIC_REFACTORING_STATUS.md → /exness_data_preprocess-0.5.0/docs/archive/PYDANTIC_REFACTORING_STATUS_v0.2.0_COMPLETE.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/archive/UNIFIED_DUCKDB_PLAN_v1.0.0_LEGACY.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/implementation-plan.yaml +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/planning-index.yaml +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/plans/PHASE7_v1.5.0_REFACTORING_PLAN.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/compression-benchmarks/README.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/compression-benchmarks/test_all_compression_methods.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/compression-benchmarks/test_delta_encoding_properly.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/compression-benchmarks/test_parquet_compression_methods.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/03-hurdle-model-analysis.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/04-temporal-patterns.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/README.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/scripts/reproduction_guide.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/visualizations/hurdle-model/hurdle_decomposition.png +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/visualizations/mode-truncated/cv_mode_comparison.png +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/visualizations/mode-truncated/distribution_overlay.png +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/visualizations/mode-truncated/signal_quality_comparison.png +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/visualizations/mode-truncated/variance_decomposition.png +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/visualizations/temporal/concentration_curve.png +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-spread-analysis/visualizations/temporal/percentile_analysis.png +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/01-methodology.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/02-baseline-sep2024.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/03-multiperiod-validation.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/04-discoveries-and-plan-evolution.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/README.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/findings/baseline-sep2024-comprehensive-summary.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/findings/phase2-mean-reversion-report.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/findings/phase3-volatility-model-report.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/findings/phase4-5-statistical-tests-survivorship-report.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/baseline-sep2024/01_mean_reversion_analysis.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/baseline-sep2024/02_volatility_model_simple.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/baseline-sep2024/03_liquidity_crisis_detection.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/baseline-sep2024/04_regime_detection_analysis.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase1_data_validation.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase2_mean_reversion.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase3_volatility_model.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase4_statistical_tests.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase5_survivorship_bias.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase5_survivorship_bias_v1.0.1.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase6a_interval_analysis.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase6b_price_clustering.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase6c_combined_pattern.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/reproduction_guide.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/visualization/diagnostic_burst_decay.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/visualization/generate_interactive_dashboard.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/visualization/generate_lightweight_dashboard.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/docs/research/eurusd-zero-spread-deviations/scripts/visualization/prepare_visualization_data.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/cli.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/downloader.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/models.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/src/exness_data_preprocess/tick_loader.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/tests/README.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/tests/__init__.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/tests/archive/E2E_TESTING_PLAN_v1.0.0.md +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/tests/conftest.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/tests/test_basic.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/tests/test_models.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/tests/test_processor_pydantic.py +0 -0
- {exness_data_preprocess-0.3.1 → exness_data_preprocess-0.5.0}/tests/test_types.py +0 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to exness-data-preprocess will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.5.0] - 2025-10-18
|
|
9
|
+
|
|
10
|
+
### ⚡ Performance
|
|
11
|
+
|
|
12
|
+
- **ohlc**: Implement incremental OHLC generation with 7.3x speedup
|
|
13
|
+
|
|
14
|
+
Replace full regeneration with incremental updates for new data only.
|
|
15
|
+
|
|
16
|
+
Implementation:
|
|
17
|
+
- Add optional `start_date`/`end_date` parameters to `regenerate_ohlc()`
|
|
18
|
+
- Support three modes: full regeneration, incremental append, range update
|
|
19
|
+
- Use `INSERT OR IGNORE` pattern with PRIMARY KEY for duplicate handling
|
|
20
|
+
- Track `earliest_added_month` in processor for incremental triggers
|
|
21
|
+
|
|
22
|
+
Performance (measured via spike test):
|
|
23
|
+
- Full regeneration: 8.05s (303K bars, 7 months)
|
|
24
|
+
- Incremental update: 1.10s (43K new bars, 1 month)
|
|
25
|
+
- Speedup: 7.3x (86.3% time reduction)
|
|
26
|
+
|
|
27
|
+
Validation:
|
|
28
|
+
- Spike test: 100% row count match, zero duplicates
|
|
29
|
+
- All 48 existing tests pass (backward compatible)
|
|
30
|
+
|
|
31
|
+
SSoT: docs/validation/SPIKE_TEST_RESULTS_PHASE1_2025-10-18.md
|
|
32
|
+
|
|
33
|
+
BREAKING CHANGE: None (optional parameters maintain existing API)
|
|
34
|
+
|
|
35
|
+
- **session**: Implement vectorized session detection with 2.2x speedup
|
|
36
|
+
|
|
37
|
+
Pre-compute trading minutes for vectorized `.isin()` lookup instead of per-timestamp `.apply()` calls.
|
|
38
|
+
|
|
39
|
+
Implementation:
|
|
40
|
+
- Add `_precompute_trading_minutes()` helper in SessionDetector
|
|
41
|
+
- Replace `.apply()` loop with vectorized `.isin()` lookup
|
|
42
|
+
- Preserve accuracy via exchange_calendars.is_open_on_minute()
|
|
43
|
+
- Handle lunch breaks (Tokyo 11:30-12:30, Hong Kong/Singapore 12:00-13:00)
|
|
44
|
+
|
|
45
|
+
Performance (measured via spike test):
|
|
46
|
+
- Current approach: 5.99s (302K bars, 10 exchanges)
|
|
47
|
+
- Vectorized approach: 2.69s (302K bars, 10 exchanges)
|
|
48
|
+
- Speedup: 2.2x (55.2% time reduction)
|
|
49
|
+
- Combined Phase 1+2: ~16x total speedup (8.05s → 0.50s)
|
|
50
|
+
|
|
51
|
+
Validation:
|
|
52
|
+
- Spike test: 100% accuracy match across all 10 exchanges
|
|
53
|
+
- All 48 existing tests pass (backward compatible)
|
|
54
|
+
|
|
55
|
+
SSoT: docs/PHASE2_SESSION_VECTORIZATION_PLAN.yaml (v2.0.0)
|
|
56
|
+
Validation: docs/validation/SPIKE_TEST_RESULTS_PHASE2_2025-10-18.md
|
|
57
|
+
|
|
58
|
+
BREAKING CHANGE: None (transparent drop-in replacement)
|
|
59
|
+
|
|
60
|
+
- **gap**: Implement SQL gap detection with complete coverage
|
|
61
|
+
|
|
62
|
+
Replace Python iteration with SQL EXCEPT query to detect ALL gaps (before + within + after), not just edge gaps.
|
|
63
|
+
|
|
64
|
+
Implementation:
|
|
65
|
+
- Replace lines 94-155 (62 lines) with SQL EXCEPT query (34 lines)
|
|
66
|
+
- Use DuckDB `generate_series()` + EXCEPT operator
|
|
67
|
+
- Detect internal gaps missed by Python MIN/MAX approach
|
|
68
|
+
|
|
69
|
+
Correctness (measured via spike test):
|
|
70
|
+
- Python approach: 41 gaps detected (missed internal gap 2022-03)
|
|
71
|
+
- SQL approach: 42 gaps detected (correctly found 2022-03)
|
|
72
|
+
- Bug fixed: Internal gaps now detected
|
|
73
|
+
|
|
74
|
+
Maintainability:
|
|
75
|
+
- LOC reduction: 46% (62 → 34 lines)
|
|
76
|
+
- Complexity: O(n) Python loops → O(1) SQL query
|
|
77
|
+
|
|
78
|
+
Validation:
|
|
79
|
+
- Spike test: SQL detects gaps Python iteration misses
|
|
80
|
+
- All 48 existing tests pass (backward compatible)
|
|
81
|
+
|
|
82
|
+
SSoT: docs/PHASE3_SQL_GAP_DETECTION_PLAN.yaml (v2.0.0)
|
|
83
|
+
|
|
84
|
+
BREAKING CHANGE: None (same method signature, better correctness)
|
|
85
|
+
|
|
86
|
+
### 📚 Documentation
|
|
87
|
+
|
|
88
|
+
- Add comprehensive SSoT plans with spike test validation
|
|
89
|
+
|
|
90
|
+
Create machine-readable OpenAPI 3.1.0 specifications documenting implementation plans with SLOs and discovered nuances.
|
|
91
|
+
|
|
92
|
+
Files Added:
|
|
93
|
+
- docs/PHASE2_SESSION_VECTORIZATION_PLAN.yaml (v1.0.0 → v2.0.0)
|
|
94
|
+
- docs/PHASE3_SQL_GAP_DETECTION_PLAN.yaml (v1.0.0 → v2.0.0)
|
|
95
|
+
- docs/validation/SPIKE_TEST_RESULTS_PHASE1_2025-10-18.md
|
|
96
|
+
- docs/validation/SPIKE_TEST_RESULTS_PHASE2_2025-10-18.md
|
|
97
|
+
- docs/validation/DOCUMENTATION_SURVEY_v1.7.0.md
|
|
98
|
+
|
|
99
|
+
SLOs Defined:
|
|
100
|
+
- Availability: API surface backward compatible
|
|
101
|
+
- Correctness: Exact match with existing implementation
|
|
102
|
+
- Observability: Print statements show progress
|
|
103
|
+
- Maintainability: Off-the-shelf libraries, no custom code
|
|
104
|
+
|
|
105
|
+
Pattern Established:
|
|
106
|
+
- Spike test first (validate theory before implementation)
|
|
107
|
+
- Iterative SSoT plan updates (v1.0.0 → v2.0.0 with discoveries)
|
|
108
|
+
- Measured results (no theoretical claims without validation)
|
|
109
|
+
|
|
110
|
+
### ♻️ Refactoring
|
|
111
|
+
|
|
112
|
+
- **schema**: Centralize OHLC schema in schema.py module - Create schema.py with OHLCSchema class as single source of truth - Reduce coupling from 42 to 5 update locations (88% reduction) - Replace hardcoded column lists in docs with pointers to schema.py - Delete obsolete PYDANTIC_TEST_STRATEGY.md (tests implemented) - Delete add_schema_comments.py (functionality merged into processor) - Update tests to use OHLCSchema.get_required_columns() - Achieve maximum DRY: future column additions require 1-2 file updates BREAKING CHANGE: None (additive refactoring, no API changes)
|
|
113
|
+
|
|
114
|
+
- Extract 7 specialized modules from processor.py (Phase 1-5) Refactor processor.py using facade pattern with 7 focused modules implementing separation of concerns. Modules Created: - downloader.py: HTTP download operations - tick_loader.py: CSV parsing - database_manager.py: Database operations - session_detector.py: Holiday/session detection - gap_detector.py: Incremental update logic - ohlc_generator.py: Phase7 OHLC generation - query_engine.py: Query operations Design Principles: - Facade pattern: processor.py delegates to specialized modules - SLO-based: All modules define Availability, Correctness, Observability, Maintainability - Off-the-shelf: httpx, pandas, DuckDB, exchange_calendars (no custom implementations) - Zero regressions: All 48 tests pass, all ruff checks pass Documentation: - Updated CLAUDE.md with module structure and facade pattern - Updated docs/README.md with implementation architecture v1.3.0 - Added planning documents (REFACTORING_CHECKLIST.md, PHASE7_v1.6.0_REFACTORING_PROGRESS.md) Version: 1.3.0 (Implementation) Validation: 48 tests pass, ruff checks pass, backward compatible
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
### ✨ Features
|
|
118
|
+
|
|
119
|
+
- Implement pydantic v2 models with dual-variant e2e testing - Add Pydantic v2 models (UpdateResult, CoverageInfo) for type-safe API - Update processor to use Pydantic types (PairType, TimeframeType, VariantType) - Remove deprecated api.py module (broken functionality) - Implement comprehensive test suite (48 tests, 100% passing): * test_models.py - Pydantic model validation (13 tests) * test_types.py - Type safety and helpers (15 tests) * test_processor_pydantic.py - Integration tests (6 tests) * test_functional_regression.py - v2.0.0 regression tests (10 tests) - Fix Standard variant downloads (variant="" not "Standard") - Add true end-to-end testing with real Exness downloads - Test data: EURUSD August 2024 (815K Raw_Spread + 877K Standard ticks) - Update documentation and add refactoring status tracking - Coverage: models.py 100%, __init__.py 100%, processor.py 45% BREAKING CHANGE: api.py removed (use ExnessDataProcessor directly)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### 📚 Documentation
|
|
123
|
+
|
|
124
|
+
- Update all schema references from 9-column to 13-column (v1.2.0) Update outdated "9-column" or "Phase7 9 columns" references to "13-column (v1.2.0)" across all documentation files to reflect the current schema version with normalized spread metrics. Files updated: - GITHUB_PYPI_SETUP.md - Release notes reference - PYDANTIC_REFACTORING_PLAN.md - API documentation and examples (4 locations) - docs/DATABASE_SCHEMA.md - Version history (2 locations) - docs/README.md - Validation results - docs/UNIFIED_DUCKDB_PLAN_v2.md - Table descriptions and return types (2 locations) - tests/README.md - Test descriptions (2 locations) All outdated schema references now consistently reference the Phase7 13-column (v1.2.0) schema with normalized metrics (range_per_spread, range_per_tick, body_per_spread, body_per_tick). CHANGELOG.md and research/archive files intentionally preserved for historical accuracy.
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
### 🔧 Continuous Integration
|
|
128
|
+
|
|
129
|
+
- Modernize publish workflow with uv and validation pipeline Update GitHub Actions publish workflow to match gapless-crypto-data standards: Build System: - Replace pip+build with uv for consistency with local development - Add UV_SYSTEM_PYTHON=1 environment variable - Use uv sync --dev for dependency installation Validation Pipeline: - Add file encoding validation (UTF-8/ASCII enforcement) - Add ruff linting and format checking - Add pytest test suite execution before build Security: - Add Sigstore artifact signing for published packages - Maintain PyPI Trusted Publishing (OIDC) authentication Configuration: - Change environment name: release → pypi (semantic clarity) - Change artifact name: dist → python-package-distributions (consistency) - Add verbose output to PyPI publish step Security Note: - Added .token-info.md to .gitignore to prevent accidental token documentation commits - Workflow uses OIDC (no API token needed)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
### 🧰 Maintenance
|
|
133
|
+
|
|
134
|
+
- **release**: Bump version 0.1.0 → 0.2.0 [skip ci]
|
|
135
|
+
|
|
136
|
+
- **release**: Bump version 0.2.0 → 0.3.0 [skip ci]
|
|
137
|
+
|
|
138
|
+
- **release**: Bump version 0.3.0 → 0.3.1 [skip ci]
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
### ✨ Features
|
|
142
|
+
|
|
143
|
+
- Initial commit with v2.0.0 unified DuckDB architecture - Unified single-file DuckDB storage per instrument (eurusd.duckdb) - Phase7 9-column OHLC schema with dual-variant spreads - Sub-15ms query performance with date range filtering - PRIMARY KEY constraints prevent duplicates - Automatic gap detection for incremental updates - DuckDB self-documentation with COMMENT ON statements - GitHub Actions CI/CD with PyPI Trusted Publishing - Pre-commit hooks (ruff, commitizen, basic checks) - Professional README with shields.io badges
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### 🐛 Bug Fixes
|
|
147
|
+
|
|
148
|
+
- Force add .pre-commit-config.yaml (was incorrectly gitignored)
|
|
149
|
+
|
|
150
|
+
- Remove .pre-commit-config.yaml from .gitignore Pre-commit config should be version controlled, not ignored.
|
|
151
|
+
|
|
152
|
+
- **pre-commit**: Enable unsafe fixes for ruff to resolve remaining errors
|
|
153
|
+
|
|
154
|
+
- **research**: Resolve remaining linting errors in research scripts - Fix bare except clause in 02_volatility_model_simple.py (E722) - Move math.erf imports to top in 03_liquidity_crisis_detection.py (E402) - Move math.erf imports to top in 04_regime_detection_analysis.py (E402)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
### 💅 Code Style
|
|
158
|
+
|
|
159
|
+
- Apply pre-commit formatting fixes - Fix end-of-file newlines in 2 MD files - Apply ruff quote style fixes (200 errors fixed) - Reformat 26 files with ruff-format
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
### 🔧 CI/CD Improvements
|
|
163
|
+
|
|
164
|
+
- **ci**: Add pre-commit config and basic tests - Add .pre-commit-config.yaml to repository - Create basic test suite (test_basic.py) for CI - Add GITHUB_PYPI_SETUP.md with complete setup instructions Fixes CI failures: - Pre-commit hook now finds config file - Pytest now finds and runs tests successfully
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
### 🧰 Maintenance
|
|
168
|
+
|
|
169
|
+
- Prepare v0.1.0 release
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
**Architecture**: Forex tick data preprocessing with unified single-file DuckDB storage
|
|
6
|
+
|
|
7
|
+
**Full Documentation**: [`README.md`](README.md) - Installation, usage, API reference
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Documentation Hub
|
|
12
|
+
|
|
13
|
+
### User Documentation
|
|
14
|
+
- **[README.md](README.md)** - Installation, API reference, usage examples
|
|
15
|
+
- **[examples/basic_usage.py](examples/basic_usage.py)** - Download, query, coverage operations
|
|
16
|
+
- **[examples/batch_processing.py](examples/batch_processing.py)** - Multi-instrument parallel processing
|
|
17
|
+
|
|
18
|
+
### AI Assistant Documentation
|
|
19
|
+
- **[docs/README.md](docs/README.md)** - Architecture, planning, research findings
|
|
20
|
+
- **[docs/MODULE_ARCHITECTURE.md](docs/MODULE_ARCHITECTURE.md)** - Complete module documentation with SLOs (v1.7.0)
|
|
21
|
+
- **[docs/DATABASE_SCHEMA.md](docs/DATABASE_SCHEMA.md)** - Complete database schema with self-documentation
|
|
22
|
+
- **[docs/RESEARCH_PATTERNS.md](docs/RESEARCH_PATTERNS.md)** - Research lifecycle and tool selection (v1.0.0)
|
|
23
|
+
- **[docs/UNIFIED_DUCKDB_PLAN_v2.md](docs/UNIFIED_DUCKDB_PLAN_v2.md)** - v2.0.0 architecture specification
|
|
24
|
+
- **[docs/EXNESS_DATA_SOURCES.md](docs/EXNESS_DATA_SOURCES.md)** - Data source variants and URLs
|
|
25
|
+
- **[Makefile](Makefile)** - Module introspection commands (module-stats, module-complexity, module-deps)
|
|
26
|
+
|
|
27
|
+
### Optimization Plans (v1.7.0)
|
|
28
|
+
- **[docs/PHASE2_SESSION_VECTORIZATION_PLAN.yaml](docs/PHASE2_SESSION_VECTORIZATION_PLAN.yaml)** - SSoT plan v2.0.0 (2.2x speedup)
|
|
29
|
+
- **[docs/PHASE3_SQL_GAP_DETECTION_PLAN.yaml](docs/PHASE3_SQL_GAP_DETECTION_PLAN.yaml)** - SSoT plan v2.0.0 (complete coverage)
|
|
30
|
+
- **[docs/validation/SPIKE_TEST_RESULTS_PHASE1_2025-10-18.md](docs/validation/SPIKE_TEST_RESULTS_PHASE1_2025-10-18.md)** - Phase 1 validation
|
|
31
|
+
- **[docs/validation/SPIKE_TEST_RESULTS_PHASE2_2025-10-18.md](docs/validation/SPIKE_TEST_RESULTS_PHASE2_2025-10-18.md)** - Phase 2 validation
|
|
32
|
+
|
|
33
|
+
### Implementation
|
|
34
|
+
- **src/exness_data_preprocess/** - Source code (7 specialized modules + facade)
|
|
35
|
+
- **tests/** - Test suite (48 tests, 100% passing)
|
|
36
|
+
- **[CONTRIBUTING.md](CONTRIBUTING.md)** - Contribution guidelines
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Architecture Summary
|
|
41
|
+
|
|
42
|
+
### Storage Pattern (v2.0.0)
|
|
43
|
+
- **Single DuckDB file per instrument** (e.g., eurusd.duckdb containing all historical data)
|
|
44
|
+
- **Dual-variant storage** (Raw_Spread + Standard in same database)
|
|
45
|
+
- **Incremental updates** with automatic gap detection
|
|
46
|
+
- **PRIMARY KEY constraints** prevent duplicates during updates
|
|
47
|
+
- **Sub-15ms query performance** with date range filtering
|
|
48
|
+
- **On-demand resampling** to any timeframe (5m, 1h, 1d)
|
|
49
|
+
|
|
50
|
+
**Complete Specification**: [`docs/UNIFIED_DUCKDB_PLAN_v2.md`](docs/UNIFIED_DUCKDB_PLAN_v2.md)
|
|
51
|
+
|
|
52
|
+
### Module Pattern (v1.7.0)
|
|
53
|
+
- **Facade orchestrator** (processor.py) coordinating 7 specialized modules
|
|
54
|
+
- **Separation of concerns** with single-responsibility modules
|
|
55
|
+
- **SLO-based design** (Availability, Correctness, Observability, Maintainability)
|
|
56
|
+
- **Off-the-shelf libraries** (httpx, pandas, DuckDB, exchange_calendars)
|
|
57
|
+
- **Zero regressions** (48 tests pass)
|
|
58
|
+
|
|
59
|
+
**Modules**:
|
|
60
|
+
1. **processor.py** - Thin orchestrator facade
|
|
61
|
+
2. **downloader.py** - HTTP download operations
|
|
62
|
+
3. **tick_loader.py** - CSV parsing
|
|
63
|
+
4. **database_manager.py** - Database operations
|
|
64
|
+
5. **session_detector.py** - Holiday and session detection (v1.7.0: vectorized, 2.2x speedup)
|
|
65
|
+
6. **gap_detector.py** - Incremental update logic (v1.7.0: SQL gap detection, complete coverage)
|
|
66
|
+
7. **ohlc_generator.py** - Phase7 OHLC generation (v1.7.0: incremental, 7.3x speedup)
|
|
67
|
+
8. **query_engine.py** - Query operations
|
|
68
|
+
|
|
69
|
+
**Complete Details**: [`docs/MODULE_ARCHITECTURE.md`](docs/MODULE_ARCHITECTURE.md)
|
|
70
|
+
|
|
71
|
+
### Performance Optimizations (v1.7.0)
|
|
72
|
+
- **Incremental OHLC Generation** (Phase 1): 7.3x speedup
|
|
73
|
+
- Optional date-range filtering for regeneration
|
|
74
|
+
- Measured: 8.05s → 1.10s for incremental updates (7 months)
|
|
75
|
+
- SSoT: [`docs/validation/SPIKE_TEST_RESULTS_PHASE1_2025-10-18.md`](docs/validation/SPIKE_TEST_RESULTS_PHASE1_2025-10-18.md)
|
|
76
|
+
|
|
77
|
+
- **Session Vectorization** (Phase 2): 2.2x speedup
|
|
78
|
+
- Pre-compute trading minutes, vectorized .isin() lookup
|
|
79
|
+
- Measured: 5.99s → 2.69s for 302K bars across 10 exchanges
|
|
80
|
+
- Combined Phase 1+2: **~16x total speedup** (8.05s → 0.50s)
|
|
81
|
+
- SSoT: [`docs/PHASE2_SESSION_VECTORIZATION_PLAN.yaml`](docs/PHASE2_SESSION_VECTORIZATION_PLAN.yaml)
|
|
82
|
+
- Validation: [`docs/validation/SPIKE_TEST_RESULTS_PHASE2_2025-10-18.md`](docs/validation/SPIKE_TEST_RESULTS_PHASE2_2025-10-18.md)
|
|
83
|
+
|
|
84
|
+
- **SQL Gap Detection** (Phase 3): Complete coverage + 46% LOC reduction
|
|
85
|
+
- SQL EXCEPT query detects ALL gaps (internal + edges)
|
|
86
|
+
- Bug fix: Now detects internal gaps missed by Python MIN/MAX
|
|
87
|
+
- Measured: 41 → 42 gaps detected (spike test validation)
|
|
88
|
+
- SSoT: [`docs/PHASE3_SQL_GAP_DETECTION_PLAN.yaml`](docs/PHASE3_SQL_GAP_DETECTION_PLAN.yaml)
|
|
89
|
+
|
|
90
|
+
**Pattern**: Spike test first (validate theory) → Implement → Iterative SSoT plan updates
|
|
91
|
+
|
|
92
|
+
### Schema (v1.6.0)
|
|
93
|
+
- **Phase7 30-column OHLC** with dual-variant spreads
|
|
94
|
+
- **BID-only OHLC** from Raw_Spread execution prices
|
|
95
|
+
- **Normalized metrics** (range_per_spread, range_per_tick, body_per_spread, body_per_tick)
|
|
96
|
+
- **10 global exchange sessions with trading hour detection** (NYSE, LSE, XSWX, XFRA, XTSE, XNZE, XTKS, XASX, XHKG, XSES)
|
|
97
|
+
- **Holiday tracking** (US, UK, major holidays)
|
|
98
|
+
- **Self-documenting** via COMMENT ON statements
|
|
99
|
+
|
|
100
|
+
**Complete Schema**: [`docs/DATABASE_SCHEMA.md`](docs/DATABASE_SCHEMA.md)
|
|
101
|
+
|
|
102
|
+
### Data Sources
|
|
103
|
+
- **Source**: https://ticks.ex2archive.com/ (public Exness tick data)
|
|
104
|
+
- **Primary**: Raw_Spread variant (97.81% zero-spreads, execution prices)
|
|
105
|
+
- **Reference**: Standard variant (0% zero-spreads, market quotes)
|
|
106
|
+
- **Format**: Monthly ZIP files with microsecond-precision CSV
|
|
107
|
+
|
|
108
|
+
**Complete Guide**: [`docs/EXNESS_DATA_SOURCES.md`](docs/EXNESS_DATA_SOURCES.md)
|
|
109
|
+
|
|
110
|
+
### Research Patterns (v1.0.0)
|
|
111
|
+
- **Lifecycle**: Explore (pandas/Polars) → Validate → Graduate (DuckDB) → Query (SQL)
|
|
112
|
+
- **ASOF Performance**: pandas/Polars 0.04s, DuckDB 0.89s at 880K ticks (24x difference)
|
|
113
|
+
- **Tool Selection**: pandas/Polars for tick-level temporal matching, DuckDB for materialized results
|
|
114
|
+
- **Hybrid Pattern**: ASOF operations stay in pandas, validated findings materialize to DuckDB tables
|
|
115
|
+
- **Single Source of Truth**: DuckDB stores validated research outcomes with COMMENT ON documentation
|
|
116
|
+
|
|
117
|
+
**Complete Specification**: [`docs/RESEARCH_PATTERNS.md`](docs/RESEARCH_PATTERNS.md)
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Development Commands
|
|
122
|
+
|
|
123
|
+
### Setup
|
|
124
|
+
```bash
|
|
125
|
+
# Install with development dependencies
|
|
126
|
+
uv sync --dev
|
|
127
|
+
|
|
128
|
+
# Or with pip
|
|
129
|
+
pip install -e ".[dev]"
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Testing
|
|
133
|
+
```bash
|
|
134
|
+
# Run all tests
|
|
135
|
+
uv run pytest
|
|
136
|
+
|
|
137
|
+
# Run with coverage
|
|
138
|
+
uv run pytest --cov=exness_data_preprocess --cov-report=html
|
|
139
|
+
|
|
140
|
+
# Run specific test file
|
|
141
|
+
uv run pytest tests/test_basic.py -v
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Code Quality
|
|
145
|
+
```bash
|
|
146
|
+
# Format code
|
|
147
|
+
uv run ruff format .
|
|
148
|
+
|
|
149
|
+
# Lint and auto-fix
|
|
150
|
+
uv run ruff check --fix .
|
|
151
|
+
|
|
152
|
+
# Type checking
|
|
153
|
+
uv run mypy src/
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Module Introspection
|
|
157
|
+
```bash
|
|
158
|
+
# Show current line counts (always accurate)
|
|
159
|
+
make module-stats
|
|
160
|
+
|
|
161
|
+
# Show cyclomatic complexity (requires radon)
|
|
162
|
+
make module-complexity
|
|
163
|
+
|
|
164
|
+
# Show dependency tree (requires pipdeptree)
|
|
165
|
+
make module-deps
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Building and Publishing
|
|
169
|
+
```bash
|
|
170
|
+
# Build package
|
|
171
|
+
uv build
|
|
172
|
+
|
|
173
|
+
# Test installation locally
|
|
174
|
+
uv tool install --editable .
|
|
175
|
+
|
|
176
|
+
# Publish to PyPI (requires PYPI_TOKEN)
|
|
177
|
+
doppler run --project claude-config --config dev -- uv publish --token "$PYPI_TOKEN"
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Complete Development Guide**: [`README.md`](README.md) (Installation section)
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## References
|
|
185
|
+
|
|
186
|
+
- **Exness Data**: https://ticks.ex2archive.com/
|
|
187
|
+
- **DuckDB**: https://duckdb.org/
|
|
188
|
+
- **Apache Parquet**: https://parquet.apache.org/
|
|
189
|
+
- **Zstd Compression**: https://facebook.github.io/zstd/
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
**Version**: 2.0.0 (Architecture) + 1.7.0 (Implementation) + 1.0.0 (Research Patterns)
|
|
194
|
+
**Last Updated**: 2025-10-18
|
|
195
|
+
**Architecture**: Unified Single-File DuckDB Storage with Incremental Updates
|
|
196
|
+
**Implementation**: Facade Pattern with 7 Specialized Modules + Performance Optimizations (~16x speedup)
|
|
197
|
+
**Research**: Hybrid Materialization (pandas/Polars exploration, DuckDB validated results)
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# 📚 Documentation Hub
|
|
2
|
+
|
|
3
|
+
**Welcome!** This page organizes all documentation from beginner to advanced, helping you find exactly what you need.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 🎯 Quick Start (5 Minutes)
|
|
8
|
+
|
|
9
|
+
New to this project? Start here:
|
|
10
|
+
|
|
11
|
+
1. **[README.md](README.md)** - Installation, features, and quick start guide
|
|
12
|
+
2. **[Basic Usage Examples](examples/basic_usage.py)** - Download data, query OHLC/ticks, coverage checks
|
|
13
|
+
3. **[Contributing Guide](CONTRIBUTING.md)** - Want to contribute? Start here
|
|
14
|
+
|
|
15
|
+
**Next Steps**: Read [Data Sources](#-understanding-the-data) below to understand what data you're working with.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📖 Beginner Path (Your First Hour)
|
|
20
|
+
|
|
21
|
+
Follow this path if you're new to the project:
|
|
22
|
+
|
|
23
|
+
### 1. Getting Started
|
|
24
|
+
- **[README.md](README.md)** - Main documentation with installation and API reference
|
|
25
|
+
- **[Basic Usage Examples](examples/basic_usage.py)** - 6 practical code examples you can run immediately
|
|
26
|
+
- **[Contributing Guide](CONTRIBUTING.md)** - Development setup, code quality, testing
|
|
27
|
+
|
|
28
|
+
### 2. Understanding the Data
|
|
29
|
+
- **[Exness Data Sources](docs/EXNESS_DATA_SOURCES.md)** - Raw_Spread vs Standard variants, data quality characteristics
|
|
30
|
+
- Learn about 97.81% zero-spreads in Raw_Spread (execution prices)
|
|
31
|
+
- Understand tick density and storage estimates
|
|
32
|
+
- See CSV format and download patterns
|
|
33
|
+
|
|
34
|
+
### 3. First Queries
|
|
35
|
+
- **[Database Schema](docs/DATABASE_SCHEMA.md)** - Phase7 30-column OHLC structure
|
|
36
|
+
- 4 tables: raw_spread_ticks, standard_ticks, ohlc_1m, metadata
|
|
37
|
+
- SQL query examples and performance benchmarks
|
|
38
|
+
- 10 global exchange sessions with trading hours
|
|
39
|
+
|
|
40
|
+
**Checkpoint**: After this section, you should be able to download data and run basic queries.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 🚀 Intermediate Path (Production Usage)
|
|
45
|
+
|
|
46
|
+
Ready for multi-instrument processing and advanced queries:
|
|
47
|
+
|
|
48
|
+
### 4. Advanced Workflows
|
|
49
|
+
- **[Batch Processing Examples](examples/batch_processing.py)** - Multi-instrument parallel processing
|
|
50
|
+
- Sequential and parallel processing patterns
|
|
51
|
+
- Error handling and retry logic
|
|
52
|
+
- Progress monitoring with tqdm
|
|
53
|
+
|
|
54
|
+
### 5. Research Methodology
|
|
55
|
+
- **[Research Patterns](docs/RESEARCH_PATTERNS.md)** - pandas/Polars vs DuckDB tool selection
|
|
56
|
+
- Research lifecycle: Explore → Validate → Graduate → Query
|
|
57
|
+
- Hybrid materialization pattern
|
|
58
|
+
- Performance benchmarks (ASOF joins: pandas 0.04s vs DuckDB 0.89s)
|
|
59
|
+
|
|
60
|
+
### 6. Schema Deep Dive
|
|
61
|
+
- **[Schema v1.6.0 Migration Guide](docs/plans/SCHEMA_v1.6.0_MIGRATION_GUIDE.md)** - Breaking changes from v1.5.0
|
|
62
|
+
- 19 → 30 columns (added 10 exchange sessions + 1 major holiday flag)
|
|
63
|
+
- Midnight detection bug fix (critical for session flags)
|
|
64
|
+
- Migration steps and validation
|
|
65
|
+
|
|
66
|
+
**Checkpoint**: You can now process multiple instruments efficiently and choose the right tools for research.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 🏗️ Advanced Path (Architecture & Development)
|
|
71
|
+
|
|
72
|
+
For contributors and researchers who need deep understanding:
|
|
73
|
+
|
|
74
|
+
### 7. System Architecture
|
|
75
|
+
- **[Module Architecture](docs/MODULE_ARCHITECTURE.md)** ⭐ *v1.3.1 - Verified Accurate*
|
|
76
|
+
- Facade pattern with 6 module instances + 1 static utility
|
|
77
|
+
- SLO-based design (Availability, Correctness, Observability, Maintainability)
|
|
78
|
+
- Complete data flow with 3 Mermaid diagrams
|
|
79
|
+
- See [Architecture Audit](docs/validation/ARCHITECTURE_AUDIT_2025-10-17.md) for verification
|
|
80
|
+
|
|
81
|
+
- **[Unified DuckDB Plan v2.0.0](docs/UNIFIED_DUCKDB_PLAN_v2.md)** - Storage architecture
|
|
82
|
+
- Single-file per instrument (eurusd.duckdb)
|
|
83
|
+
- Incremental updates with gap detection
|
|
84
|
+
- PRIMARY KEY prevents duplicates
|
|
85
|
+
|
|
86
|
+
### 8. Trading Hours Implementation
|
|
87
|
+
- **[Trading Hours Research](docs/TRADING_HOURS_RESEARCH.md)** - Industry analysis (49KB comprehensive)
|
|
88
|
+
- 5 quant finance libraries studied
|
|
89
|
+
- 3 professional platforms analyzed
|
|
90
|
+
- 4 time-series databases compared
|
|
91
|
+
- Unanimous consensus for calendar abstraction
|
|
92
|
+
|
|
93
|
+
- **[Hybrid Session Detection Analysis](docs/research/HYBRID_SESSION_DETECTION_ANALYSIS.md)** - Implementation rationale
|
|
94
|
+
- Why holidays are date-level but sessions are minute-level
|
|
95
|
+
- DuckDB performance optimization
|
|
96
|
+
- Bulk UPDATE strategies
|
|
97
|
+
|
|
98
|
+
### 9. Validation & Quality Assurance
|
|
99
|
+
- **[E2E Validation Results v1.6.0](docs/validation/E2E_VALIDATION_RESULTS_v1.6.0.md)** ⭐ *100% Accuracy*
|
|
100
|
+
- 355,970 bars of real EURUSD data (12 months, 1.92 GB)
|
|
101
|
+
- Tokyo lunch breaks: 0/59 lunch, 150/150 morning, 151/151 afternoon
|
|
102
|
+
- Holidays, DST, weekend gaps, exchange overlaps all verified
|
|
103
|
+
|
|
104
|
+
- **[Weekend Gap Validation](docs/validation/WEEKEND_GAP_VALIDATION_SUMMARY.md)** - Timezone-aware weekend handling
|
|
105
|
+
- 48-hour forex gap (Friday 22:00 UTC → Sunday 22:00 UTC)
|
|
106
|
+
- New Zealand opens first (Monday 10:00 NZST = Sunday 21:00 UTC)
|
|
107
|
+
|
|
108
|
+
- **[Architecture Audit Report](docs/validation/ARCHITECTURE_AUDIT_2025-10-17.md)** - Documentation accuracy verification
|
|
109
|
+
- 78% → 100% accuracy after comprehensive audit
|
|
110
|
+
- All constructor signatures verified
|
|
111
|
+
- HTTP library, type signatures, data flow corrected
|
|
112
|
+
|
|
113
|
+
### 10. Performance Optimizations (v0.5.0)
|
|
114
|
+
- **[Phase 1 Spike Test Results](docs/validation/SPIKE_TEST_RESULTS_PHASE1_2025-10-18.md)** ⭐ *7.3x Speedup*
|
|
115
|
+
- Incremental OHLC generation: 8.05s → 1.10s for updates
|
|
116
|
+
- 303K bars regeneration vs 43K incremental update
|
|
117
|
+
- Measured: 86.3% time reduction
|
|
118
|
+
|
|
119
|
+
- **[Phase 2 SSoT Plan](docs/PHASE2_SESSION_VECTORIZATION_PLAN.yaml)** - Session vectorization specification
|
|
120
|
+
- OpenAPI 3.1.0 machine-readable plan with SLOs
|
|
121
|
+
- Version tracking: v1.0.0 (initial) → v2.0.0 (completed)
|
|
122
|
+
- Implementation discoveries and nuances documented
|
|
123
|
+
|
|
124
|
+
- **[Phase 2 Spike Test Results](docs/validation/SPIKE_TEST_RESULTS_PHASE2_2025-10-18.md)** ⭐ *2.2x Speedup*
|
|
125
|
+
- Vectorized session detection: 5.99s → 2.69s for 302K bars
|
|
126
|
+
- 10 global exchange sessions processed in parallel
|
|
127
|
+
- Combined Phase 1+2: ~16x total speedup (8.05s → 0.50s)
|
|
128
|
+
|
|
129
|
+
- **[Phase 3 SSoT Plan](docs/PHASE3_SQL_GAP_DETECTION_PLAN.yaml)** - SQL gap detection specification
|
|
130
|
+
- OpenAPI 3.1.0 specification with implementation strategy
|
|
131
|
+
- Bug fix documentation: Internal gaps now detected
|
|
132
|
+
- 46% LOC reduction (62 → 34 lines)
|
|
133
|
+
|
|
134
|
+
- **[CHANGELOG v0.5.0](CHANGELOG.md)** - Complete release notes with measured results
|
|
135
|
+
|
|
136
|
+
**Checkpoint**: You understand the optimization strategies and spike-test-first validation methodology.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 📊 Research Projects (Deep Dives)
|
|
141
|
+
|
|
142
|
+
Published research with reproduction guides:
|
|
143
|
+
|
|
144
|
+
### Zero-Spread Deviation Analysis
|
|
145
|
+
- **[Project Overview](docs/research/eurusd-zero-spread-deviations/README.md)** - 16-month validation study
|
|
146
|
+
- **[Methodology](docs/research/eurusd-zero-spread-deviations/01-methodology.md)** - Research approach
|
|
147
|
+
- **[Baseline Analysis](docs/research/eurusd-zero-spread-deviations/02-baseline-sep2024.md)** - September 2024 baseline
|
|
148
|
+
- **[Multi-Period Validation](docs/research/eurusd-zero-spread-deviations/03-multiperiod-validation.md)** - Extended validation
|
|
149
|
+
- **[Discoveries](docs/research/eurusd-zero-spread-deviations/04-discoveries-and-plan-evolution.md)** - Plan evolution
|
|
150
|
+
- **[Reproduction Guide](docs/research/eurusd-zero-spread-deviations/scripts/reproduction_guide.md)** - How to reproduce results
|
|
151
|
+
|
|
152
|
+
### Spread Variant Analysis
|
|
153
|
+
- **[Project Overview](docs/research/eurusd-spread-analysis/README.md)** - Modal-band-excluded variance estimation
|
|
154
|
+
- **[Methodology](docs/research/eurusd-spread-analysis/01-methodology.md)** - Research design
|
|
155
|
+
- **[Mode-Truncated Analysis](docs/research/eurusd-spread-analysis/02-mode-truncated-analysis.md)** - Truncation approach
|
|
156
|
+
- **[Hurdle Model](docs/research/eurusd-spread-analysis/03-hurdle-model-analysis.md)** - Two-part model
|
|
157
|
+
- **[Temporal Patterns](docs/research/eurusd-spread-analysis/04-temporal-patterns.md)** - Time-based analysis
|
|
158
|
+
- **[Recommendations](docs/research/eurusd-spread-analysis/05-final-recommendations.md)** - Final guidance
|
|
159
|
+
- **[Reproduction Guide](docs/research/eurusd-spread-analysis/scripts/reproduction_guide.md)** - How to reproduce
|
|
160
|
+
|
|
161
|
+
### Compression Benchmarks
|
|
162
|
+
- **[Compression Study](docs/research/compression-benchmarks/README.md)** - Why Parquet + Zstd-22
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## 📚 Reference Documentation
|
|
167
|
+
|
|
168
|
+
Quick lookups and specific information:
|
|
169
|
+
|
|
170
|
+
### API & Schema
|
|
171
|
+
- **[README.md](README.md)** - Complete API reference with examples
|
|
172
|
+
- **[Database Schema](docs/DATABASE_SCHEMA.md)** - 30-column Phase7 OHLC specification
|
|
173
|
+
- **[CLAUDE.md](CLAUDE.md)** - AI assistant quick reference (architecture summary)
|
|
174
|
+
|
|
175
|
+
### Version History
|
|
176
|
+
- **[CHANGELOG.md](CHANGELOG.md)** - Version history (Keep a Changelog format)
|
|
177
|
+
- **[RELEASE_NOTES.md](RELEASE_NOTES.md)** - Human-readable release notes
|
|
178
|
+
- **[AUTHORS.md](AUTHORS.md)** - Project contributors
|
|
179
|
+
|
|
180
|
+
### Testing
|
|
181
|
+
- **[Test Suite Documentation](tests/README.md)** - 48 tests, coverage reports
|
|
182
|
+
- **[Makefile](Makefile)** - Build commands (`make test`, `make module-stats`, etc.)
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## 🔧 Development & Planning
|
|
187
|
+
|
|
188
|
+
Internal documentation for contributors:
|
|
189
|
+
|
|
190
|
+
### Current Plans
|
|
191
|
+
- **[Documentation Hub](docs/README.md)** - Hub-and-spoke architecture with progressive disclosure
|
|
192
|
+
- **[Implementation Plan](docs/implementation-plan.yaml)** - Machine-readable implementation plan with SLOs
|
|
193
|
+
- **[Planning Index](docs/planning-index.yaml)** - Index of all planning documents
|
|
194
|
+
|
|
195
|
+
### Migration & Refactoring
|
|
196
|
+
- **[Schema v1.6.0 Migration Guide](docs/plans/SCHEMA_v1.6.0_MIGRATION_GUIDE.md)** - v1.5.0 → v1.6.0 breaking changes
|
|
197
|
+
- **[Phase7 v1.6.0 Progress](docs/plans/PHASE7_v1.6.0_REFACTORING_PROGRESS.md)** - Refactoring progress tracking
|
|
198
|
+
- **[Refactoring Checklist](docs/plans/REFACTORING_CHECKLIST.md)** - Comprehensive checklist
|
|
199
|
+
|
|
200
|
+
### Quality Audits
|
|
201
|
+
- **[Workspace Survey](docs/validation/WORKSPACE_SURVEY_2025-10-17.md)** - Organization assessment (2025-10-17)
|
|
202
|
+
- **[Architecture Audit](docs/validation/ARCHITECTURE_AUDIT_2025-10-17.md)** - Documentation accuracy (2025-10-17)
|
|
203
|
+
- **[Functionality Validation](docs/plans/FUNCTIONALITY_VALIDATION_REPORT_2025-10-16.md)** - Feature testing (2025-10-16)
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## 📁 Archive
|
|
208
|
+
|
|
209
|
+
Historical documentation (for reference only):
|
|
210
|
+
|
|
211
|
+
- **[Unified DuckDB Plan v1.0.0](docs/archive/UNIFIED_DUCKDB_PLAN_v1.0.0_LEGACY.md)** - Legacy architecture (superseded by v2.0.0)
|
|
212
|
+
- **[Pydantic Refactoring Plan](docs/archive/PYDANTIC_REFACTORING_PLAN_v0.2.0_COMPLETE.md)** - Completed v0.2.0
|
|
213
|
+
- **[E2E Testing Plan](tests/archive/E2E_TESTING_PLAN_v1.0.0.md)** - Archived testing approach
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 🗺️ Documentation Organization
|
|
218
|
+
|
|
219
|
+
This project uses a **hub-and-spoke model** with progressive disclosure:
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
DOCUMENTATION.md (You are here - Hub)
|
|
223
|
+
├── Beginner Path → README → Examples → Data Sources
|
|
224
|
+
├── Intermediate Path → Batch Processing → Research Patterns → Migration Guide
|
|
225
|
+
├── Advanced Path → Module Architecture → DuckDB Plan → Trading Hours Research
|
|
226
|
+
├── Research Projects → Zero-Spread Analysis → Spread Variant Analysis
|
|
227
|
+
└── Reference → API Docs → Schema → Testing
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Navigation Tips**:
|
|
231
|
+
- 🎯 = Start here if you're new
|
|
232
|
+
- ⭐ = Critical documentation (verified accurate)
|
|
233
|
+
- All links use relative URLs from project root
|
|
234
|
+
- Use browser search (Ctrl+F / Cmd+F) to find specific topics
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## 🤔 Which Documentation Should I Read?
|
|
239
|
+
|
|
240
|
+
### "I just want to download forex data and analyze it"
|
|
241
|
+
→ [README.md](README.md) → [Basic Usage Examples](examples/basic_usage.py)
|
|
242
|
+
|
|
243
|
+
### "I need to process multiple currency pairs efficiently"
|
|
244
|
+
→ [Batch Processing Examples](examples/batch_processing.py)
|
|
245
|
+
|
|
246
|
+
### "I want to write SQL queries against tick data"
|
|
247
|
+
→ [Database Schema](docs/DATABASE_SCHEMA.md)
|
|
248
|
+
|
|
249
|
+
### "I'm doing quantitative research with temporal analysis"
|
|
250
|
+
→ [Research Patterns](docs/RESEARCH_PATTERNS.md) → [Database Schema](docs/DATABASE_SCHEMA.md)
|
|
251
|
+
|
|
252
|
+
### "I want to contribute code to this project"
|
|
253
|
+
→ [Module Architecture](docs/MODULE_ARCHITECTURE.md) → [Contributing Guide](CONTRIBUTING.md)
|
|
254
|
+
|
|
255
|
+
### "I need to understand trading hour detection"
|
|
256
|
+
→ [Trading Hours Research](docs/TRADING_HOURS_RESEARCH.md) → [E2E Validation](docs/validation/E2E_VALIDATION_RESULTS_v1.6.0.md)
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## 📞 Getting Help
|
|
261
|
+
|
|
262
|
+
- **Issues**: [GitHub Issues](https://github.com/terrylica/exness-data-preprocess/issues)
|
|
263
|
+
- **Contributing**: See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
264
|
+
- **License**: [MIT License](LICENSE)
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
**Last Updated**: 2025-10-18
|
|
269
|
+
**Documentation Version**: v1.7.0
|
|
270
|
+
**Total Documentation Files**: 70 markdown files + 2 Python examples + 4 YAML specs
|