feat: Position __repr__ and DataFrame column validation

This commit is contained in:
KhizarImran
2026-07-05 14:58:58 +01:00
parent c22153f02f
commit cefa7c8ee1
2 changed files with 18 additions and 0 deletions
+13
View File
@@ -53,6 +53,19 @@ pub struct Position {
pub take_profit: Option<f64>,
}
#[pymethods]
impl Position {
fn __repr__(&self) -> String {
format!(
"Position(id={}, {} {:.2} lots @ {:.5})",
self.id,
if self.is_long { "LONG" } else { "SHORT" },
self.lot_size,
self.entry_price,
)
}
}
#[derive(Debug, Clone)]
pub struct Trade {
// the actual trade