Skip to content

Commit

Permalink
Fix for bug GH-3
Browse files Browse the repository at this point in the history
  • Loading branch information
felipet committed Feb 14, 2025
1 parent fb095b5 commit 8d2f1da
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 49 deletions.
46 changes: 2 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ categories = ['finance']

[dependencies]
chrono = { version = "0.4.38", features = ["alloc", "std", "clock"] }
chrono-tz = { version = "0.10.1", features = ["serde"] }
finance_api = "0.1.0"
finance_ibex = "0.1.0-beta1"
log = "0.4.21"
Expand Down
7 changes: 3 additions & 4 deletions src/web_scrappers/cnmv_scrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
//! of the Spanish _Comisión Nacional de Mercado de Valores (CNMV)_.
use crate::{AliveShortPositions, CnmvError, ShortPosition, ShortResponse};
use chrono::{offset::LocalResult, NaiveDate, TimeZone, Utc};
use chrono_tz::Europe::Madrid;
use chrono::{offset::LocalResult, Datelike, NaiveDate, TimeZone, Utc};
use finance_api::Company;
use finance_ibex::IbexCompany;
use reqwest;
Expand Down Expand Up @@ -195,8 +194,8 @@ impl CnmvProvider {
})?;

let open_date =
match Madrid.from_local_datetime(&date.and_hms_opt(15, 30, 0).unwrap()) {
LocalResult::Single(value) => value.to_utc(),
match Utc.with_ymd_and_hms(date.year(), date.month(), date.day(), 14, 30, 0) {
LocalResult::Single(date) => date,
_ => {
error!("The given naive date: ({date}) does not convert to UTC.");
return Err(CnmvError::InternalError(
Expand Down

0 comments on commit 8d2f1da

Please sign in to comment.