new: better stats

This commit is contained in:
Khizar Imran
2026-06-08 23:55:42 +01:00
parent bbfe87edb7
commit 26e625d6f8
5 changed files with 53 additions and 11 deletions
+1 -4
View File
@@ -3,7 +3,6 @@ use backtestingfx::broker::Broker;
use backtestingfx::strategy::Strategy;
use backtestingfx::engine::Engine;
use backtestingfx::data::load_csv;
use backtestingfx::stats::Stats;
struct BuyEveryBar;
@@ -20,9 +19,7 @@ fn main() {
let mut engine = Engine::new(data, 10_000.0, 0.0, 0.00010);
let mut strategy = BuyEveryBar;
engine.run(&mut strategy); // main line that runs the strategy
let stats = Stats::compute(&engine.broker, 10_000.0);
let stats = engine.run(&mut strategy);
println!("{}", stats);
}