Initial rebuild of position size calculator #37

Merged
BlakeRain merged 12 commits from trading-tools into main 2023-09-25 16:48:37 +00:00
3 changed files with 4 additions and 11 deletions
Showing only changes of commit 2ddd122728 - Show all commits

View File

@ -98,9 +98,6 @@ impl ExchangeRates {
#[derive(Debug, Deserialize)]
struct ExchangeRateResult {
success: bool,
base: String,
date: String,
rates: HashMap<String, f64>,
}

View File

@ -85,7 +85,7 @@ impl Account {
Ok(stored) => stored,
Err(err) => {
log::error!("Failed to retrieve trading account from local storage: {err:?}");
return Self::default();
Self::default()
}
}
}

View File

@ -266,13 +266,9 @@ impl StopLoss {
available_quote,
quantity,
distance,
actual: if let Some(stop_loss) = position.stop_loss {
Some(ActualStopLoss::compute(
account, position, quantity, p_rate, q_rate, stop_loss,
))
} else {
None
},
actual: position.stop_loss.map(|stop_loss| {
ActualStopLoss::compute(account, position, quantity, p_rate, q_rate, stop_loss)
}),
}
}
}