diff --git a/bothan-coin-gecko/src/service.rs b/bothan-coin-gecko/src/service.rs index 9018929d..9f706cd8 100644 --- a/bothan-coin-gecko/src/service.rs +++ b/bothan-coin-gecko/src/service.rs @@ -137,11 +137,12 @@ async fn process_market_data(market: &Market, cache: &Arc>) { } fn parse_market(market: &Market) -> Result { - let naive_date_time = - NaiveDateTime::parse_from_str(market.last_updated.as_str(), "%Y-%m-%dT%H:%M:%S.%fZ") - .map_err(|_| Error::InvalidTimestamp)?; + let last_updated = market.last_updated.as_str(); + let naive_date_time = NaiveDateTime::parse_from_str(last_updated, "%Y-%m-%dT%H:%M:%S.%fZ") + .map_err(|_| Error::InvalidTimestamp)?; let timestamp = u64::try_from(naive_date_time.timestamp()).map_err(|_| Error::InvalidTimestamp)?; + Ok(PriceData::new( market.id.clone(), market.current_price.to_string(),