chronos-lab 0.1.6__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.
- chronos_lab-0.1.6/.gitignore +207 -0
- chronos_lab-0.1.6/CHANGELOG.md +84 -0
- chronos_lab-0.1.6/LICENSE +21 -0
- chronos_lab-0.1.6/PKG-INFO +104 -0
- chronos_lab-0.1.6/README.md +60 -0
- chronos_lab-0.1.6/chronos_lab/.dataset.example.json +52 -0
- chronos_lab-0.1.6/chronos_lab/.env.example +30 -0
- chronos_lab-0.1.6/chronos_lab/__init__.py +84 -0
- chronos_lab-0.1.6/chronos_lab/_utils.py +41 -0
- chronos_lab-0.1.6/chronos_lab/analysis/__init__.py +3 -0
- chronos_lab-0.1.6/chronos_lab/analysis/calculation/__init__.py +0 -0
- chronos_lab-0.1.6/chronos_lab/analysis/calculation/anomaly.py +99 -0
- chronos_lab-0.1.6/chronos_lab/analysis/dag/__init__.py +0 -0
- chronos_lab-0.1.6/chronos_lab/analysis/dag/anomaly.py +173 -0
- chronos_lab-0.1.6/chronos_lab/analysis/dag/features.py +26 -0
- chronos_lab-0.1.6/chronos_lab/analysis/dag/standardize.py +84 -0
- chronos_lab-0.1.6/chronos_lab/arcdb.py +458 -0
- chronos_lab-0.1.6/chronos_lab/aws.py +683 -0
- chronos_lab-0.1.6/chronos_lab/dataset.py +425 -0
- chronos_lab-0.1.6/chronos_lab/intrinio.py +695 -0
- chronos_lab-0.1.6/chronos_lab/mcp_server.py +10 -0
- chronos_lab-0.1.6/chronos_lab/plot.py +256 -0
- chronos_lab-0.1.6/chronos_lab/settings.py +177 -0
- chronos_lab-0.1.6/chronos_lab/sources.py +660 -0
- chronos_lab-0.1.6/chronos_lab/storage.py +418 -0
- chronos_lab-0.1.6/pyproject.toml +86 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to chronos-lab 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
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.5] - 2026-01-25
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Anomaly Detection System**: Complete ML-powered pipeline for detecting anomalies in OHLCV data using Isolation Forest, with Hamilton DAG-based architecture for scalable symbol-level processing
|
|
14
|
+
- **Visualization**: Anomaly plots with `mplfinance` integration, featuring customizable styling, human-readable axis formatting (1K, 1M, 1B), and flexible date range filtering
|
|
15
|
+
- **Dataset Export**: Export anomaly results to DynamoDB or local storage with configurable TTL support
|
|
16
|
+
- **File Storage**: Save plots and data locally or to S3 with the new `to_store` utility
|
|
17
|
+
- **Interactive Documentation**: Jupyter notebook support in documentation via `mkdocs-jupyter`, with comprehensive tutorials and API reference sections
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- Enhanced plotting with modular `plot_ohlcv_anomalies` function for reusability
|
|
21
|
+
- Improved error handling for edge cases in anomaly collection
|
|
22
|
+
|
|
23
|
+
### Dependencies
|
|
24
|
+
- Added `scikit-learn` and `sf-hamilton[visualization]` for ML and DAG execution
|
|
25
|
+
- Added `mplfinance`, `matplotlib`, and visualization support packages
|
|
26
|
+
- Added `mkdocs-jupyter` for interactive documentation
|
|
27
|
+
|
|
28
|
+
## [0.1.4] - 2026-01-18
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
- **AWS Integration**: Comprehensive utilities for SSM parameters, Secrets Manager, S3, and DynamoDB operations
|
|
32
|
+
- **Dataset Management**: Store and retrieve structured datasets locally or in DynamoDB with flexible mapping and serialization
|
|
33
|
+
- Enhanced ArcticDB setup with shared AWS session for S3 backend
|
|
34
|
+
|
|
35
|
+
### Documentation
|
|
36
|
+
- New documentation modules: `aws.md` for AWS utilities and `dataset.md` for dataset handling
|
|
37
|
+
- Expanded `sources.md` and `storage.md` with dataset examples
|
|
38
|
+
|
|
39
|
+
## [0.1.3] - 2026-01-18
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
- `to_dataset` function for saving structured datasets with DynamoDB or local storage support
|
|
43
|
+
|
|
44
|
+
## [0.1.2] - 2026-01-17
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
- **Automated Documentation**: GitHub Actions workflow for deploying documentation on version tags
|
|
48
|
+
- MkDocs site with Material theme
|
|
49
|
+
- Comprehensive docstrings and usage examples for core modules
|
|
50
|
+
|
|
51
|
+
## [0.1.1] - 2026-01-17
|
|
52
|
+
|
|
53
|
+
### Changed
|
|
54
|
+
- Updated Python requirement to `>= 3.12` with improved cross-platform support
|
|
55
|
+
|
|
56
|
+
## [0.1.0] - 2026-01-17
|
|
57
|
+
|
|
58
|
+
### Added
|
|
59
|
+
- **Core Data Access**: Functions for reading and writing OHLCV data to ArcticDB (`ohlcv_from_arcticdb`, `ohlcv_to_arcticdb`)
|
|
60
|
+
- **Multi-Source Support**: Fetch data from Intrinio (`ohlcv_from_intrinio`) and Yahoo Finance (`ohlcv_from_yfinance`)
|
|
61
|
+
- **Securities Discovery**: Retrieve securities lists from Intrinio via `securities_from_intrinio`
|
|
62
|
+
- **Flexible Storage**: Support for local and S3-backed ArcticDB instances
|
|
63
|
+
- **Auto-Configuration**: Automatic `.env` file generation on first import
|
|
64
|
+
- GitHub Actions workflow for PyPI publishing
|
|
65
|
+
|
|
66
|
+
### Documentation
|
|
67
|
+
- Complete README with installation, configuration, and usage examples
|
|
68
|
+
|
|
69
|
+
## [0.0.1] - 2026-01-14
|
|
70
|
+
|
|
71
|
+
### Added
|
|
72
|
+
- Initial project structure with Intrinio SDK integration
|
|
73
|
+
- ArcticDB for time-series data storage
|
|
74
|
+
- MCP server implementation
|
|
75
|
+
- Docker support and environment configuration
|
|
76
|
+
|
|
77
|
+
[Unreleased]: https://github.com/vitaliknet/chronos-lab/compare/v0.1.5...HEAD
|
|
78
|
+
[0.1.5]: https://github.com/vitaliknet/chronos-lab/compare/v0.1.4...v0.1.5
|
|
79
|
+
[0.1.4]: https://github.com/vitaliknet/chronos-lab/compare/v0.1.3...v0.1.4
|
|
80
|
+
[0.1.3]: https://github.com/vitaliknet/chronos-lab/compare/v0.1.2...v0.1.3
|
|
81
|
+
[0.1.2]: https://github.com/vitaliknet/chronos-lab/compare/v0.1.1...v0.1.2
|
|
82
|
+
[0.1.1]: https://github.com/vitaliknet/chronos-lab/compare/v0.1.0...v0.1.1
|
|
83
|
+
[0.1.0]: https://github.com/vitaliknet/chronos-lab/compare/v0.0.1...v0.1.0
|
|
84
|
+
[0.0.1]: https://github.com/vitaliknet/chronos-lab/releases/tag/v0.0.1
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 vitaliknet
|
|
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,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chronos-lab
|
|
3
|
+
Version: 0.1.6
|
|
4
|
+
Summary: Time series research laboratory
|
|
5
|
+
Project-URL: Homepage, https://chronos-lab.vitalik.net/
|
|
6
|
+
Project-URL: Repository, https://github.com/vitaliknet/chronos-lab
|
|
7
|
+
Project-URL: Changelog, https://github.com/vitaliknet/chronos-lab/blob/main/CHANGELOG.md
|
|
8
|
+
Author-email: Vitaly Kuznetsov <chronos-lab@vitalik.net>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Office/Business :: Financial :: Investment
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Information Analysis
|
|
17
|
+
Requires-Python: >=3.12
|
|
18
|
+
Requires-Dist: numpy>=2.0.2
|
|
19
|
+
Requires-Dist: pandas>=2.0.2
|
|
20
|
+
Requires-Dist: pydantic-settings>=2.0.2
|
|
21
|
+
Provides-Extra: analysis
|
|
22
|
+
Requires-Dist: scikit-learn>=1.3.0; extra == 'analysis'
|
|
23
|
+
Requires-Dist: sf-hamilton[visualization]>=1.50.0; extra == 'analysis'
|
|
24
|
+
Provides-Extra: arcticdb
|
|
25
|
+
Requires-Dist: arcticdb; extra == 'arcticdb'
|
|
26
|
+
Provides-Extra: aws
|
|
27
|
+
Requires-Dist: boto3>=1.42.30; extra == 'aws'
|
|
28
|
+
Requires-Dist: botocore>=1.42.30; extra == 'aws'
|
|
29
|
+
Provides-Extra: docs
|
|
30
|
+
Requires-Dist: mkdocs-jupyter; extra == 'docs'
|
|
31
|
+
Requires-Dist: mkdocs-material>=9.7.1; extra == 'docs'
|
|
32
|
+
Requires-Dist: mkdocs>=1.6.1; extra == 'docs'
|
|
33
|
+
Requires-Dist: mkdocstrings[python]>=1.0.0; extra == 'docs'
|
|
34
|
+
Provides-Extra: intrinio
|
|
35
|
+
Requires-Dist: intrinio-sdk>=6.39.0; extra == 'intrinio'
|
|
36
|
+
Provides-Extra: mcp
|
|
37
|
+
Requires-Dist: fastmcp>=2.14.2; extra == 'mcp'
|
|
38
|
+
Provides-Extra: visualization
|
|
39
|
+
Requires-Dist: matplotlib>=3.10.8; extra == 'visualization'
|
|
40
|
+
Requires-Dist: mplfinance>=0.12.10b0; extra == 'visualization'
|
|
41
|
+
Provides-Extra: yfinance
|
|
42
|
+
Requires-Dist: yfinance>=1.0; extra == 'yfinance'
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
|
|
45
|
+
# Welcome to Chronos Lab
|
|
46
|
+
|
|
47
|
+
chronos-lab is a batteries-included framework for financial time series analysis that turns best-in-class open-source
|
|
48
|
+
tools into a single, coherent workflow.
|
|
49
|
+
|
|
50
|
+
It combines ArcticDB for time-series storage, Hamilton DAGs for transparent pipelines, scikit-learn for modeling, and
|
|
51
|
+
matplotlib for publication-quality visualization—so you can ingest data, analyze thousands of symbols in parallel, and
|
|
52
|
+
turn results into clear, inspectable insights with minimal glue code.
|
|
53
|
+
|
|
54
|
+
Prototype interactively in Jupyter notebooks. Scale unchanged pipelines to production with AWS S3 and DynamoDB.
|
|
55
|
+
|
|
56
|
+
The goal isn’t novelty—it’s leverage. chronos-lab makes the tools you already trust work together, cleanly and
|
|
57
|
+
predictably.
|
|
58
|
+
|
|
59
|
+
## Quick Links
|
|
60
|
+
|
|
61
|
+
- **[Getting Started Guide](https://vitaliknet.github.io/chronos-lab/getting-started/)** - Installation, running
|
|
62
|
+
workflows, common patterns
|
|
63
|
+
- **[Configuration](https://vitaliknet.github.io/chronos-lab/configuration/)** - Configure API keys, storage backends,
|
|
64
|
+
and environment settings
|
|
65
|
+
- **[API Reference](https://vitaliknet.github.io/chronos-lab/api/)** - Complete documentation for all functions and
|
|
66
|
+
classes
|
|
67
|
+
- **[Tutorials](https://vitaliknet.github.io/chronos-lab/tutorials/)** - Interactive Jupyter notebooks with
|
|
68
|
+
visualizations and step-by-step guides
|
|
69
|
+
- **[Changelog](https://vitaliknet.github.io/chronos-lab/changelog/)** - User-visible features and breaking changes by release
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
## Key Features
|
|
73
|
+
|
|
74
|
+
**Unified Market Data Access** : Pull OHLCV time series from Yahoo Finance, Intrinio, or ArcticDB through a single,
|
|
75
|
+
consistent interface — analysis-ready, UTC-normalized, and pandas-native from day one.
|
|
76
|
+
|
|
77
|
+
**Research-Grade Time Series Storage** : Store and retrieve large, versioned time series with ArcticDB, optimized for
|
|
78
|
+
long histories, cross-sectional analysis, and rapid iteration across large universes.
|
|
79
|
+
|
|
80
|
+
**Pre-Built, Reusable Analysis DAGs** : Ready-to-use Hamilton DAGs cover common research workflows from ingestion to
|
|
81
|
+
features, signals, and diagnostics. Use them as-is, adapt them to your research, or treat them as composable building
|
|
82
|
+
blocks for new ideas.
|
|
83
|
+
|
|
84
|
+
**Reproducible Research Pipelines** : DAG-based execution makes dependencies explicit and results rerunnable — so
|
|
85
|
+
experiments are explainable, comparable, and easy to extend over time.
|
|
86
|
+
|
|
87
|
+
**Parallel Multi-Symbol Analysis** : Apply the same research logic across thousands of symbols efficiently, without
|
|
88
|
+
hand-rolled batching or orchestration code.
|
|
89
|
+
|
|
90
|
+
**Structured Datasets & Metadata** : Manage universes, watchlists, security metadata, and intermediate results as
|
|
91
|
+
explicit datasets (local files or DynamoDB), keeping research inputs auditable and organized.
|
|
92
|
+
|
|
93
|
+
**First-Class Visualization** : Integrated matplotlib plotting for transparent, research-grade diagnostics — inspect
|
|
94
|
+
signals, anomalies, and distributions directly in notebooks.
|
|
95
|
+
|
|
96
|
+
**Notebook-to-Workflow Integration** : Run chronos-lab DAGs interactively in Jupyter, or embed them into larger
|
|
97
|
+
workflows — from scheduled pipelines in Airflow to event-driven architectures on AWS.
|
|
98
|
+
|
|
99
|
+
**Opinionated, Modular Ecosystem** : Install only what you need via optional extras (yfinance, intrinio, arcticdb, aws).
|
|
100
|
+
No reinvention — just tools designed to work together.
|
|
101
|
+
|
|
102
|
+
## License
|
|
103
|
+
|
|
104
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Welcome to Chronos Lab
|
|
2
|
+
|
|
3
|
+
chronos-lab is a batteries-included framework for financial time series analysis that turns best-in-class open-source
|
|
4
|
+
tools into a single, coherent workflow.
|
|
5
|
+
|
|
6
|
+
It combines ArcticDB for time-series storage, Hamilton DAGs for transparent pipelines, scikit-learn for modeling, and
|
|
7
|
+
matplotlib for publication-quality visualization—so you can ingest data, analyze thousands of symbols in parallel, and
|
|
8
|
+
turn results into clear, inspectable insights with minimal glue code.
|
|
9
|
+
|
|
10
|
+
Prototype interactively in Jupyter notebooks. Scale unchanged pipelines to production with AWS S3 and DynamoDB.
|
|
11
|
+
|
|
12
|
+
The goal isn’t novelty—it’s leverage. chronos-lab makes the tools you already trust work together, cleanly and
|
|
13
|
+
predictably.
|
|
14
|
+
|
|
15
|
+
## Quick Links
|
|
16
|
+
|
|
17
|
+
- **[Getting Started Guide](https://vitaliknet.github.io/chronos-lab/getting-started/)** - Installation, running
|
|
18
|
+
workflows, common patterns
|
|
19
|
+
- **[Configuration](https://vitaliknet.github.io/chronos-lab/configuration/)** - Configure API keys, storage backends,
|
|
20
|
+
and environment settings
|
|
21
|
+
- **[API Reference](https://vitaliknet.github.io/chronos-lab/api/)** - Complete documentation for all functions and
|
|
22
|
+
classes
|
|
23
|
+
- **[Tutorials](https://vitaliknet.github.io/chronos-lab/tutorials/)** - Interactive Jupyter notebooks with
|
|
24
|
+
visualizations and step-by-step guides
|
|
25
|
+
- **[Changelog](https://vitaliknet.github.io/chronos-lab/changelog/)** - User-visible features and breaking changes by release
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
## Key Features
|
|
29
|
+
|
|
30
|
+
**Unified Market Data Access** : Pull OHLCV time series from Yahoo Finance, Intrinio, or ArcticDB through a single,
|
|
31
|
+
consistent interface — analysis-ready, UTC-normalized, and pandas-native from day one.
|
|
32
|
+
|
|
33
|
+
**Research-Grade Time Series Storage** : Store and retrieve large, versioned time series with ArcticDB, optimized for
|
|
34
|
+
long histories, cross-sectional analysis, and rapid iteration across large universes.
|
|
35
|
+
|
|
36
|
+
**Pre-Built, Reusable Analysis DAGs** : Ready-to-use Hamilton DAGs cover common research workflows from ingestion to
|
|
37
|
+
features, signals, and diagnostics. Use them as-is, adapt them to your research, or treat them as composable building
|
|
38
|
+
blocks for new ideas.
|
|
39
|
+
|
|
40
|
+
**Reproducible Research Pipelines** : DAG-based execution makes dependencies explicit and results rerunnable — so
|
|
41
|
+
experiments are explainable, comparable, and easy to extend over time.
|
|
42
|
+
|
|
43
|
+
**Parallel Multi-Symbol Analysis** : Apply the same research logic across thousands of symbols efficiently, without
|
|
44
|
+
hand-rolled batching or orchestration code.
|
|
45
|
+
|
|
46
|
+
**Structured Datasets & Metadata** : Manage universes, watchlists, security metadata, and intermediate results as
|
|
47
|
+
explicit datasets (local files or DynamoDB), keeping research inputs auditable and organized.
|
|
48
|
+
|
|
49
|
+
**First-Class Visualization** : Integrated matplotlib plotting for transparent, research-grade diagnostics — inspect
|
|
50
|
+
signals, anomalies, and distributions directly in notebooks.
|
|
51
|
+
|
|
52
|
+
**Notebook-to-Workflow Integration** : Run chronos-lab DAGs interactively in Jupyter, or embed them into larger
|
|
53
|
+
workflows — from scheduled pipelines in Airflow to event-driven architectures on AWS.
|
|
54
|
+
|
|
55
|
+
**Opinionated, Modular Ecosystem** : Install only what you need via optional extras (yfinance, intrinio, arcticdb, aws).
|
|
56
|
+
No reinvention — just tools designed to work together.
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"AAPL": {"weight": 0.02},
|
|
3
|
+
"MSFT": {"weight": 0.02},
|
|
4
|
+
"AMZN": {"weight": 0.02},
|
|
5
|
+
"GOOGL": {"weight": 0.02},
|
|
6
|
+
"META": {"weight": 0.02},
|
|
7
|
+
"NVDA": {"weight": 0.02},
|
|
8
|
+
"BRK.B": {"weight": 0.02},
|
|
9
|
+
"JPM": {"weight": 0.02},
|
|
10
|
+
"JNJ": {"weight": 0.02},
|
|
11
|
+
"V": {"weight": 0.02},
|
|
12
|
+
"PG": {"weight": 0.02},
|
|
13
|
+
"XOM": {"weight": 0.02},
|
|
14
|
+
"UNH": {"weight": 0.02},
|
|
15
|
+
"MA": {"weight": 0.02},
|
|
16
|
+
"HD": {"weight": 0.02},
|
|
17
|
+
"LLY": {"weight": 0.02},
|
|
18
|
+
"ABBV": {"weight": 0.02},
|
|
19
|
+
"PFE": {"weight": 0.02},
|
|
20
|
+
"AVGO": {"weight": 0.02},
|
|
21
|
+
"COST": {"weight": 0.02},
|
|
22
|
+
"PEP": {"weight": 0.02},
|
|
23
|
+
"KO": {"weight": 0.02},
|
|
24
|
+
"MRK": {"weight": 0.02},
|
|
25
|
+
"TMO": {"weight": 0.02},
|
|
26
|
+
"CSCO": {"weight": 0.02},
|
|
27
|
+
"ACN": {"weight": 0.02},
|
|
28
|
+
"WMT": {"weight": 0.02},
|
|
29
|
+
"CRM": {"weight": 0.02},
|
|
30
|
+
"INTC": {"weight": 0.02},
|
|
31
|
+
"ADBE": {"weight": 0.02},
|
|
32
|
+
"AMD": {"weight": 0.02},
|
|
33
|
+
"QCOM": {"weight": 0.02},
|
|
34
|
+
"TXN": {"weight": 0.02},
|
|
35
|
+
"LIN": {"weight": 0.02},
|
|
36
|
+
"NEE": {"weight": 0.02},
|
|
37
|
+
"PM": {"weight": 0.02},
|
|
38
|
+
"ORCL": {"weight": 0.02},
|
|
39
|
+
"AMGN": {"weight": 0.02},
|
|
40
|
+
"HON": {"weight": 0.02},
|
|
41
|
+
"LOW": {"weight": 0.02},
|
|
42
|
+
"IBM": {"weight": 0.02},
|
|
43
|
+
"SBUX": {"weight": 0.02},
|
|
44
|
+
"GE": {"weight": 0.02},
|
|
45
|
+
"CAT": {"weight": 0.02},
|
|
46
|
+
"INTU": {"weight": 0.02},
|
|
47
|
+
"SPGI": {"weight": 0.02},
|
|
48
|
+
"NOW": {"weight": 0.02},
|
|
49
|
+
"MDT": {"weight": 0.02},
|
|
50
|
+
"GS": {"weight": 0.02},
|
|
51
|
+
"NFLX": {"weight": 0.02}
|
|
52
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Intrinio API Settings
|
|
2
|
+
#INTRINIO_API_KEY=
|
|
3
|
+
|
|
4
|
+
# Datatset Settings
|
|
5
|
+
DATASET_LOCAL_PATH=~/.chronos_lab/datasets
|
|
6
|
+
#DATASET_DDB_TABLE_NAME=
|
|
7
|
+
#DATASET_DDB_MAP='{
|
|
8
|
+
# "ddb_watchlist": {
|
|
9
|
+
# "pk": "map#ibpm#watchlist",
|
|
10
|
+
# "sk": "name"
|
|
11
|
+
# },
|
|
12
|
+
# "ddb_securities_intrinio": {
|
|
13
|
+
# "pk": "map#intrinio#securities"
|
|
14
|
+
# },
|
|
15
|
+
# "ddb_ohlcv_anomalies": {
|
|
16
|
+
# "pk": "chronos_lab#ohlcv_anomalies"
|
|
17
|
+
# }
|
|
18
|
+
#}'
|
|
19
|
+
|
|
20
|
+
# Store Settings
|
|
21
|
+
STORE_LOCAL_PATH=~/.chronos_lab/store
|
|
22
|
+
#STORE_S3_BUCKET=
|
|
23
|
+
|
|
24
|
+
# ArcticDB Settings
|
|
25
|
+
ARCTICDB_LOCAL_PATH=~/.chronos_lab/arcticdb
|
|
26
|
+
ARCTICDB_DEFAULT_LIBRARY_NAME=uscomp
|
|
27
|
+
#ARCTICDB_S3_BUCKET=
|
|
28
|
+
|
|
29
|
+
# Logging
|
|
30
|
+
#LOG_LEVEL=DEBUG
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""chronos-lab: A lightweight Python library for time series financial data analysis.
|
|
2
|
+
|
|
3
|
+
This package provides modular tools for fetching, storing, and analyzing financial
|
|
4
|
+
time series data with support for multiple data sources and high-performance storage.
|
|
5
|
+
|
|
6
|
+
Key Features:
|
|
7
|
+
- Data Sources: Yahoo Finance (yfinance) and Intrinio API integration
|
|
8
|
+
- Storage: High-performance ArcticDB time series database with versioning
|
|
9
|
+
- MCP Server: Model Context Protocol server capabilities
|
|
10
|
+
- Modular Design: Install only the features you need via optional extras
|
|
11
|
+
|
|
12
|
+
Installation:
|
|
13
|
+
Core package (minimal dependencies):
|
|
14
|
+
pip install chronos-lab
|
|
15
|
+
|
|
16
|
+
With optional features:
|
|
17
|
+
pip install chronos-lab[yfinance] # Yahoo Finance integration
|
|
18
|
+
pip install chronos-lab[intrinio] # Intrinio API integration
|
|
19
|
+
pip install chronos-lab[arcticdb] # ArcticDB storage backend
|
|
20
|
+
pip install chronos-lab[mcp] # MCP server capabilities
|
|
21
|
+
|
|
22
|
+
Configuration:
|
|
23
|
+
On first import, chronos-lab automatically creates ~/.chronos_lab/.env with
|
|
24
|
+
default settings. Edit this file to configure API keys, storage paths, and
|
|
25
|
+
logging levels.
|
|
26
|
+
|
|
27
|
+
Quick Start:
|
|
28
|
+
>>> from chronos_lab.sources import ohlcv_from_yfinance
|
|
29
|
+
>>> from chronos_lab.storage import ohlcv_to_arcticdb
|
|
30
|
+
>>>
|
|
31
|
+
>>> # Fetch data
|
|
32
|
+
>>> prices = ohlcv_from_yfinance(symbols=['AAPL', 'MSFT'], period='1y')
|
|
33
|
+
>>>
|
|
34
|
+
>>> # Store for later use
|
|
35
|
+
>>> ohlcv_to_arcticdb(ohlcv=prices, library_name='yfinance')
|
|
36
|
+
|
|
37
|
+
Modules:
|
|
38
|
+
sources: Data fetching from Yahoo Finance, Intrinio, and ArcticDB
|
|
39
|
+
storage: Persistent storage operations using ArcticDB
|
|
40
|
+
settings: Configuration management via Pydantic Settings
|
|
41
|
+
arcdb: Low-level ArcticDB wrapper class
|
|
42
|
+
intrinio: Low-level Intrinio API wrapper
|
|
43
|
+
mcp_server: FastMCP server for Model Context Protocol
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
from pathlib import Path
|
|
47
|
+
import shutil
|
|
48
|
+
import sys
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _init_config():
|
|
52
|
+
try:
|
|
53
|
+
config_dir = Path.home() / ".chronos_lab"
|
|
54
|
+
env_file = config_dir / ".env"
|
|
55
|
+
|
|
56
|
+
if not env_file.exists():
|
|
57
|
+
config_dir.mkdir(parents=True, exist_ok=True)
|
|
58
|
+
|
|
59
|
+
package_dir = Path(__file__).parent
|
|
60
|
+
env_example = package_dir / ".env.example"
|
|
61
|
+
|
|
62
|
+
if env_example.exists():
|
|
63
|
+
shutil.copy(env_example, env_file)
|
|
64
|
+
print(f"✓ Chronos Lab: Created config at {env_file}", file=sys.stderr)
|
|
65
|
+
|
|
66
|
+
except Exception as e:
|
|
67
|
+
print(f"Warning: Could not initialize Chronos Lab config: {e}", file=sys.stderr)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
_init_config()
|
|
71
|
+
|
|
72
|
+
del _init_config
|
|
73
|
+
|
|
74
|
+
import logging
|
|
75
|
+
from chronos_lab.settings import get_settings
|
|
76
|
+
|
|
77
|
+
settings = get_settings()
|
|
78
|
+
|
|
79
|
+
log_level = getattr(logging, settings.log_level.upper(), logging.INFO)
|
|
80
|
+
|
|
81
|
+
logging.basicConfig(level=log_level,
|
|
82
|
+
format='%(asctime)s | %(name)s | %(funcName)s | %(levelname)s:%(message)s')
|
|
83
|
+
logger = logging.getLogger()
|
|
84
|
+
logger.setLevel(log_level)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""Internal utility functions for chronos-lab.
|
|
2
|
+
|
|
3
|
+
This module provides private helper functions used internally across the library.
|
|
4
|
+
These functions are not part of the public API and may change without notice.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from typing import Optional
|
|
8
|
+
import pandas as pd
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _period(period: str, as_of: Optional[pd.Timestamp] = None) -> tuple[pd.Timestamp, pd.Timestamp]:
|
|
12
|
+
"""Convert period string to date range tuple.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
period: Period string (e.g., '7d', '4w', '3mo', '1y')
|
|
16
|
+
as_of: Reference timestamp (defaults to current UTC time)
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
Tuple of (start_datetime, end_datetime)
|
|
20
|
+
|
|
21
|
+
Raises:
|
|
22
|
+
ValueError: If period unit is invalid
|
|
23
|
+
"""
|
|
24
|
+
end_dt = as_of if as_of is not None else pd.Timestamp.now(tz='UTC')
|
|
25
|
+
|
|
26
|
+
value = int(period[:-1]) if period[-1].isalpha() else int(period[:-2])
|
|
27
|
+
unit = period[-1] if period[-1].isalpha() else period[-2:]
|
|
28
|
+
|
|
29
|
+
offset_map = {
|
|
30
|
+
'd': pd.DateOffset(days=value),
|
|
31
|
+
'w': pd.DateOffset(weeks=value),
|
|
32
|
+
'mo': pd.DateOffset(months=value),
|
|
33
|
+
'm': pd.DateOffset(months=value),
|
|
34
|
+
'y': pd.DateOffset(years=value)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if unit not in offset_map:
|
|
38
|
+
raise ValueError(f"Invalid period unit: {unit}. Use 'd', 'w', 'mo'/'m', or 'y'")
|
|
39
|
+
|
|
40
|
+
start_dt = end_dt - offset_map[unit]
|
|
41
|
+
return (start_dt, end_dt)
|