hermetic-alpha 0.1.2__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.
- hermetic_alpha-0.1.2/.github/workflows/ci.yml +44 -0
- hermetic_alpha-0.1.2/.github/workflows/publish-pypi.yml +39 -0
- hermetic_alpha-0.1.2/.gitignore +21 -0
- hermetic_alpha-0.1.2/CHANGELOG.md +30 -0
- hermetic_alpha-0.1.2/CONTRIBUTING.md +48 -0
- hermetic_alpha-0.1.2/LICENSE +21 -0
- hermetic_alpha-0.1.2/PKG-INFO +230 -0
- hermetic_alpha-0.1.2/README.md +203 -0
- hermetic_alpha-0.1.2/data/.gitkeep +0 -0
- hermetic_alpha-0.1.2/docs/README.md +32 -0
- hermetic_alpha-0.1.2/docs/adr/0001-first-ephemeris-engine.md +119 -0
- hermetic_alpha-0.1.2/docs/anti-overfitting.md +101 -0
- hermetic_alpha-0.1.2/docs/architecture.md +118 -0
- hermetic_alpha-0.1.2/docs/concepts.md +113 -0
- hermetic_alpha-0.1.2/docs/data-model.md +168 -0
- hermetic_alpha-0.1.2/docs/overview.md +368 -0
- hermetic_alpha-0.1.2/docs/research-workflow.md +112 -0
- hermetic_alpha-0.1.2/docs/roadmap.md +102 -0
- hermetic_alpha-0.1.2/docs/statistical-methods.md +305 -0
- hermetic_alpha-0.1.2/docs/troubleshooting.md +805 -0
- hermetic_alpha-0.1.2/examples/basic_event_study.py +24 -0
- hermetic_alpha-0.1.2/examples/provider_to_cache.py +39 -0
- hermetic_alpha-0.1.2/examples/real_market_astronomy_return_case.py +583 -0
- hermetic_alpha-0.1.2/examples/synthetic_astronomy_return_case.py +174 -0
- hermetic_alpha-0.1.2/pyproject.toml +45 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/__init__.py +39 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/analysis/__init__.py +73 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/analysis/event_study.py +599 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/analysis/validation.py +649 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/astro/__init__.py +42 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/astro/aspects.py +289 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/astro/ephemeris.py +225 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/astro/math.py +34 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/exports/__init__.py +6 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/exports/csv.py +119 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/exports/json.py +58 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/features/__init__.py +19 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/features/aspects.py +339 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/labels/__init__.py +31 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/labels/market.py +332 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/market/__init__.py +20 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/market/providers.py +178 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/market/storage.py +196 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/models/__init__.py +12 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/models/astro.py +62 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/models/market.py +59 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/py.typed +1 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/similarity/__init__.py +39 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/similarity/encoding.py +153 -0
- hermetic_alpha-0.1.2/src/hermetic_alpha/similarity/search.py +351 -0
- hermetic_alpha-0.1.2/tests/test_aspects.py +427 -0
- hermetic_alpha-0.1.2/tests/test_docs_research_boundaries.py +60 -0
- hermetic_alpha-0.1.2/tests/test_ephemeris.py +372 -0
- hermetic_alpha-0.1.2/tests/test_event_study.py +1600 -0
- hermetic_alpha-0.1.2/tests/test_exports.py +1035 -0
- hermetic_alpha-0.1.2/tests/test_features.py +656 -0
- hermetic_alpha-0.1.2/tests/test_market_providers.py +207 -0
- hermetic_alpha-0.1.2/tests/test_market_storage.py +322 -0
- hermetic_alpha-0.1.2/tests/test_models.py +11 -0
- hermetic_alpha-0.1.2/tests/test_project_metadata.py +39 -0
- hermetic_alpha-0.1.2/tests/test_public_api.py +121 -0
- hermetic_alpha-0.1.2/tests/test_similarity_encoding.py +902 -0
- hermetic_alpha-0.1.2/tests/test_validation.py +774 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
pull_request:
|
|
5
|
+
branches: [main]
|
|
6
|
+
push:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
tests:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.11", "3.12"]
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Setup Python
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install runtime and test dependencies
|
|
26
|
+
run: python -m pip install -e ".[dev]"
|
|
27
|
+
|
|
28
|
+
- name: Run tests
|
|
29
|
+
run: python3 -m pytest -q
|
|
30
|
+
|
|
31
|
+
- name: Smoke import check
|
|
32
|
+
run: |
|
|
33
|
+
python3 - <<'PY'
|
|
34
|
+
import hermetic_alpha
|
|
35
|
+
from hermetic_alpha.labels import add_forward_returns
|
|
36
|
+
from hermetic_alpha.analysis import summarize_event_study
|
|
37
|
+
|
|
38
|
+
labels = add_forward_returns([100, 110, 99, 120, 95, 128], [1, 7])
|
|
39
|
+
result = summarize_event_study(labels, [1, 2], 1)
|
|
40
|
+
assert result.events == 2
|
|
41
|
+
assert isinstance(hermetic_alpha.__version__, str)
|
|
42
|
+
assert hermetic_alpha.__version__.count(".") == 2
|
|
43
|
+
print("smoke ok")
|
|
44
|
+
PY
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
release:
|
|
8
|
+
types: [published]
|
|
9
|
+
workflow_dispatch:
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
publish:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
steps:
|
|
17
|
+
- name: Checkout
|
|
18
|
+
uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Setup Python
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: "3.12"
|
|
24
|
+
|
|
25
|
+
- name: Install build tooling
|
|
26
|
+
run: python -m pip install --upgrade pip build twine
|
|
27
|
+
|
|
28
|
+
- name: Build package
|
|
29
|
+
run: python -m build
|
|
30
|
+
|
|
31
|
+
- name: Validate built artifacts
|
|
32
|
+
run: python -m twine check dist/*
|
|
33
|
+
|
|
34
|
+
- name: Publish to PyPI
|
|
35
|
+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'release' || startsWith(github.ref, 'refs/tags/')
|
|
36
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
37
|
+
with:
|
|
38
|
+
user: __token__
|
|
39
|
+
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.pytest_cache/
|
|
6
|
+
.coverage
|
|
7
|
+
htmlcov/
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv/
|
|
11
|
+
venv/
|
|
12
|
+
|
|
13
|
+
# Local data and outputs
|
|
14
|
+
data/*
|
|
15
|
+
!data/.gitkeep
|
|
16
|
+
outputs/
|
|
17
|
+
|
|
18
|
+
# OS/editor
|
|
19
|
+
.DS_Store
|
|
20
|
+
.vscode/
|
|
21
|
+
.idea/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [Unreleased]
|
|
4
|
+
|
|
5
|
+
- Work in progress.
|
|
6
|
+
|
|
7
|
+
## [0.1.2] - 2026-06-05
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- Add standard OSS distribution metadata in `pyproject.toml` (project urls, keywords, version bump).
|
|
11
|
+
- Add `CHANGELOG.md`.
|
|
12
|
+
- Add import-time smoke test in CI.
|
|
13
|
+
- Improve README quick start with standard `pip install` flow and non-PYTHONPATH usage.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- Synchronize package version constant (`src/hermetic_alpha/__init__.py`) with project version.
|
|
17
|
+
- Update release tagging to `v0.1.2` for packaging alignment.
|
|
18
|
+
|
|
19
|
+
## [0.1.1] - 2026-06-04
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
- Real market research workflow docs and scripts.
|
|
23
|
+
- Synthetic and real-market astrology-case examples.
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
- Improve fallback handling and CSV/JSON export consistency for research scripts.
|
|
27
|
+
|
|
28
|
+
## [0.1.0] - 2026-06-01
|
|
29
|
+
|
|
30
|
+
- Initial packaged research engine release.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Contributing to Hermetic Alpha Library
|
|
2
|
+
|
|
3
|
+
Thank you for considering a contribution.
|
|
4
|
+
|
|
5
|
+
## Project Principles
|
|
6
|
+
|
|
7
|
+
- Keep research reproducible.
|
|
8
|
+
- Avoid deterministic financial claims.
|
|
9
|
+
- Report sample size and baseline comparisons.
|
|
10
|
+
- Keep core logic independent from CLI, API, and web UI concerns.
|
|
11
|
+
- Update documentation and troubleshooting notes after meaningful code changes.
|
|
12
|
+
|
|
13
|
+
## Local Development
|
|
14
|
+
|
|
15
|
+
Preferred setup with `uv`:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
uv venv
|
|
19
|
+
uv pip install -e ".[dev]"
|
|
20
|
+
uv run python3 -m pytest -q
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Standard `venv` setup:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python3 -m venv .venv
|
|
27
|
+
. .venv/bin/activate
|
|
28
|
+
python3 -m pip install -U pip
|
|
29
|
+
python3 -m pip install -e ".[dev]"
|
|
30
|
+
python3 -m pytest -q
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The development extra installs `pytest`, and the repository's
|
|
34
|
+
`pyproject.toml` config points pytest at `src/` and `tests/`.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
PYTHONPATH=src python3 examples/basic_event_study.py
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
When the development extra is installed:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
python3 -m pytest -q
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Documentation
|
|
47
|
+
|
|
48
|
+
Before opening a pull request, update relevant files in `docs/`, especially `docs/troubleshooting.md` for implementation notes, known limitations, or environment issues.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hermetic Alpha Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hermetic-alpha
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: Core Python research engine for astro-financial pattern analysis.
|
|
5
|
+
Project-URL: Homepage, https://github.com/wauputr4/hermetic-alpha-library
|
|
6
|
+
Project-URL: Documentation, https://github.com/wauputr4/hermetic-alpha-library/blob/main/README.md
|
|
7
|
+
Project-URL: Repository, https://github.com/wauputr4/hermetic-alpha-library
|
|
8
|
+
Project-URL: Issues, https://github.com/wauputr4/hermetic-alpha-library/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/wauputr4/hermetic-alpha-library/blob/main/CHANGELOG.md
|
|
10
|
+
Author: Hermetic Alpha Contributors
|
|
11
|
+
License: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: astro-finance,astrology,event-study,market-research,python-library
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Science/Research
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
21
|
+
Requires-Python: >=3.11
|
|
22
|
+
Provides-Extra: dev
|
|
23
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
24
|
+
Provides-Extra: ephemeris
|
|
25
|
+
Requires-Dist: pyswisseph>=2.10; extra == 'ephemeris'
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# Hermetic Alpha Library
|
|
29
|
+
|
|
30
|
+
**Hermetic Alpha Library** is the core research engine for exploring statistical relationships between astrological configurations and financial market behavior.
|
|
31
|
+
|
|
32
|
+
The library is designed to calculate planetary positions, derive astrological aspects, transform them into quantitative features, and evaluate their relationship with market outcomes such as bullish probability, local tops, local bottoms, and forward returns.
|
|
33
|
+
|
|
34
|
+
> This project does not claim deterministic prediction. It provides transparent tools for statistical research, event studies, and reproducible backtesting.
|
|
35
|
+
|
|
36
|
+
Hermetic Alpha is not financial advice and should not be used as a standalone
|
|
37
|
+
trading signal. Any observed relationship between astrological features and
|
|
38
|
+
market outcomes must be interpreted as exploratory until it is supported by
|
|
39
|
+
adequate sample size, baseline comparison, confidence intervals, and validation
|
|
40
|
+
on data that was not used to discover the pattern.
|
|
41
|
+
|
|
42
|
+
See the [anti-overfitting guide](docs/anti-overfitting.md) for the project
|
|
43
|
+
rules on responsible probability reporting, leakage prevention, and
|
|
44
|
+
cherry-picking control.
|
|
45
|
+
|
|
46
|
+
## Goals
|
|
47
|
+
|
|
48
|
+
- Compute planetary positions and astrological aspects for historical timestamps.
|
|
49
|
+
- Convert chart configurations into machine-readable features.
|
|
50
|
+
- Analyze whether specific aspects correlate with market behavior.
|
|
51
|
+
- Support event-study workflows for assets such as Bitcoin.
|
|
52
|
+
- Provide reusable Python APIs for CLI, notebooks, and future web applications.
|
|
53
|
+
|
|
54
|
+
## Initial Scope
|
|
55
|
+
|
|
56
|
+
The first version focuses on:
|
|
57
|
+
|
|
58
|
+
- Natal/transit-style chart calculation for timestamps.
|
|
59
|
+
- Major aspects: conjunction, opposition, trine, square, sextile.
|
|
60
|
+
- Configurable orb ranges.
|
|
61
|
+
- Market return labels across multiple horizons.
|
|
62
|
+
- Conditional probability analysis.
|
|
63
|
+
- Event-study summaries.
|
|
64
|
+
- Exportable CSV/JSON results.
|
|
65
|
+
|
|
66
|
+
## Planned Python Package
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from hermetic_alpha.analysis import summarize_event_study
|
|
70
|
+
from hermetic_alpha.astro import detect_aspect
|
|
71
|
+
from hermetic_alpha.labels import add_forward_returns
|
|
72
|
+
|
|
73
|
+
closes = [100, 110, 99, 120, 95, 128]
|
|
74
|
+
labels = add_forward_returns(closes, horizons=[1, 7, 30])
|
|
75
|
+
|
|
76
|
+
aspect = detect_aspect(
|
|
77
|
+
body_a="sun",
|
|
78
|
+
longitude_a=10,
|
|
79
|
+
body_b="jupiter",
|
|
80
|
+
longitude_b=12,
|
|
81
|
+
aspect="conjunction",
|
|
82
|
+
max_orb=3,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
assert aspect is not None
|
|
86
|
+
result = summarize_event_study(labels, event_indexes=[0, 1], horizon=1)
|
|
87
|
+
print(result)
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Export library result objects without adding runtime dependencies:
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from hermetic_alpha.exports import to_csv, to_json
|
|
94
|
+
|
|
95
|
+
json_text = to_json(result)
|
|
96
|
+
csv_text = to_csv([result])
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
CSV export is intentionally limited to flat rows. Flatten nested research
|
|
100
|
+
structures before writing CSV so downstream column names remain explicit.
|
|
101
|
+
|
|
102
|
+
## Repository Role
|
|
103
|
+
|
|
104
|
+
This repository contains only the reusable core logic. User-facing tools such as command-line interfaces, APIs, and dashboards should call this library instead of duplicating analysis logic.
|
|
105
|
+
|
|
106
|
+
## Development Quickstart
|
|
107
|
+
|
|
108
|
+
### Install package
|
|
109
|
+
|
|
110
|
+
Jika `hermetic-alpha` sudah dipublish ke PyPI, ini adalah cara paling sederhana:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
python3 -m pip install hermetic-alpha
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Jika belum dipublish, install dari Git tag/repository GitHub:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
python3 -m pip install "git+https://github.com/wauputr4/hermetic-alpha-library.git@v0.1.2"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Atau dari arsip tag GitHub (jika tersedia jaringan ke GitHub):
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
python3 -m pip install "https://github.com/wauputr4/hermetic-alpha-library/archive/refs/tags/v0.1.2.tar.gz"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Opsional fitur ephemeris nyata:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
python3 -m pip install "git+https://github.com/wauputr4/hermetic-alpha-library.git@v0.1.2#egg=hermetic-alpha[ephemeris]"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Untuk kontribusi pengembangan:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
python3 -m pip install -e ".[dev,ephemeris]"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Create a local development environment with `uv` when it is available:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
uv venv
|
|
144
|
+
uv pip install -e ".[dev]"
|
|
145
|
+
uv run python3 -m pytest -q
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Or use the standard library `venv` plus `pip`:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
python3 -m venv .venv
|
|
152
|
+
. .venv/bin/activate
|
|
153
|
+
python3 -m pip install -U pip
|
|
154
|
+
python3 -m pip install -e ".[dev]"
|
|
155
|
+
python3 -m pytest -q
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The `pyproject.toml` pytest configuration sets `pythonpath = ["src"]`, so tests
|
|
159
|
+
can import the package directly from the source tree even before an editable
|
|
160
|
+
install is created.
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
python3 examples/basic_event_study.py
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Fetch normalized BTC daily candles through the first market provider and write
|
|
167
|
+
the local JSON cache with the library storage helper:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
python3 examples/provider_to_cache.py data/btc-daily.json --start 2024-01-01 --end 2024-01-31
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Yahoo Finance is a convenient research input, not an audit-grade market feed.
|
|
174
|
+
|
|
175
|
+
When the development extra is installed:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
python3 -m pytest -q
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Quick Start Penelitian
|
|
182
|
+
|
|
183
|
+
Langkah cepat untuk jalankan riset dari nol:
|
|
184
|
+
|
|
185
|
+
1. Buat label market dari close:
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
python3 - <<'PY'
|
|
189
|
+
from hermetic_alpha.labels import add_forward_returns
|
|
190
|
+
returns = add_forward_returns([100, 110, 99, 120, 95, 128], [1, 7, 30])
|
|
191
|
+
print(returns)
|
|
192
|
+
PY
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
2. Jalankan contoh alur sintetik lengkap (conjunction Sun-Moon vs return 1d):
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
python3 examples/synthetic_astronomy_return_case.py
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
3. Jalankan contoh real-market (data harga nyata dari Yahoo Finance):
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
python3 examples/real_market_astronomy_return_case.py
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Untuk mode yang lebih kuat (multi-asset dan walk-forward), jalankan:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
python3 examples/real_market_astronomy_return_case.py \
|
|
211
|
+
--assets BTC-USD,ETH-USD,SOL-USD \
|
|
212
|
+
--start 2025-01-01 \
|
|
213
|
+
--end 2026-01-01 \
|
|
214
|
+
--horizon 1 \
|
|
215
|
+
--aspects conjunction,square \
|
|
216
|
+
--bodies sun,moon \
|
|
217
|
+
--max-orb 1.0 \
|
|
218
|
+
--walk-forward-train-size 200 \
|
|
219
|
+
--walk-forward-test-size 60 \
|
|
220
|
+
--walk-forward-step-size 60
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
4. Baca flow riset + catatan anti-overfitting di:
|
|
224
|
+
|
|
225
|
+
- [Research workflow docs](docs/research-workflow.md)
|
|
226
|
+
- [Anti-overfitting guide](docs/anti-overfitting.md)
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
MIT
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# Hermetic Alpha Library
|
|
2
|
+
|
|
3
|
+
**Hermetic Alpha Library** is the core research engine for exploring statistical relationships between astrological configurations and financial market behavior.
|
|
4
|
+
|
|
5
|
+
The library is designed to calculate planetary positions, derive astrological aspects, transform them into quantitative features, and evaluate their relationship with market outcomes such as bullish probability, local tops, local bottoms, and forward returns.
|
|
6
|
+
|
|
7
|
+
> This project does not claim deterministic prediction. It provides transparent tools for statistical research, event studies, and reproducible backtesting.
|
|
8
|
+
|
|
9
|
+
Hermetic Alpha is not financial advice and should not be used as a standalone
|
|
10
|
+
trading signal. Any observed relationship between astrological features and
|
|
11
|
+
market outcomes must be interpreted as exploratory until it is supported by
|
|
12
|
+
adequate sample size, baseline comparison, confidence intervals, and validation
|
|
13
|
+
on data that was not used to discover the pattern.
|
|
14
|
+
|
|
15
|
+
See the [anti-overfitting guide](docs/anti-overfitting.md) for the project
|
|
16
|
+
rules on responsible probability reporting, leakage prevention, and
|
|
17
|
+
cherry-picking control.
|
|
18
|
+
|
|
19
|
+
## Goals
|
|
20
|
+
|
|
21
|
+
- Compute planetary positions and astrological aspects for historical timestamps.
|
|
22
|
+
- Convert chart configurations into machine-readable features.
|
|
23
|
+
- Analyze whether specific aspects correlate with market behavior.
|
|
24
|
+
- Support event-study workflows for assets such as Bitcoin.
|
|
25
|
+
- Provide reusable Python APIs for CLI, notebooks, and future web applications.
|
|
26
|
+
|
|
27
|
+
## Initial Scope
|
|
28
|
+
|
|
29
|
+
The first version focuses on:
|
|
30
|
+
|
|
31
|
+
- Natal/transit-style chart calculation for timestamps.
|
|
32
|
+
- Major aspects: conjunction, opposition, trine, square, sextile.
|
|
33
|
+
- Configurable orb ranges.
|
|
34
|
+
- Market return labels across multiple horizons.
|
|
35
|
+
- Conditional probability analysis.
|
|
36
|
+
- Event-study summaries.
|
|
37
|
+
- Exportable CSV/JSON results.
|
|
38
|
+
|
|
39
|
+
## Planned Python Package
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from hermetic_alpha.analysis import summarize_event_study
|
|
43
|
+
from hermetic_alpha.astro import detect_aspect
|
|
44
|
+
from hermetic_alpha.labels import add_forward_returns
|
|
45
|
+
|
|
46
|
+
closes = [100, 110, 99, 120, 95, 128]
|
|
47
|
+
labels = add_forward_returns(closes, horizons=[1, 7, 30])
|
|
48
|
+
|
|
49
|
+
aspect = detect_aspect(
|
|
50
|
+
body_a="sun",
|
|
51
|
+
longitude_a=10,
|
|
52
|
+
body_b="jupiter",
|
|
53
|
+
longitude_b=12,
|
|
54
|
+
aspect="conjunction",
|
|
55
|
+
max_orb=3,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
assert aspect is not None
|
|
59
|
+
result = summarize_event_study(labels, event_indexes=[0, 1], horizon=1)
|
|
60
|
+
print(result)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Export library result objects without adding runtime dependencies:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from hermetic_alpha.exports import to_csv, to_json
|
|
67
|
+
|
|
68
|
+
json_text = to_json(result)
|
|
69
|
+
csv_text = to_csv([result])
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
CSV export is intentionally limited to flat rows. Flatten nested research
|
|
73
|
+
structures before writing CSV so downstream column names remain explicit.
|
|
74
|
+
|
|
75
|
+
## Repository Role
|
|
76
|
+
|
|
77
|
+
This repository contains only the reusable core logic. User-facing tools such as command-line interfaces, APIs, and dashboards should call this library instead of duplicating analysis logic.
|
|
78
|
+
|
|
79
|
+
## Development Quickstart
|
|
80
|
+
|
|
81
|
+
### Install package
|
|
82
|
+
|
|
83
|
+
Jika `hermetic-alpha` sudah dipublish ke PyPI, ini adalah cara paling sederhana:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
python3 -m pip install hermetic-alpha
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Jika belum dipublish, install dari Git tag/repository GitHub:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
python3 -m pip install "git+https://github.com/wauputr4/hermetic-alpha-library.git@v0.1.2"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Atau dari arsip tag GitHub (jika tersedia jaringan ke GitHub):
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
python3 -m pip install "https://github.com/wauputr4/hermetic-alpha-library/archive/refs/tags/v0.1.2.tar.gz"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Opsional fitur ephemeris nyata:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
python3 -m pip install "git+https://github.com/wauputr4/hermetic-alpha-library.git@v0.1.2#egg=hermetic-alpha[ephemeris]"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Untuk kontribusi pengembangan:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
python3 -m pip install -e ".[dev,ephemeris]"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Create a local development environment with `uv` when it is available:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
uv venv
|
|
117
|
+
uv pip install -e ".[dev]"
|
|
118
|
+
uv run python3 -m pytest -q
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Or use the standard library `venv` plus `pip`:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
python3 -m venv .venv
|
|
125
|
+
. .venv/bin/activate
|
|
126
|
+
python3 -m pip install -U pip
|
|
127
|
+
python3 -m pip install -e ".[dev]"
|
|
128
|
+
python3 -m pytest -q
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The `pyproject.toml` pytest configuration sets `pythonpath = ["src"]`, so tests
|
|
132
|
+
can import the package directly from the source tree even before an editable
|
|
133
|
+
install is created.
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
python3 examples/basic_event_study.py
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Fetch normalized BTC daily candles through the first market provider and write
|
|
140
|
+
the local JSON cache with the library storage helper:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
python3 examples/provider_to_cache.py data/btc-daily.json --start 2024-01-01 --end 2024-01-31
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Yahoo Finance is a convenient research input, not an audit-grade market feed.
|
|
147
|
+
|
|
148
|
+
When the development extra is installed:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
python3 -m pytest -q
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Quick Start Penelitian
|
|
155
|
+
|
|
156
|
+
Langkah cepat untuk jalankan riset dari nol:
|
|
157
|
+
|
|
158
|
+
1. Buat label market dari close:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
python3 - <<'PY'
|
|
162
|
+
from hermetic_alpha.labels import add_forward_returns
|
|
163
|
+
returns = add_forward_returns([100, 110, 99, 120, 95, 128], [1, 7, 30])
|
|
164
|
+
print(returns)
|
|
165
|
+
PY
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
2. Jalankan contoh alur sintetik lengkap (conjunction Sun-Moon vs return 1d):
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
python3 examples/synthetic_astronomy_return_case.py
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
3. Jalankan contoh real-market (data harga nyata dari Yahoo Finance):
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
python3 examples/real_market_astronomy_return_case.py
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Untuk mode yang lebih kuat (multi-asset dan walk-forward), jalankan:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
python3 examples/real_market_astronomy_return_case.py \
|
|
184
|
+
--assets BTC-USD,ETH-USD,SOL-USD \
|
|
185
|
+
--start 2025-01-01 \
|
|
186
|
+
--end 2026-01-01 \
|
|
187
|
+
--horizon 1 \
|
|
188
|
+
--aspects conjunction,square \
|
|
189
|
+
--bodies sun,moon \
|
|
190
|
+
--max-orb 1.0 \
|
|
191
|
+
--walk-forward-train-size 200 \
|
|
192
|
+
--walk-forward-test-size 60 \
|
|
193
|
+
--walk-forward-step-size 60
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
4. Baca flow riset + catatan anti-overfitting di:
|
|
197
|
+
|
|
198
|
+
- [Research workflow docs](docs/research-workflow.md)
|
|
199
|
+
- [Anti-overfitting guide](docs/anti-overfitting.md)
|
|
200
|
+
|
|
201
|
+
## License
|
|
202
|
+
|
|
203
|
+
MIT
|
|
File without changes
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Hermetic Alpha Library Documentation
|
|
2
|
+
|
|
3
|
+
This documentation describes the design, research logic, statistical methods, and implementation plan for **Hermetic Alpha Library**.
|
|
4
|
+
|
|
5
|
+
Hermetic Alpha Library is the reusable Python core for astro-financial pattern research. It should remain independent from any CLI, API, notebook, or web dashboard.
|
|
6
|
+
|
|
7
|
+
## Documentation Map
|
|
8
|
+
|
|
9
|
+
- [Overview](overview.md)
|
|
10
|
+
- [Architecture](architecture.md)
|
|
11
|
+
- [Research Concepts](concepts.md)
|
|
12
|
+
- [Anti-Overfitting Guide](anti-overfitting.md)
|
|
13
|
+
- [Statistical Methods](statistical-methods.md)
|
|
14
|
+
- [Data Model](data-model.md)
|
|
15
|
+
- [Implementation Roadmap](roadmap.md)
|
|
16
|
+
- [Troubleshooting Notes](troubleshooting.md)
|
|
17
|
+
- [ADR 0001: First Ephemeris Engine](adr/0001-first-ephemeris-engine.md)
|
|
18
|
+
- [Research Workflow + Quick Start](research-workflow.md)
|
|
19
|
+
|
|
20
|
+
## Core Philosophy
|
|
21
|
+
|
|
22
|
+
Hermetic Alpha should be built as a transparent research engine, not a black-box prediction system.
|
|
23
|
+
|
|
24
|
+
The project should help answer questions such as:
|
|
25
|
+
|
|
26
|
+
- How often did Bitcoin rise after a specific astrological aspect?
|
|
27
|
+
- Is the result better than the baseline market probability?
|
|
28
|
+
- How many historical events support the observation?
|
|
29
|
+
- Is the effect stable across different time periods?
|
|
30
|
+
- Are there similar past chart configurations?
|
|
31
|
+
|
|
32
|
+
Every result should be reproducible, inspectable, and statistically cautious.
|