Skip to main content

Time series research laboratory

Project description

chronos-lab

A lightweight Python library for time series analysis with a modular architecture. Install only what you need—from minimal data fetching to full-featured storage and MCP server capabilities.

Installation

chronos-lab requires Python 3.13+ and runs on macOS and Linux.

Core Installation

Install the minimal package with just NumPy, pandas, and Pydantic:

uv pip install chronos-lab

or with pip:

pip install chronos-lab

Installation with Extras

chronos-lab follows a modular design—install additional features as needed:

Data Sources

# Yahoo Finance for quick market data analysis
uv pip install chronos-lab[yfinance]

# Intrinio for professional financial data
uv pip install chronos-lab[intrinio]

Storage & Infrastructure

# ArcticDB for high-performance time series storage
uv pip install chronos-lab[arcticdb]

# MCP server capabilities
uv pip install chronos-lab[mcp]

Combined Installations

# Simple use case: yfinance for on-the-fly analysis
uv pip install chronos-lab[yfinance]

# Advanced use case: MCP server with ArcticDB and S3
uv pip install chronos-lab[mcp,arcticdb]

# All features
uv pip install chronos-lab[yfinance,intrinio,arcticdb,mcp]

Development Installation

git clone https://github.com/yourusername/chronos-lab.git
cd chronos-lab

# Install with all extras
uv sync --all-extras

# Or install with specific extras only
uv sync --extra yfinance --extra mcp

Configuration

On first import of chronos-lab (e.g., import chronos_lab or from chronos_lab.sources import ...), the package automatically creates ~/.chronos_lab/.env with default settings. This file can be edited to configure API keys, storage paths, and other options:

# View or edit configuration
nano ~/.chronos_lab/.env

The configuration file includes settings for data sources (Intrinio API), storage backends (ArcticDB local/S3), and logging levels. All settings can also be overridden via environment variables.

Quick Start

Fetching Market Data

Yahoo Finance: OHLCV Time Series

Get daily price data for multiple symbols with minimal setup:

from chronos_lab.sources import ohlcv_from_yfinance

# Download last year of daily data
prices = ohlcv_from_yfinance(
    symbols=['AAPL', 'MSFT', 'GOOGL'],
    period='1y'
)

# Or specify exact dates
prices = ohlcv_from_yfinance(
    symbols=['AAPL', 'MSFT'],
    start_date='2024-01-01',
    end_date='2024-12-31',
    interval='1d'
)

Returns a MultiIndex DataFrame with (date, symbol) levels for easy multi-symbol analysis.

Intraday Data

Fetch high-frequency data for algorithmic trading or analysis:

# Get 5-minute bars for today
intraday = ohlcv_from_yfinance(
    symbols=['SPY', 'QQQ'],
    period='1d',
    interval='5m'
)

Working with Individual Symbols

Get separate DataFrames per symbol for focused analysis:

# Returns dict: {'AAPL': DataFrame, 'MSFT': DataFrame}
prices_dict = ohlcv_from_yfinance(
    symbols=['AAPL', 'MSFT'],
    period='6mo',
    output_dict=True
)

aapl_prices = prices_dict['AAPL']

Intrinio

Access institutional-quality financial data:

from chronos_lab.sources import ohlcv_from_intrinio

# Daily data (requires Intrinio API key)
prices = ohlcv_from_intrinio(
    symbols=['AAPL', 'MSFT'],
    start_date='2024-01-01',
    interval='daily',
    api_key='your_api_key'  # or set in ~/.chronos_lab/.env
)

# Intraday bars
intraday = ohlcv_from_intrinio(
    symbols=['SPY'],
    start_date='2024-01-15',
    end_date='2024-01-16',
    interval='5m'
)

Persistent Storage with ArcticDB

Store and version your time series data efficiently:

from chronos_lab.sources import ohlcv_from_yfinance
from chronos_lab.storage import ohlcv_to_arcticdb

# Fetch and store in one workflow
prices = ohlcv_from_yfinance(
    symbols=['AAPL', 'MSFT', 'GOOGL'],
    period='1y'
)

ohlcv_to_arcticdb(
    ohlcv=prices,
    library_name='yfinance',
    adb_mode='write'
)

Works with both MultiIndex DataFrames and symbol dictionaries. If library_name is not specified, the default library name is used from the configuration file.

Reading from ArcticDB

Retrieve stored time series with flexible date filtering and formatting:

from chronos_lab.sources import ohlcv_from_arcticdb

# Get last 3 months of data
prices = ohlcv_from_arcticdb(
    symbols=['AAPL', 'MSFT', 'GOOGL'],
    period='3m',
    library_name='yfinance'
)

# Or specify exact date range
prices = ohlcv_from_arcticdb(
    symbols=['AAPL', 'MSFT'],
    start_date='2026-01-01',
    end_date='2026-01-15',
    library_name='yfinance'
)

Wide Format for Analysis

Transform to wide format for correlation analysis or charting:

# Pivot to wide format: one column per symbol
wide_prices = ohlcv_from_arcticdb(
    symbols=['AAPL', 'MSFT', 'GOOGL', 'AMZN'],
    period='1y',
    columns=['close'],
    library_name='yfinance',
    pivot=True,
    group_by='column'  # Results in: close_AAPL, close_MSFT, etc.
)

# Calculate returns matrix
returns = wide_prices.pct_change()
correlation_matrix = returns.corr()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chronos_lab-0.1.0.tar.gz (86.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chronos_lab-0.1.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file chronos_lab-0.1.0.tar.gz.

File metadata

  • Download URL: chronos_lab-0.1.0.tar.gz
  • Upload date:
  • Size: 86.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for chronos_lab-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b021091c1ea10d8bb78daa726abe5f4ed252073cf4c6767f42c6f76774a8fe6b
MD5 a68a4b76ecd9d0d5bfb3dcde36c7e9fd
BLAKE2b-256 db55aa754a79666073ebe3b757268b2dad5228d4a3a73198df2ca0b6b69bc893

See more details on using hashes here.

File details

Details for the file chronos_lab-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chronos_lab-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.14 {"installer":{"name":"uv","version":"0.9.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for chronos_lab-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 97f5408c82d5e9eef876e7d4c40c2d6349b1842305601d02add1c5672fa9da1f
MD5 b248f74b2edd365488ebf873011b2cf2
BLAKE2b-256 2d259ad72d16ca269f22f8774b79f895457ff0ae21e68e9f723f465caebc9c00

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page