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.1.tar.gz (99.9 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.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chronos_lab-0.1.1.tar.gz
  • Upload date:
  • Size: 99.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for chronos_lab-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6baafaf89324699023f5175ba017e5917c821a6f48d68d5f511d220e95af4b63
MD5 6ecbf5784c486a4e8e45d85c5ee4b473
BLAKE2b-256 d0bd18e0b5b1504e8e112997a7cc28549f6d4c9dc1d9fb18f322115bc1fa0afd

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for chronos_lab-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 782e3209ee7c44af7c1e3b916c852422de0feb5d425f49db2b8374f327bf498d
MD5 6a126692b4b4fb72e302c8281e1e7b3c
BLAKE2b-256 e99a776fcba036f90b1ad65b3e66afdad3a75f4945f8fb950475edf22aa8f259

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