Skip to content

Commit d49ffd2

Browse files
committed
Missed replacement of Date with f64
1 parent a326478 commit d49ffd2

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

crates/RustQuant_data/src/curves.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ impl Curve {
181181
}
182182

183183
/// Get a rate, and simultaneously add it to the nodes.
184-
pub fn get_rate_and_insert(&mut self, date: Date) -> Option<f64> {
185-
match self.nodes.get(&date) {
184+
pub fn get_rate_and_insert(&mut self, date: f64) -> Option<f64> {
185+
match self.nodes.get(&OrderedFloat(date)) {
186186
Some(rate) => Some(*rate),
187187
None => {
188188
let rate = self.interpolator.interpolate(date).ok()?;
189-
self.nodes.insert(date, rate);
189+
self.nodes.insert(OrderedFloat(date), rate);
190190
Some(rate)
191191
}
192192
}
@@ -198,7 +198,7 @@ impl Curve {
198198
}
199199

200200
/// Get multiple rates from the curve, and simultaneously add them to the nodes.
201-
pub fn get_rates_and_insert(&mut self, dates: Vec<Date>) -> Vec<Option<f64>> {
201+
pub fn get_rates_and_insert(&mut self, dates: Vec<f64>) -> Vec<Option<f64>> {
202202
dates
203203
.iter()
204204
.map(|date| self.get_rate_and_insert(*date))

crates/RustQuant_math/src/interpolation/exponential_interpolator.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ where
173173
#[cfg(test)]
174174
mod tests_exponential_interpolation {
175175
use super::*;
176-
use time::macros::date;
177176
use RustQuant_utils::{assert_approx_equal, RUSTQUANT_EPSILON};
178177

179178
#[test]

0 commit comments

Comments
 (0)