mirror of
https://github.com/KhizarImran/backtestingfx.git
synced 2026-07-27 20:17:44 +00:00
bug fixes: types.rs
This commit is contained in:
@@ -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
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user