| Crates.io | candlestick-rs |
| lib.rs | candlestick-rs |
| version | 0.2.3 |
| created_at | 2025-05-07 11:45:23.816212+00 |
| updated_at | 2025-12-22 09:56:59.972824+00 |
| description | Candlestick pattern recognition library for technical analysis |
| homepage | |
| repository | https://github.com/l33tquant/candlestick |
| max_upload_size | |
| id | 1663762 |
| size | 70,989 |
A no_std and zero-dependency Rust library for identifying Japanese candlestick patterns in financial markets. Perfect for algorithmic trading, backtesting engines, and technical analysis tools.
no_std compatible with no external dependencyCandleStick traitCandleStreamcargo add candlestick-rs
use candlestick_rs::CandleStick;
// Simple tuple representation: (open, high, low, close, volume)
let candle = (100.0, 105.0, 99.0, 101.0, 0.0);
// Check for patterns
if candle.is_hammer() {
println!("Potential bullish reversal detected!");
} else if candle.is_doji() {
println!("Market indecision detected!");
}
use candlestick_rs::{CandleStick, CandleStream};
// Create candles (open, high, low, close, volume)
let candle1 = (100.0, 105.0, 99.0, 101.0, 0.0); // Day 1
let candle2 = (102.0, 110.0, 101.5, 109.5, 0.0); // Day 2
// Create a stream and add candles
let mut stream = CandleStream::new();
stream.push(&candle1).push(&candle2);
// Check for patterns
if stream.is_bullish_engulfing() {
println!("Strong buy signal detected!");
}
use candlestick_rs::CandleStick;
struct MyCandle {
open: f64,
high: f64,
low: f64,
close: f64,
volume: f64
// ... other fields (timestamp, etc.)
}
impl CandleStick for MyCandle {
fn open(&self) -> f64 { self.open }
fn high(&self) -> f64 { self.high }
fn low(&self) -> f64 { self.low }
fn close(&self) -> f64 { self.close }
fn volume(&self) -> f64 { self.volume }
}
// Now you can use all pattern detection methods!
let my_candle = MyCandle { open: 100.0, high: 105.0, low: 99.0, close: 103.0, volume: 1.0 };
if my_candle.is_bullish_marubozu() {
println!("Strong bullish conviction detected!");
}
This library follows traditional Japanese candlestick pattern definitions and provides detailed context on each pattern's trading significance. Pattern detection is based on mathematically sound ratios that can be customized when needed.
All pattern detection methods include comprehensive documentation explaining:
For complete API documentation, examples, and pattern explanations, visit: https://docs.rs/candlestick-rs
This project is licensed under the MIT License - see the LICENSE file for details.
This software is for informational purposes only. It is not intended as trading or investment advice.