exness-data-preprocess 0.1.0__tar.gz → 0.3.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.
Files changed (92) hide show
  1. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/.cz.toml +1 -1
  2. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/.gitignore +1 -0
  3. exness_data_preprocess-0.3.0/CHANGELOG.md +53 -0
  4. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/CLAUDE.md +156 -26
  5. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/PKG-INFO +10 -15
  6. exness_data_preprocess-0.3.0/PYDANTIC_REFACTORING_PLAN.md +946 -0
  7. exness_data_preprocess-0.3.0/PYDANTIC_REFACTORING_STATUS.md +203 -0
  8. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/README.md +8 -14
  9. exness_data_preprocess-0.3.0/RELEASE_NOTES.md +22 -0
  10. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/DATABASE_SCHEMA.md +135 -44
  11. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/README.md +4 -8
  12. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/UNIFIED_DUCKDB_PLAN_v2.md +2 -2
  13. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/examples/basic_usage.py +3 -3
  14. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/examples/batch_processing.py +1 -1
  15. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/pyproject.toml +2 -1
  16. exness_data_preprocess-0.3.0/src/exness_data_preprocess/__init__.py +89 -0
  17. exness_data_preprocess-0.3.0/src/exness_data_preprocess/models.py +318 -0
  18. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/src/exness_data_preprocess/processor.py +99 -225
  19. exness_data_preprocess-0.3.0/src/exness_data_preprocess/schema.py +256 -0
  20. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/tests/README.md +1 -1
  21. exness_data_preprocess-0.3.0/tests/archive/E2E_TESTING_PLAN_v1.0.0.md +174 -0
  22. exness_data_preprocess-0.3.0/tests/conftest.py +86 -0
  23. exness_data_preprocess-0.3.0/tests/test_functional_regression.py +334 -0
  24. exness_data_preprocess-0.3.0/tests/test_models.py +333 -0
  25. exness_data_preprocess-0.3.0/tests/test_processor_pydantic.py +222 -0
  26. exness_data_preprocess-0.3.0/tests/test_types.py +236 -0
  27. exness_data_preprocess-0.1.0/CHANGELOG.md +0 -35
  28. exness_data_preprocess-0.1.0/examples/add_schema_comments.py +0 -54
  29. exness_data_preprocess-0.1.0/src/exness_data_preprocess/__init__.py +0 -51
  30. exness_data_preprocess-0.1.0/src/exness_data_preprocess/api.py +0 -216
  31. exness_data_preprocess-0.1.0/tests/conftest.py +0 -90
  32. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/.github/workflows/ci.yml +0 -0
  33. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/.github/workflows/pre-commit-autoupdate.yml +0 -0
  34. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/.github/workflows/publish.yml +0 -0
  35. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/.pre-commit-config.yaml +0 -0
  36. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/AUTHORS.md +0 -0
  37. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/CONTRIBUTING.md +0 -0
  38. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/GITHUB_PYPI_SETUP.md +0 -0
  39. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/LICENSE +0 -0
  40. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/cliff.toml +0 -0
  41. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/EXNESS_DATA_SOURCES.md +0 -0
  42. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/archive/UNIFIED_DUCKDB_PLAN_v1.0.0_LEGACY.md +0 -0
  43. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/implementation-plan.yaml +0 -0
  44. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/planning-index.yaml +0 -0
  45. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/compression-benchmarks/README.md +0 -0
  46. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/compression-benchmarks/test_all_compression_methods.py +0 -0
  47. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/compression-benchmarks/test_delta_encoding_properly.py +0 -0
  48. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/compression-benchmarks/test_parquet_compression_methods.py +0 -0
  49. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/01-methodology.md +0 -0
  50. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/02-mode-truncated-analysis.md +0 -0
  51. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/03-hurdle-model-analysis.md +0 -0
  52. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/04-temporal-patterns.md +0 -0
  53. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/05-final-recommendations.md +0 -0
  54. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/README.md +0 -0
  55. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/scripts/reproduction_guide.md +0 -0
  56. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/visualizations/hurdle-model/hurdle_decomposition.png +0 -0
  57. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/visualizations/mode-truncated/cv_mode_comparison.png +0 -0
  58. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/visualizations/mode-truncated/distribution_overlay.png +0 -0
  59. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/visualizations/mode-truncated/signal_quality_comparison.png +0 -0
  60. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/visualizations/mode-truncated/variance_decomposition.png +0 -0
  61. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/visualizations/temporal/concentration_curve.png +0 -0
  62. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-spread-analysis/visualizations/temporal/percentile_analysis.png +0 -0
  63. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/01-methodology.md +0 -0
  64. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/02-baseline-sep2024.md +0 -0
  65. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/03-multiperiod-validation.md +0 -0
  66. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/04-discoveries-and-plan-evolution.md +0 -0
  67. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/README.md +0 -0
  68. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/findings/baseline-sep2024-comprehensive-summary.md +0 -0
  69. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/findings/phase2-mean-reversion-report.md +0 -0
  70. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/findings/phase3-volatility-model-report.md +0 -0
  71. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/findings/phase4-5-statistical-tests-survivorship-report.md +0 -0
  72. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/baseline-sep2024/01_mean_reversion_analysis.py +0 -0
  73. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/baseline-sep2024/02_volatility_model_simple.py +0 -0
  74. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/baseline-sep2024/03_liquidity_crisis_detection.py +0 -0
  75. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/baseline-sep2024/04_regime_detection_analysis.py +0 -0
  76. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase1_data_validation.py +0 -0
  77. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase2_mean_reversion.py +0 -0
  78. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase3_volatility_model.py +0 -0
  79. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase4_statistical_tests.py +0 -0
  80. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase5_survivorship_bias.py +0 -0
  81. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase5_survivorship_bias_v1.0.1.py +0 -0
  82. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase6a_interval_analysis.py +0 -0
  83. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase6b_price_clustering.py +0 -0
  84. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/multiperiod-validation/phase6c_combined_pattern.py +0 -0
  85. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/reproduction_guide.md +0 -0
  86. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/visualization/diagnostic_burst_decay.py +0 -0
  87. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/visualization/generate_interactive_dashboard.py +0 -0
  88. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/visualization/generate_lightweight_dashboard.py +0 -0
  89. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/docs/research/eurusd-zero-spread-deviations/scripts/visualization/prepare_visualization_data.py +0 -0
  90. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/src/exness_data_preprocess/cli.py +0 -0
  91. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/tests/__init__.py +0 -0
  92. {exness_data_preprocess-0.1.0 → exness_data_preprocess-0.3.0}/tests/test_basic.py +0 -0
