Skip to main content

Deterministic Data Orchestrator for Quantitative Trading

Project description

dacos

A Python library for Medium-Frequency Trading alpha research.
Very early stage, experimental, and definitely not production-ready.
Use at your own risk, and please be kind – we're learning here.

dacos (pronounced "dalam-kost") is a personal project born out of curiosity about statistical arbitrage, mean-reversion, and momentum strategies in crypto markets. It aims to provide a simple, modular, and safe toolkit for building and testing alpha signals without blowing up your laptop.

Why "dacos"?

It stands for Data Construction System, but honestly, and it’s available on PyPI—coming soon (as of this writing).

Features (so far)

  • ETL Pipeline – Build "skinny" tables from raw Parquet files using Polars lazy evaluation. No RAM overload, I promise.
  • Asynchronous Time Alignment – A pure-Polars metronome (upsample) that perfectly aligns different coin timestamps using forward-fill physics (No look-ahead bias).
  • StatArb Engine & Physics Lab – Built-in OLS Rolling Z-Score calculation, Hurst Exponent, ADF Stationarity Test, and Ornstein-Uhlenbeck Half-life.
  • Result Monad – Explicit error handling (Rust-style Ok/Err) so your code doesn't crash unexpectedly in the middle of a multi-million row calculation.
  • Type Hints Everywhere – Because my ADHD brain forgets what a function returns after 5 minutes.

Installation

# From PyPI 
pip install dacos

Status

This is a learning project. I'm not a quant, not a data engineer, just someone who enjoys messing around with data and trading ideas. The code works (for me), but it's full of imperfections, rough edges, and probably a few bugs.

If you're an experienced developer and spot something horrible, feel free to open an issue or PR – but please be gentle.

Roadmap [x] ETL pipeline (extract, filter, log transform) [x] Result monad for error handling [x] Data alignment (as-of join for multiple symbols) [x] Statistical tests (Hurst, ADF, half-life) [x] Pairs trading engine (Rolling Z-Score) [ ] Momentum signals [ ] Execution Tactics (Position Sizing & Entry/Exit Logic) [ ] Backtesting framework (maybe)

How to Use

dacos is designed to hide complex data engineering behind a simple API.

  1. Extracting Data
from dacos.builder import create_skinny_builder

# Point to your raw Parquet folder and where you want the silver table
builder = create_skinny_builder("data/raw", "data/silver")
result = builder.execute_pipeline()

if result.is_ok():
    print("Success! Skinny table created.")
else:
    print(f"Oh no: {result.error()}")
  1. Pairs Research
import dacos.api as dc

# 1. Run the entire pipeline (Ingestion -> Alignment -> Validation -> Math -> Z-Score)
res = dc.run_pairs_research(
    silver_path="data/silver",
    y_symbol="WIF_USDT",
    x_symbol="PEPE_USDT",
    frekuensi="1m",
    z_window=100
)

if res.is_ok():
    output = res.unwrap()
    df_zscore = output["data"]
    metrics = output["metrics"]
    
    print(f"Hurst Exponent: {metrics['hurst']}")
    print(f"Half-Life: {metrics['halflife']} minutes")
    print(df_zscore.tail(5)) # View the latest Z-Scores!

Point to your raw Parquet folder and where you want the silver table

builder = create_skinny_builder("data/raw", "data/silver") result = builder.execute_pipeline()

if result.is_ok(): print("Success! Skinny table created.") else: print(f"Oh no: {result.error()}")

Contributing

Contributions are welcome! But please keep in mind:

I'm still learning, so my code style might be weird.
Write tests if you add Features.
Be nice.

LICENSE

MIT – do whatever you want, but don't blame me if you lose money trading.

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

dacos-0.1.1.tar.gz (57.1 kB view details)

Uploaded Source

Built Distribution

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

dacos-0.1.1-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dacos-0.1.1.tar.gz
  • Upload date:
  • Size: 57.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","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 dacos-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b6f7ee58ef2f6a7980d728d8062ec932e3dd537e985ea4621f00d9d0c188ff51
MD5 7f4e184a27e01b81dec1f7f1f591fb6a
BLAKE2b-256 4a5e23a1a8b9216c4ad01ba95c6927db6841f81e3b95af35f8ba81f871182ee9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dacos-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","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 dacos-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 18ce448a21db2f05c1ec965f92d641bfbb94dbefeb98f2974b29a1be94555d78
MD5 5076e8af22ca1d59de1c2f5a2b8e74ae
BLAKE2b-256 8235932745d9d63cd398b021cc00e6f5972de3ba38c4284699a3cde0fcbf6d14

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