bug fixes: types.rs

This commit is contained in:
KhizarImran
2026-06-20 17:52:19 +01:00
parent 5609249180
commit 706be103f0
2 changed files with 16 additions and 2 deletions
+7
View File
@@ -45,6 +45,13 @@ fn max_drawdown(equity_curve: &[f64]) -> f64 {
max_dd
}
#[pymethods]
impl Stats {
fn __repr__(&self) -> String {
format!("{}", self)
}
}
impl Stats {
pub fn compute(broker: &Broker, equity_curve: &[f64]) -> Self {
let num_trades = broker.trade_history.len();
+9 -2
View File
@@ -1,6 +1,6 @@
use pyo3::prelude::*;
#[pyclass]
#[pyclass(from_py_object)]
#[derive(Debug, Clone)]
pub struct Bar {
// Initialises the interface for the bar
@@ -22,7 +22,14 @@ pub struct Bar {
impl Bar {
#[new]
pub fn new(timestamp: i64, open: f64, high: f64, low: f64, close: f64, volume: f64) -> Self {
Bar { timestamp, open, high, low, close, volume }
Bar {
timestamp,
open,
high,
low,
close,
volume,
}
}
}