Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,77 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- finance
|
| 7 |
+
- reinforcement-learning
|
| 8 |
+
- gym
|
| 9 |
+
- trading
|
| 10 |
+
- backtesting
|
| 11 |
+
- rust
|
| 12 |
+
pretty_name: Chapaty Environments
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Chapaty Environments
|
| 16 |
+
|
| 17 |
+
[](https://discord.gg/k7GWpDQC)
|
| 18 |
+
[](https://github.com/LenWilliamson/chapaty)
|
| 19 |
+
[](https://crates.io/crates/chapaty)
|
| 20 |
+
|
| 21 |
+
This dataset repository hosts the pre-compiled financial environments for [**Chapaty**](https://github.com/LenWilliamson/chapaty), a high-performance, async-first Rust library for reinforcement learning in financial markets.
|
| 22 |
+
|
| 23 |
+
Inspired by OpenAI Gymnasium, these datasets provide standardized, easily reproducible simulation states for training and backtesting agents.
|
| 24 |
+
|
| 25 |
+
## What are these files?
|
| 26 |
+
|
| 27 |
+
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.
|
| 28 |
+
|
| 29 |
+
## Versioning
|
| 30 |
+
|
| 31 |
+
This repository uses **branches** to align with Chapaty crate releases (e.g., `v1.1.0`).
|
| 32 |
+
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.
|
| 33 |
+
|
| 34 |
+
## Usage in Rust
|
| 35 |
+
|
| 36 |
+
**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.
|
| 37 |
+
|
| 38 |
+
You do not need to download these files manually. Use the Chapaty crate to load them directly into your async Rust application:
|
| 39 |
+
|
| 40 |
+
```rust
|
| 41 |
+
use anyhow::{Context, Result};
|
| 42 |
+
use chapaty::prelude::*;
|
| 43 |
+
|
| 44 |
+
#[tokio::main]
|
| 45 |
+
async fn main() -> Result<()> {
|
| 46 |
+
// Select a preset (e.g., Daily BTC/USDT with SMA 20 & 50)
|
| 47 |
+
let preset = EnvPreset::BinanceBtcUsdt1dSma20Sma50;
|
| 48 |
+
|
| 49 |
+
// Configure I/O to fetch seamlessly from Hugging Face
|
| 50 |
+
let filename = preset.to_string();
|
| 51 |
+
let loc = StorageLocation::HuggingFace { version: None };
|
| 52 |
+
let cfg = IoConfig::new(loc).with_filename(&filename);
|
| 53 |
+
|
| 54 |
+
// Load the environment (downloads and caches locally on first run)
|
| 55 |
+
let mut env = chapaty::load(preset, &cfg)
|
| 56 |
+
.await
|
| 57 |
+
.context("Failed to load trading environment")?;
|
| 58 |
+
|
| 59 |
+
println!("Successfully loaded environment for {}!", preset);
|
| 60 |
+
|
| 61 |
+
Ok(())
|
| 62 |
+
}
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
## Available Presets
|
| 66 |
+
|
| 67 |
+
Presets encode exact data source IDs to reproduce identical environments. Current presets include:
|
| 68 |
+
|
| 69 |
+
* `binance_btc_usdt1d`: BTC/USDT Daily Spot
|
| 70 |
+
* `ninja_trader_cme6eh6_1m_5m_us_emp_high`: EUR/USD 1m/5m Futures with US Employment News
|
| 71 |
+
* `binance_btc_usdt1h_1m_volume_profile1d_100_usdt`: BTC/USDT Multi-resolution Spot with Volume Profile
|
| 72 |
+
* *(And many more—see the [Chapaty Crate Documentation](https://docs.rs/chapaty) for the full `EnvPreset` list).*
|
| 73 |
+
|
| 74 |
+
## Disclaimer
|
| 75 |
+
|
| 76 |
+
**Trading and investing involve substantial risk. You may lose some or all of your capital.**
|
| 77 |
+
These datasets and the Chapaty library are provided for **research and educational purposes only** and do not constitute financial advice.
|