mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 07:09:59 -07:00
parser: trying to fix ratio smas
This commit is contained in:
@@ -640,11 +640,15 @@ where
|
||||
})
|
||||
.into();
|
||||
|
||||
let last_value = f32::lossy_from(source.get_or_import(date).unwrap_or_else(|| {
|
||||
let mut last_value = f32::lossy_from(source.get_or_import(date).unwrap_or_else(|| {
|
||||
dbg!(date);
|
||||
panic!()
|
||||
}));
|
||||
|
||||
if last_value.is_nan() {
|
||||
last_value = 0.0;
|
||||
}
|
||||
|
||||
average.replace(((previous_average * (days - 1.0) + last_value) / days).into());
|
||||
|
||||
self.insert(*date, average.unwrap());
|
||||
|
||||
@@ -652,7 +652,11 @@ where
|
||||
})
|
||||
.into();
|
||||
|
||||
let last_value = f32::lossy_from(source.get_or_import(&height));
|
||||
let mut last_value = f32::lossy_from(source.get_or_import(&height));
|
||||
|
||||
if last_value.is_nan() {
|
||||
last_value = 0.0;
|
||||
}
|
||||
|
||||
average.replace(
|
||||
((previous_average * (block_time as f32 - 1.0) + last_value) / block_time as f32)
|
||||
|
||||
Reference in New Issue
Block a user