| Crates.io | betfair-rs |
| lib.rs | betfair-rs |
| version | 0.3.3 |
| created_at | 2025-03-30 08:58:59.712912+00 |
| updated_at | 2025-10-02 19:43:01.520303+00 |
| description | A high-performance Rust library for the Betfair Exchange API with real-time streaming, order management, and interactive terminal dashboard |
| homepage | https://github.com/t2o2/betfair-rs |
| repository | https://github.com/t2o2/betfair-rs |
| max_upload_size | |
| id | 1612190 |
| size | 1,922,867 |
A Rust library for interacting with the Betfair Exchange API, providing trading capabilities, real-time market data streaming, and order management.
Add to your Cargo.toml:
[dependencies]
betfair-rs = { git = "https://github.com/t2o2/betfair-rs" }
Create a config.toml file:
[betfair]
username = "your_username"
password = "your_password"
api_key = "your_api_key"
pem_path = "/path/to/client.pem" # Combined cert + private key
use betfair_rs::BetfairClient;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Initialize client
let client = BetfairClient::from_config_file("config.toml").await?;
// Get markets
let markets = client.list_market_catalogue(None).await?;
// Stream market data
client.subscribe_markets(vec!["1.123456".to_string()]).await?;
Ok(())
}
Run the interactive terminal UI for real-time trading:
cargo run -- dashboard

Features:
# Stream market data
cargo run -- stream 1.123456 1.789012 --depth 10
# Run examples
cargo run --example streaming_orderbook
cargo run --example interactive_login_test
# Build
cargo build
# Run tests
cargo test
# Lint
cargo clippy
# Format
cargo fmt
MIT License - see LICENSE file for details
Contributions are welcome! Please feel free to submit a Pull Request.