Initial rebuild of position size calculator #37
@ -98,9 +98,6 @@ impl ExchangeRates {
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct ExchangeRateResult {
|
||||
success: bool,
|
||||
base: String,
|
||||
date: String,
|
||||
rates: HashMap<String, f64>,
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user