File size: 3,363 Bytes
e6fd838
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6dc5ab7
e6fd838
 
 
47088b8
e6fd838
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354cedb
e6fd838
354cedb
e6fd838
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
license: apache-2.0
language:
- en
tags:
- finance
- reinforcement-learning
- gym
- trading
- backtesting
- rust
pretty_name: Chapaty Environments
---

# Chapaty Environments

[![Discord](https://img.shields.io/discord/1495690333911257108.svg?label=Discord&logo=discord&color=7289da&logoColor=white)](https://discord.gg/MmMAB6NCuK)
[![GitHub](https://img.shields.io/badge/GitHub-Chapaty-blue?logo=github)](https://github.com/LenWilliamson/chapaty)
[![Crates.io](https://img.shields.io/crates/v/chapaty.svg)](https://crates.io/crates/chapaty)

This dataset repository hosts the pre-compiled financial environments for [**Chapaty**](https://github.com/LenWilliamson/chapaty), a Rust library for building quantitative trading agents in financial markets. 

Inspired by OpenAI Gymnasium, these datasets provide standardized, easily reproducible simulation states for training and backtesting agents.

## What are these files?

The datasets here are serialized using `.postcard` (a highly efficient binary format for Rust). They contain environment configurations based on the version of the crate you are using. 

## Versioning

This repository uses **branches** to align with Chapaty crate releases (e.g., `v1.1.0`). 
When you use Chapaty in Rust, the library automatically binds to the correct branch matching your crate version, ensuring your agents are always evaluated on consistent data.

## Usage in Rust

**Fast Track:** Use the [**Chapaty Starter Template**](https://github.com/LenWilliamson/chapaty-template) to instantly bootstrap a new project. It includes pre-configured AI prompts for backtesting with a LLM of your choice, built-in dashboard setups with [Quantstats](https://github.com/ranaroussi/quantstats), and best-practice strategy examples.

You do not need to download these files manually. Use the Chapaty crate to load them directly into your async Rust application:

```rust
use anyhow::{Context, Result};
use chapaty::prelude::*;

#[tokio::main]
async fn main() -> Result<()> {
    // Select a preset (e.g., Daily BTC/USDT with SMA 20 & 50)
    let preset = EnvPreset::BinanceBtcUsdt1dSma20Sma50;
    
    // Configure I/O to fetch seamlessly from Hugging Face
    let file_stem = preset.to_string();
    let loc = StorageLocation::HuggingFace { version: None };
    let cfg = IoConfig::new(loc).with_file_stem(&file_stem);

    // Load the environment (downloads and caches locally on first run)
    let mut env = chapaty::load(preset, &cfg)
        .await
        .context("Failed to load trading environment")?;
        
    println!("Successfully loaded environment for {}!", preset);
    
    Ok(())
}
```

## Available Presets

Presets encode exact data source IDs to reproduce identical environments. Current presets include:

* `binance_btc_usdt1d`: BTC/USDT Daily Spot
* `ninja_trader_cme6eh6_1m_5m_us_emp_high`: EUR/USD 1m/5m Futures with US Employment News
* `binance_btc_usdt1h_1m_volume_profile1d_100_usdt`: BTC/USDT Multi-resolution Spot with Volume Profile
* *(And many more—see the [Chapaty Crate Documentation](https://docs.rs/chapaty) for the full `EnvPreset` list).*

## Disclaimer

**Trading and investing involve substantial risk. You may lose some or all of your capital.**
These datasets and the Chapaty library are provided for **research and educational purposes only** and do not constitute financial advice.