@@ -1,6 +1,6 @@
1
1
  [tool.commitizen]
2
2
  name = "cz_conventional_commits"
3
- version = "0.1.0"
3
+ version = "0.2.0"
4
4
  tag_format = "v$major.$minor.$patch"
5
5
  update_changelog_on_bump = true
6
6
  version_files = [
@@ -98,3 +98,4 @@ uv.lock
98
98
 
99
99
  # Pre-commit
100
100
  # .pre-commit-config.yaml should be tracked, not ignored
101
+ .token-info.md
@@ -0,0 +1,53 @@
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
+
9
+ ### ✨ Features
10
+
11
+ - 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)
12
+
13
+
14
+ ### 🔧 Continuous Integration
15
+
16
+ - 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)
17
+
18
+
19
+ ### 🧰 Maintenance
20
+
21
+ - **release**: Bump version 0.1.0 → 0.2.0 [skip ci]
22
+
23
+
24
+ ### ✨ Features
25
+
26
+ - 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
27
+
28
+
29
+ ### 🐛 Bug Fixes
30
+
31
+ - Force add .pre-commit-config.yaml (was incorrectly gitignored)
32
+
33
+ - Remove .pre-commit-config.yaml from .gitignore Pre-commit config should be version controlled, not ignored.
34
+
35
+ - **pre-commit**: Enable unsafe fixes for ruff to resolve remaining errors
36
+
37
+ - **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)
38
+
39
+
40
+ ### 💅 Code Style
41
+
42
+ - 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
43
+
44
+
45
+ ### 🔧 CI/CD Improvements
46
+
47
+ - **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
48
+
49
+
50
+ ### 🧰 Maintenance
51
+
52
+ - Prepare v0.1.0 release
53
+
@@ -1,4 +1,6 @@
1
- # exness-data-preprocess - Project Memory
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
2
4
 
3
5
  **Architecture**: Professional forex tick data preprocessing with unified single-file DuckDB storage
4
6
 
@@ -6,6 +8,147 @@
6
8
 
7
9
  ---
8
10
 
