Skip to content

tonyhieu/agentic-trading-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

536 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agentic Trading System

Created for Event Horizon Labs as a part of the University of Chicago Project Lab, Spring 2026

Overview

This repository provides an iterative feedback loop for autonomous agents to research, develop, and implement trading strategies. Our goal is to create a verifiable environment where agents can autonomously iterate and improve upon trading strategies.

System Architecture

The following diagram illustrates how the Agentic System interacts with the Exchange and Execution engines to create the strategy feedback loop: System Architecture

Features

Automated Strategy Snapshot System

The repository includes a sophisticated snapshot system that automatically backs up trading strategies to AWS S3:

  • Automated Backups: Snapshots are created automatically when pushing to snapshots/* branches
  • Manual Triggers: Create snapshots on-demand via GitHub Actions
  • Comprehensive Storage: Each snapshot includes code, backtesting results, and metadata
  • 30-Day Retention: Automatic cleanup prevents storage bloat
  • Secure & Reliable: Stored in AWS S3, separate from git repository to prevent data loss

Large-Scale Data Management

Store and retrieve large research datasets (up to and beyond 40 GB) for agent training and backtesting:

  • Manifest-Driven Discovery: Agents fetch metadata first to understand dataset structure
  • Selective Partition Retrieval: Download only the data you need (date ranges) to minimize transfer costs
  • Integrity Validation: SHA-256 checksums for every file
  • Docker-First Execution: Reproducible agent environments with pre-configured AWS access
  • Resume Capability: Interrupted downloads continue from where they left off
  • Cost Optimized: Store 40 GB dataset for ~$1-5/month with selective retrieval patterns

What Gets Snapshotted?

  • Strategy code (.py files, Jupyter notebooks)
  • Backtesting results (JSON, CSV, visualizations)
  • Performance metrics (returns, Sharpe ratio, drawdown, win rate)
  • Metadata (timestamps, commit SHAs, workflow info)

Documentation

For agents

For humans / operators

Repository Structure

agentic-trading-system/
├── execution_algos/                 # Reusable execution algorithm module
│   └── simple_execution_strategy/
│       └── execution_algorithm.py
├── execution_algos/                      # Trading strategy implementations
│   └── sample_momentum_strategy/    # Example strategy with results
│       ├── momentum_strategy.py     # Strategy code
│       ├── requirements.txt         # Dependencies
│       └── results/                 # Backtesting results
│           ├── backtest-results.json
│           └── trade-history.csv
├── .claude/
│   ├── agents/researcher.md         # Research agent definition
│   └── skills/                      # Preloaded research skills (backtest, analysis, snapshot, evaluate)
├── .github/
│   └── workflows/
│       └── snapshot-execution-algo.yml  # Automated snapshot workflow
├── docs/
│   ├── OBJECTIVE.md                 # Research brief (canonical for agents)
│   └── operator/                    # Architecture, AWS setup, troubleshooting
├── research/
│   ├── config.yaml                  # Research hyperparameters
│   ├── program_database.json        # Append-only attempt log
│   └── NOTES.md                     # Human assumption alerts
├── CLAUDE.md                        # Agent bootstrap
└── README.md                        # This file

Quick Start for Agents

Read docs/OBJECTIVE.md — it contains everything an agent needs: the metatask, how to access data, execution constraints, evaluation benchmarks, the research loop, and how to save results. All numeric values come from research/config.yaml.

Create a Strategy Snapshot

Method 1: Automatic (Recommended)

# Create snapshot branch
git checkout -b snapshots/your-strategy-name

# Add your execution algorithm
mkdir -p execution_algos/your-strategy-name/results
# ... add your code and results ...

# Push to trigger automatic snapshot
git add execution_algos/your-strategy-name/
git commit -m "Add trading strategy with backtest results"
git push origin snapshots/your-strategy-name

Method 2: Manual

  1. Go to GitHub → Actions → "Create Strategy Snapshot"
  2. Click "Run workflow"
  3. Enter strategy name and path
  4. Click "Run workflow" button

See .claude/skills/snapshot/SKILL.md for detailed instructions.

Snapshot Storage Structure

Snapshots are stored in S3 with this structure:

s3://bucket-name/execution_algos/
└── strategy-name/
    └── 2026-04-04T12-30-45Z-abc1234/    # Timestamp + commit SHA
        ├── code/
        │   ├── strategy.py
        │   └── requirements.txt
        ├── results/
        │   ├── backtest-results.json
        │   └── trade-history.csv
        └── metadata.json                 # Snapshot metadata

Setup

For administrators setting up the infrastructure:

  1. Follow the AWS Setup Guide to configure:

    • AWS account and S3 bucket
    • IAM user with minimal permissions
    • GitHub repository secrets
    • Lifecycle policies for retention
  2. The GitHub Actions workflow is pre-configured and ready to use

  3. Point agents at CLAUDE.md and docs/OBJECTIVE.md

Example Execution Algorithm

A sample Execution Algorithm is included in execution_algos/simple_execution_strategy to demonstrate:

  • Strategy code structure
  • Backtesting results format
  • How snapshots capture everything

Security

  • AWS credentials stored securely in GitHub Secrets
  • IAM user has minimal permissions (PutObject, GetObject only)
  • S3 bucket is private with no public access
  • Lifecycle policies automatically expire old snapshots

Cost Estimate

Expected monthly costs for moderate usage:

  • S3 Storage (10-100GB): ~$2-5
  • API requests: ~$0.01
  • Total: $3-10/month

Well within the $10-50/month budget range.

Future Enhancements

  • Snapshot retrieval workflow (download via GitHub Actions)
  • Performance comparison dashboard
  • Automated strategy validation
  • Multi-cloud backup support

Contributing

This repository is designed for autonomous agents to iterate on trading strategies. Agents should:

  1. Develop strategies in the execution_algos/ directory
  2. Develop execution algorithms in the execution_algos/ directory
  3. Include comprehensive backtesting results
  4. Use the snapshot system to preserve iterations
  5. Follow naming conventions in .claude/skills/snapshot/SKILL.md

License

Created for Event Horizon Labs - University of Chicago Project Lab


Snapshot Retention: 30 days
Last Updated: 2026-04-04

About

A fully fleshed out environment for AI agents to research trading execution algorithms. Created for Event Horizon Labs as a part of the University of Chicago Project Lab, Spring 2026.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages