Initial rebuild of position size calculator #37
@ -98,9 +98,6 @@ impl ExchangeRates {
|
|||||||
|
|
||||||
#[derive(Debug, Deserialize)]
|
#[derive(Debug, Deserialize)]
|
||||||
struct ExchangeRateResult {
|
struct ExchangeRateResult {
|
||||||
success: bool,
|
|
||||||
base: String,
|
|
||||||
date: String,
|
|
||||||
rates: HashMap<String, f64>,
|
rates: HashMap<String, f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ impl Account {
|
|||||||
Ok(stored) => stored,
|
Ok(stored) => stored,
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::error!("Failed to retrieve trading account from local storage: {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,
|
available_quote,
|
||||||
quantity,
|
quantity,
|
||||||
distance,
|
distance,
|
||||||
actual: if let Some(stop_loss) = position.stop_loss {
|
actual: position.stop_loss.map(|stop_loss| {
|
||||||
Some(ActualStopLoss::compute(
|
ActualStopLoss::compute(account, position, quantity, p_rate, q_rate, stop_loss)
|
||||||
account, position, quantity, p_rate, q_rate, stop_loss,
|
}),
|
||||||
))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user