11
+ ## Development Commands
12
+
13
+ ### Setup
14
+ ```bash
15
+ # Install with development dependencies
16
+ uv sync --dev
17
+
18
+ # Or with pip
19
+ pip install -e ".[dev]"
20
+ ```
21
+
22
+ ### Testing
23
+ ```bash
24
+ # Run all tests
25
+ uv run pytest
26
+
27
+ # Run with coverage
28
+ uv run pytest --cov=exness_data_preprocess --cov-report=html
29
+
30
+ # Run specific test file
31
+ uv run pytest tests/test_processor.py -v
32
+
33
+ # Run specific test
34
+ uv run pytest tests/test_processor.py::test_compression_ratio -v
35
+ ```
36
+
37
+ ### Code Quality
38
+ ```bash
39
+ # Format code
40
+ uv run ruff format .
41
+
42
+ # Check formatting without changes
43
+ uv run ruff format --check .
44
+
45
+ # Lint and auto-fix
46
+ uv run ruff check --fix .
47
+
48
+ # Lint without changes
49
+ uv run ruff check .
50
+
51
+ # Type checking
52
+ uv run mypy src/
53
+ ```
54
+
55
+ ### Building and Publishing
56
+ ```bash
57
+ # Build package
58
+ uv build
59
+
60
+ # Test installation locally
61
+ uv tool install --editable .
62
+
63
+ # Publish to PyPI (requires PYPI_TOKEN in environment)
64
+ doppler run --project claude-config --config dev -- uv publish --token "$PYPI_TOKEN"
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Codebase Architecture
70
+
71
+ ### Module Structure
72
+
73
+ **Core Components**:
74
+
75
+ 1. **`processor.py`** (`/Users/terryli/eon/exness-data-preprocess/src/exness_data_preprocess/processor.py`) - Main `ExnessDataProcessor` class
76
+ - **Lines 29-899**: Complete processor implementation
77
+ - **Lines 75-113**: `download_exness_zip()` - Downloads monthly ZIP files from ticks.ex2archive.com
78
+ - **Lines 115-232**: `_get_or_create_db()` - Database initialization with schema and COMMENT ON statements
79
+ - **Lines 234-245**: `_load_ticks_from_zip()` - CSV parsing from ZIP files
80
+ - **Lines 247-275**: `_append_ticks_to_db()` - Tick insertion with PRIMARY KEY duplicate prevention
81
+ - **Lines 277-377**: `_discover_missing_months()` - Gap detection for incremental updates
82
+ - **Lines 379-516**: `update_data()` - Main entry point for downloading and updating data
83
+ - **Lines 518-549**: `_regenerate_ohlc()` - Phase7 13-column OHLC (v1.2.0) generation with LEFT JOIN
84
+ - **Lines 551-603**: `query_ticks()` - Tick queries with date range and SQL filters
85
+ - **Lines 605-706**: `query_ohlc()` - OHLC queries with on-demand resampling (1m/5m/15m/1h/4h/1d)
86
+ - **Lines 708-821**: `add_schema_comments()` / `add_schema_comments_all()` - Retrofit self-documentation
87
+ - **Lines 823-899**: `get_data_coverage()` - Coverage statistics and metadata
88
+
89
+ 2. **`api.py`** (`/Users/terryli/eon/exness-data-preprocess/src/exness_data_preprocess/api.py`) - Simple wrapper functions
90
+ - Convenience functions wrapping `ExnessDataProcessor` methods
91
+ - Legacy v1.0.0 API compatibility layer (to be deprecated)
92
+
93
+ 3. **`cli.py`** (`/Users/terryli/eon/exness-data-preprocess/src/exness_data_preprocess/cli.py`) - Command-line interface
94
+ - Entry point: `exness-preprocess` command
95
+ - Commands for download, query, coverage operations
96
+
97
+ ### Key Design Patterns
98
+
99
+ **Unified Single-File Architecture** (v2.0.0):
100
+ - ONE DuckDB file per instrument (e.g., `eurusd.duckdb`) containing all historical data
101
+ - NO monthly file separation (major change from v1.0.0)
102
+ - Incremental updates with automatic gap detection
103
+ - PRIMARY KEY constraints prevent duplicates during updates
104
+
105
+ **Phase7 13-Column OHLC Schema** (v1.2.0):
106
+ - BID-only OHLC from Raw_Spread variant
107
+ - Dual spreads: `raw_spread_avg` and `standard_spread_avg`
108
+ - Dual tick counts: `tick_count_raw_spread` and `tick_count_standard`
109
+ - Normalized metrics: `range_per_spread`, `range_per_tick`, `body_per_spread`, `body_per_tick`
110
+ - Generated via LEFT JOIN between Raw_Spread and Standard variants
111
+
112
+ **Self-Documentation**:
113
+ - All tables and columns have embedded `COMMENT ON` statements
114
+ - Queryable via `duckdb_tables()` and `duckdb_columns()` system functions
115
+ - Enables BI tools and IDEs to display inline help
116
+
117
+ **Data Flow**:
118
+ ```
119
+ Exness Repository (monthly ZIPs)
120
+ → Automatic Gap Detection
121
+ → Download Missing Months (Raw_Spread + Standard)
122
+ → DuckDB Storage (PRIMARY KEY prevents duplicates)
123
+ → Phase7 OHLC Generation
124
+ → Query Interface (date ranges, SQL filters, resampling)
125
+ ```
126
+
127
+ ### Database Schema (per instrument)
128
+
129
+ Each `.duckdb` file contains:
130
+
131
+ 1. **`raw_spread_ticks`** table:
132
+ - Columns: `Timestamp` (PK), `Bid`, `Ask`
133
+ - Exness Raw_Spread variant (~98% zero-spreads, execution prices)
134
+ - Primary data source for OHLC construction
135
+
136
+ 2. **`standard_ticks`** table:
137
+ - Columns: `Timestamp` (PK), `Bid`, `Ask`
138
+ - Exness Standard variant (0% zero-spreads, always Bid < Ask)
139
+ - Reference data for spread comparison
140
+
141
+ 3. **`ohlc_1m`** table:
142
+ - **Schema**: Phase7 13-column (v1.2.0) - See [`schema.py`](src/exness_data_preprocess/schema.py)
143
+ - **Details**: BID-only OHLC with dual-variant spreads, tick counts, and normalized metrics
144
+ - **Reference**: [`DATABASE_SCHEMA.md`](docs/DATABASE_SCHEMA.md)
145
+
146
+ 4. **`metadata`** table:
147
+ - Columns: `key` (PK), `value`, `updated_at`
148
+ - Tracks coverage (earliest_date, latest_date, etc.)
149
+
150
+ ---
151
+
9
152
  ## Quick Links
10
153
 
11
154
  ### Documentation
@@ -22,7 +165,7 @@
22
165
 
23
166
  ### Development
24
167
  - **[CONTRIBUTING.md](CONTRIBUTING.md)** - Contribution guidelines
25
- - **[tests/README.md](tests/README.md)** - Test suite documentation
168
+ - **[tests/README.md](tests/README.md)** - Test suite documentation (v2.0.0 tests needed)
26
169
 
27
170
  ---
28
171
 
@@ -37,7 +180,7 @@
37
180
  - ✅ **Dual-variant storage**: Raw_Spread + Standard in same database
38
181
  - ✅ **PRIMARY KEY constraints**: Prevents duplicates during incremental updates
39
182
  - ✅ **Automatic gap detection**: Downloads only missing months
40
- - ✅ **Phase7 9-column OHLC**: Dual spreads + dual tick counts
183
+ - ✅ **Phase7 13-column OHLC (v1.2.0)**: Dual spreads + dual tick counts
41
184
  - ✅ **Date range queries**: Sub-15ms query performance
42
185
  - ✅ **On-demand resampling**: Any timeframe (5m, 1h, 1d) in <15ms
43
186
 
@@ -64,11 +207,13 @@
64
207
  - `/tmp/exness-duckdb-test/test_refactored_processor.py` - Validation test
65
208
  - `/tmp/exness-duckdb-test/test_queries_only.py` - Query validation test
66
209
 
67
- ### Phase7 9-Column OHLC Schema (✅ Implemented)
210
+ ### Phase7 13-Column OHLC Schema v1.2.0 (✅ Implemented)
68
211
 
69
- **Decision**: Dual-variant BID-only OHLC with 9 columns capturing both Raw_Spread and Standard characteristics
212
+ **Decision**: Dual-variant BID-only OHLC with 13 columns capturing both Raw_Spread and Standard characteristics plus normalized metrics
70
213
 
71
- **Schema**: `Timestamp | Open | High | Low | Close | raw_spread_avg | standard_spread_avg | tick_count_raw_spread | tick_count_standard`
214
+ **Schema**: Phase7 13-column (v1.2.0)
215
+ - **Definition**: See [`schema.py`](src/exness_data_preprocess/schema.py)
216
+ - **Documentation**: See [`DATABASE_SCHEMA.md`](docs/DATABASE_SCHEMA.md)
72
217
 
73
218
  **Key Features**:
74
219
  - ✅ **BID-only OHLC**: Uses Raw_Spread Bid prices (execution prices)
@@ -76,7 +221,7 @@
76
221
  - ✅ **Dual tick counts**: Records tick counts from both variants
77
222
  - ✅ **LEFT JOIN methodology**: Raw_Spread primary, Standard reference
78
223
 
79
- **Implementation**: [`src/exness_data_preprocess/processor.py`](src/exness_data_preprocess/processor.py) (lines 453-485)
224
+ **Implementation**: [`src/exness_data_preprocess/processor.py`](src/exness_data_preprocess/processor.py) (lines 518-549)
80
225
 
81
226
  **Specification**: [`docs/research/eurusd-zero-spread-deviations/data/plan/phase7_bid_ohlc_construction_v1.1.0.md`](docs/research/eurusd-zero-spread-deviations/data/plan/phase7_bid_ohlc_construction_v1.1.0.md)
82
227
 
@@ -111,7 +256,7 @@ SELECT table_name, column_name, data_type, comment FROM duckdb_columns();
111
256
  - `add_schema_comments(pair)` - Add comments to single database
112
257
  - `add_schema_comments_all()` - Batch-update all databases
113
258
 
114
- **Implementation**: [`src/exness_data_preprocess/processor.py`](src/exness_data_preprocess/processor.py) (lines 138-215, 698-797)
259
+ **Implementation**: [`src/exness_data_preprocess/processor.py`](src/exness_data_preprocess/processor.py) (lines 138-229, 708-821)
115
260
 
116
261
  **Usage Example**: [`examples/add_schema_comments.py`](examples/add_schema_comments.py)
117
262
 
@@ -161,21 +306,6 @@ SELECT table_name, column_name, data_type, comment FROM duckdb_columns();
161
306
 
162
307
  ---
163
308
 
164
- ## Development Setup
165
-
166
- **Quick Start**:
167
- ```bash
168
- git clone https://github.com/Eon-Labs/exness-data-preprocess.git
169
- cd exness-data-preprocess
170
- uv sync --dev
171
- ```
172
-
173
- **Complete Setup Guide**: [`README.md`](README.md) - Installation, testing, code quality, building
174
-
175
- **Contributing**: [`CONTRIBUTING.md`](CONTRIBUTING.md) - Contribution guidelines and workflow
176
-
177
- ---
178
-
179
309
  ## Current Implementation Status
180
310
 
181
311
  ### v2.0.0 Architecture (✅ Completed 2025-10-12)
@@ -184,7 +314,7 @@ uv sync --dev
184
314
  - ✅ **Dual-variant storage** - Raw_Spread + Standard in same database
185
315
  - ✅ **PRIMARY KEY constraints** - Prevents duplicates during incremental updates
186
316
  - ✅ **Automatic gap detection** - Downloads only missing months
187
- - ✅ **Phase7 9-column OHLC** - Dual spreads + dual tick counts
317
+ - ✅ **Phase7 13-column OHLC (v1.2.0)** - Dual spreads + dual tick counts
188
318
  - ✅ **Date range queries** - Sub-15ms query performance
189
319
  - ✅ **On-demand resampling** - Any timeframe in <15ms
190
320
  - ✅ **SQL filter support** - Direct SQL WHERE clauses on ticks
@@ -212,7 +342,7 @@ uv sync --dev
212
342
 
213
343
  ## File Locations
214
344
 
215
- **Project Root**: `/Users/terryli/eon/exness-data-preprocess/ `
345
+ **Project Root**: `/Users/terryli/eon/exness-data-preprocess/`
216
346
 
217
347
  **Data Storage** (default): `~/eon/exness-data/`
218
348
  ```
