| Crates.io | rs-backtester |
| lib.rs | rs-backtester |
| version | 0.1.4 |
| created_at | 2025-01-02 14:00:49.333091+00 |
| updated_at | 2025-11-16 15:55:13.014386+00 |
| description | Financial backesting library |
| homepage | |
| repository | https://github.com/nicferrari/backtester |
| max_upload_size | |
| id | 1501564 |
| size | 485,949 |
rs-backtester is a financial backtesting library entirely written in Rust with the purpose of being easy-to-use yet flexible enough to allow a quick implementation of different strategies
To get started:
use std::error::Error;
use rs_backtester::backtester::Backtest;
use rs_backtester::data::Data;
use rs_backtester::strategies::sma_cross;
use rs_backtester::report::report_horizontal;
let quotes = Data::load("test_data//NVDA.csv","NVDA")?;
let quotes = Data::new_from_yahoo("GOOG","1d","6mo")?;
let sma_cross_strategy = sma_cross(quotes.clone(), 10, 20);
let sma_cross_bt = Backtest::new(sma_cross_strategy,100_000f64);
report_horizontal(sma_cross_tester);
sma_cross_tester.print_all_trades();
plot(sma_cross_tester,plot_config)?;

sma_cross_bt.to_csv("bt.csv")?;
report_vertical(&[&buynhold_bt, &sma_bt, &sma_cross_bt, &rsi_bt]);
let sma_cross_long = sma_cross_strategy.long_only();
This software is provided for educational and research purposes only.
The results generated by this library do not guarantee future performance and should not be interpreted as financial advice.
Users are solely responsible for any decisions made based on the outputs of this software.
The authors and contributors of this project disclaim any liability for losses or damages arising from the use of this library.