or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

arctic-connection.mdasync-operations.mdbson-store.mdchunk-store.mddate-utilities.mdindex.mdtick-store.mdversion-store.md
tile.json

tessl/pypi-arctic

AHL Research Versioned TimeSeries and Tick store for high-performance financial data storage and analysis

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/arctic@1.82.x

To install, run

npx @tessl/cli install tessl/pypi-arctic@1.82.0

index.mddocs/

Arctic

A high-performance versioned TimeSeries and tick database designed for financial data storage and analysis. Arctic provides multiple storage engines including VersionStore for versioned key-value TimeSeries data with pandas support, TickStore for column-oriented tick data, and ChunkStore for customizable chunk-based storage.

Package Information

  • Package Name: arctic
  • Language: Python
  • Installation: pip install arctic

Core Imports

import arctic

Common usage pattern:

from arctic import Arctic, VERSION_STORE, TICK_STORE, CHUNK_STORE

Basic Usage

from arctic import Arctic, VERSION_STORE
import pandas as pd
import numpy as np

# Connect to Arctic
arctic_conn = Arctic('mongodb://localhost:27017')

# Initialize a library
arctic_conn.initialize_library('my_data', VERSION_STORE)

# Get library
library = arctic_conn['my_data']

# Create sample data
data = pd.DataFrame({
    'price': np.random.randn(1000),
    'volume': np.random.randint(100, 1000, 1000)
}, index=pd.date_range('2020-01-01', periods=1000, freq='min'))

# Write data
library.write('AAPL', data)

# Read data back
retrieved_data = library.read('AAPL')
print(retrieved_data.data.head())

Architecture

Arctic uses a multi-layered architecture optimized for financial time series data:

  • Arctic: Top-level connection manager handling MongoDB connections, authentication, and library dispatch
  • ArcticLibraryBinding: Library-specific interface providing quota management, metadata operations, and store access
  • Storage Engines: Specialized backends for different data types and use cases
    • VersionStore: Versioned storage for pandas DataFrames/Series with temporal snapshots
    • TickStore: High-frequency tick data with efficient columnar storage and date partitioning
    • ChunkStore: Configurable chunking for large datasets with custom serialization
    • BSONStore: Raw MongoDB document storage with full PyMongo interface
    • MetadataStore: Time-series metadata storage with historical tracking

Capabilities

Arctic Connection Management

Core functionality for connecting to MongoDB, managing libraries, and handling authentication. Provides the main entry point for all Arctic operations including library lifecycle management and quota control.

class Arctic:
    def __init__(self, mongo_host, app_name='arctic', allow_secondary=False, 
                 socketTimeoutMS=600000, connectTimeoutMS=2000, 
                 serverSelectionTimeoutMS=30000, **kwargs): ...
    def list_libraries(self, newer_than_secs=None): ...
    def initialize_library(self, library, lib_type=VERSION_STORE, **kwargs): ...
    def get_library(self, library): ...
    def delete_library(self, library): ...

def register_library_type(name, type_): ...

Arctic Connection

Version Store Operations

Versioned storage for pandas DataFrames and Series with complete audit trails, point-in-time snapshots, and efficient data retrieval. Supports temporal data access, metadata management, and multi-version data handling.

class VersionStore:
    def read(self, symbol, as_of=None, date_range=None, from_version=None, **kwargs): ...
    def write(self, symbol, data, metadata=None, prune_previous_version=True, **kwargs): ...
    def append(self, symbol, data, metadata=None, prune_previous_version=True, **kwargs): ...
    def list_versions(self, symbol=None, snapshot=None, latest_only=False): ...
    def snapshot(self, snap_name, metadata=None, skip_symbols=None, versions=None): ...

Version Store

Tick Store Operations

High-frequency tick data storage with efficient columnar compression and time-based partitioning. Optimized for financial tick data with support for initial images, metadata persistence, and date range queries.

class TickStore:
    def __init__(self, arctic_lib, chunk_size=100000): ...
    def read(self, symbol, date_range=None, columns=None, include_images=False, **kwargs): ...
    def write(self, symbol, data, initial_image=None, metadata=None): ...
    def max_date(self, symbol): ...
    def min_date(self, symbol): ...

Tick Store

Chunk Store Operations

Configurable chunked storage for large datasets with custom serialization strategies and date-based chunking. Supports append/update operations, audit trails, and flexible data organization patterns.

class ChunkStore:
    def read(self, symbol, chunk_range=None, filter_data=True, **kwargs): ...
    def write(self, symbol, item, metadata=None, chunker=DateChunker(), **kwargs): ...
    def append(self, symbol, item, upsert=False, metadata=None, **kwargs): ...
    def update(self, symbol, item, chunk_range=None, upsert=False, **kwargs): ...
    def get_chunk_ranges(self, symbol, chunk_range=None, reverse=False): ...

Chunk Store

BSON Store Operations

Raw MongoDB document storage providing full PyMongo interface for direct database operations. Enables custom document structures, aggregation pipelines, and advanced MongoDB features within Arctic's framework.

class BSONStore:
    def find(self, *args, **kwargs): ...
    def insert_one(self, document, **kwargs): ...
    def update_one(self, filter, update, **kwargs): ...
    def aggregate(self, pipeline, **kwargs): ...
    def create_index(self, keys, **kwargs): ...

BSON Store

Date and Time Utilities

Comprehensive date/time handling for financial data including timezone management, date range operations, and time series utilities. Provides robust datetime conversion and time-based data filtering capabilities.

class DateRange:
    def __init__(self, start, end, step=None): ...

def mktz(timezone): ...
def datetime_to_ms(dt): ...
def ms_to_datetime(ms): ...
def to_pandas_closed_closed(date_range): ...

Date Utilities

Asynchronous Operations

Asynchronous execution framework for Arctic operations enabling concurrent data processing and improved performance for batch operations. Provides thread pool management and request tracking.

def async_arctic_submit(store, fun, is_modifier, *args, **kwargs): ...
def async_wait_request(request, timeout=None): ...
def async_wait_requests(requests, timeout=None): ...
def async_shutdown(timeout=None): ...

Async Operations

Types

Core Types

class Arctic:
    """Main Arctic database connection and library manager."""
    
class ArcticLibraryBinding:
    """Library-specific interface for Arctic operations."""

class VersionedItem:
    """Container for versioned data with metadata."""
    def __init__(self, symbol, library, data, version, metadata, host=None): ...
    def metadata_dict(self): ...

class DateRange:
    """Date/time range specification for queries and operations."""
    def __init__(self, start, end, step=None): ...

Store Type Constants

VERSION_STORE = "VersionStore"
TICK_STORE = "TickStoreV3"  
CHUNK_STORE = "ChunkStoreV1"
METADATA_STORE = "MetadataStore"
BSON_STORE = "BSONStore"

Exception Types

class ArcticException(Exception):
    """Base exception for all Arctic errors."""

class NoDataFoundException(ArcticException):
    """Raised when requested data doesn't exist."""

class LibraryNotFoundException(ArcticException):
    """Raised when library doesn't exist."""

class QuotaExceededException(ArcticException):
    """Raised when storage quota exceeded."""

class UnhandledDtypeException(ArcticException):
    """Raised for unsupported data types."""

class OverlappingDataException(ArcticException):
    """Raised when data ranges overlap improperly."""

class UnorderedDataException(ArcticException):
    """Raised when data isn't properly time-ordered."""