candles-rs
A Rust library for fetching candlestick (OHLCV) data from multiple cryptocurrency exchanges. Built by Flicker Finance, this library provides a unified interface to access market data from major exchanges.
Features
- Multi-Exchange Support: Fetch candlestick data from:
- Binance (Spot & Derivatives)
- OKX
- Bybit
- BloFin
- BingX
- Unified Interface: Common API across all exchanges
- Multiple Timeframes: Support for 3m, 5m, 15m, 30m, 1h, 4h, 1d, 1w, 1M intervals
- Async/Await: Built with async Rust for efficient data fetching
- Type Safety: Strongly typed with comprehensive error handling
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Quick Start
use ;
async
Supported Exchanges
Binance
- Spot Markets:
https://www.binance.com/api/v3/klines - Derivatives:
https://fapi.binance.com/fapi/v1/klines
OKX
- All Markets:
https://www.okx.com/api/v5/market/candles
Bybit
- All Markets: Exchange-specific implementation
BloFin
- All Markets: Exchange-specific implementation
BingX
- All Markets: Exchange-specific implementation
Data Types
Timeframe
MarketType
Candle
Error Handling
The library uses a comprehensive error system:
Examples
Fetching from Different Exchanges
use ;
// Fetch from OKX
let okx_instrument = Instrument ;
let candles = okx_instrument.connection.get_candles.await?;
Multiple Timeframes
let timeframes = vec!;
for timeframe in timeframes
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is open source and available under the MIT License.
About Flicker Finance
This library is developed and maintained by Flicker Finance, a platform for cryptocurrency trading and market analysis.
Note: This library is for educational and development purposes. Always ensure you comply with each exchange's terms of service and rate limits when using their APIs.