@@ -229,7 +359,7 @@ uv sync --dev
229
359
  eurusd.duckdb:
230
360
  ├── raw_spread_ticks # Timestamp (PK), Bid, Ask
231
361
  ├── standard_ticks # Timestamp (PK), Bid, Ask
232
- ├── ohlc_1m # Phase7 9-column schema
362
+ ├── ohlc_1m # Phase7 13-column schema (v1.2.0)
233
363
  └── metadata # Coverage tracking
234
364
  ```
235
365
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: exness-data-preprocess
3
- Version: 0.1.0
3
+ Version: 0.3.0
4
4
  Summary: Professional Exness forex tick data preprocessing with optimal compression (Parquet Zstd-22) and DuckDB OHLC generation. Provides efficient storage (9% smaller than ZIP) with lossless precision and direct queryability.
5
5
  Project-URL: Homepage, https://github.com/terrylica/exness-data-preprocess
6
6
  Project-URL: Documentation, https://github.com/terrylica/exness-data-preprocess#readme
@@ -33,6 +33,7 @@ Requires-Dist: duckdb>=0.9.0
33
33
  Requires-Dist: httpx>=0.25.0
34
34
  Requires-Dist: pandas>=2.0.0
35
35
  Requires-Dist: pyarrow>=16.0.0
36
+ Requires-Dist: pydantic>=2.0.0
36
37
  Requires-Dist: tqdm>=4.65.0
37
38
  Provides-Extra: dev
38
39
  Requires-Dist: black>=23.0.0; extra == 'dev'
@@ -54,14 +55,14 @@ Description-Content-Type: text/markdown
54
55
  [![Downloads](https://img.shields.io/pypi/dm/exness-data-preprocess.svg)](https://pypi.org/project/exness-data-preprocess/)
55
56
  [![Code style: ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
56
57
 
57
- Professional forex tick data preprocessing with unified single-file DuckDB storage. Provides incremental updates, dual-variant storage (Raw_Spread + Standard), and Phase7 9-column OHLC schema with sub-15ms query performance.
58
+ Professional forex tick data preprocessing with unified single-file DuckDB storage. Provides incremental updates, dual-variant storage (Raw_Spread + Standard), and Phase7 13-column OHLC schema (v1.2.0) with sub-15ms query performance.
58
59
 
59
60
  ## Features
60
61
 
61
62
  - **Unified Single-File Architecture**: One DuckDB file per instrument (eurusd.duckdb)
62
63
  - **Incremental Updates**: Automatic gap detection and download only missing months
63
64
  - **Dual-Variant Storage**: Raw_Spread (primary) + Standard (reference) in same database
64
- - **Phase7 OHLC Schema**: 9-column bars with dual spreads and dual tick counts
65
+ - **Phase7 OHLC Schema**: 13-column bars (v1.2.0) with dual spreads, tick counts, and normalized metrics
65
66
  - **Fast Queries**: Date range queries with sub-15ms performance
66
67
  - **On-Demand Resampling**: Any timeframe (5m, 1h, 1d) resampled in <15ms
67
68
  - **PRIMARY KEY Constraints**: Prevents duplicate data during incremental updates
@@ -137,7 +138,7 @@ Download Only Missing Months (Raw_Spread + Standard)
137
138
  ↓
138
139
  DuckDB Single-File Storage (PRIMARY KEY prevents duplicates)
139
140
  ↓
140
- Phase7 9-Column OHLC Generation (dual spreads + dual tick counts)
141
+ Phase7 13-Column OHLC Generation (v1.2.0 - dual spreads, tick counts, normalized metrics)
141
142
  ↓
142
143
  Query Interface (date ranges, SQL filters, on-demand resampling)
143
144
  ```
