Skip to content

Commit

Permalink
exchange graph ignore zero price
Browse files Browse the repository at this point in the history
  • Loading branch information
z-Wind committed Aug 13, 2024
1 parent efd4b08 commit f0623ce
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/exchange.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use chrono::NaiveDateTime;
#[cfg(not(feature = "decimal"))]
use num_traits::Zero;
use std::collections::{HashMap, HashSet, VecDeque};
use std::sync::Arc;

Expand Down Expand Up @@ -39,6 +41,11 @@ impl Exchange {
let commodity = &p.commodity().await?.mnemonic;
let currency = &p.currency().await?.mnemonic;

if p.value.is_zero() {
println!("Warning: ignore {} {commodity}/{currency} in exchange graph, becasue the value is zero.", p.datetime);
continue;
}

graph
.entry(commodity.clone())
.or_default()
Expand Down

0 comments on commit f0623ce

Please sign in to comment.