@@ -149,19 +150,13 @@ Query Interface (date ranges, SQL filters, on-demand resampling)
149
150
  **Schema**:
150
151
  - `raw_spread_ticks` table: Timestamp (PK), Bid, Ask
151
152
  - `standard_ticks` table: Timestamp (PK), Bid, Ask
152
- - `ohlc_1m` table: Phase7 9-column schema
153
+ - `ohlc_1m` table: Phase7 13-column schema (v1.2.0)
153
154
  - `metadata` table: Coverage tracking
154
155
 
155
- **Phase7 9-Column OHLC**:
156
- 1. `Timestamp` - Bar timestamp
157
- 2. `Open` - Opening price
158
- 3. `High` - High price
159
- 4. `Low` - Low price
160
- 5. `Close` - Closing price
161
- 6. `raw_spread_avg` - Average spread from Raw_Spread variant
162
- 7. `standard_spread_avg` - Average spread from Standard variant
163
- 8. `tick_count_raw_spread` - Tick count from Raw_Spread variant
164
- 9. `tick_count_standard` - Tick count from Standard variant
156
+ **Phase7 13-Column OHLC (v1.2.0)**:
157
+ - **Column Definitions**: See [`schema.py`](src/exness_data_preprocess/schema.py) - Single source of truth
158
+ - **Comprehensive Reference**: See [`DATABASE_SCHEMA.md`](docs/DATABASE_SCHEMA.md) - Query examples and usage patterns
159
+ - **Key Features**: BID-only OHLC with dual spreads (Raw_Spread + Standard) and normalized spread metrics
165
160
 
166
161
  ### Directory Structure
167
162