diff --git a/Cargo.lock b/Cargo.lock index 45f318f9..9ad2270b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -490,9 +490,9 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chrono" -version = "0.4.34" +version = "0.4.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" +checksum = "8eaf5903dcbc0a39312feb77df2ff4c76387d591b9fc7b04a238dcf8bb62639a" dependencies = [ "android-tzdata", "iana-time-zone", @@ -771,34 +771,13 @@ dependencies = [ "serde", ] -[[package]] -name = "derive_builder" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8" -dependencies = [ - "derive_builder_macro 0.12.0", -] - [[package]] name = "derive_builder" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0350b5cb0331628a5916d6c5c0b72e97393b8b6b03b47a9284f4e7f5a405ffd7" dependencies = [ - "derive_builder_macro 0.20.0", -] - -[[package]] -name = "derive_builder_core" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f" -dependencies = [ - "darling 0.14.4", - "proc-macro2", - "quote", - "syn 1.0.109", + "derive_builder_macro", ] [[package]] @@ -813,23 +792,13 @@ dependencies = [ "syn 2.0.47", ] -[[package]] -name = "derive_builder_macro" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" -dependencies = [ - "derive_builder_core 0.12.0", - "syn 1.0.109", -] - [[package]] name = "derive_builder_macro" version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" dependencies = [ - "derive_builder_core 0.20.0", + "derive_builder_core", "syn 2.0.47", ] @@ -2518,7 +2487,7 @@ dependencies = [ "anyhow", "async-trait", "chrono", - "derive_builder 0.12.0", + "derive_builder", "futures", "opentelemetry", "opentelemetry_sdk", @@ -2804,9 +2773,9 @@ dependencies = [ [[package]] name = "rust_decimal_macros" -version = "1.32.0" +version = "1.34.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86444b802de0b10ac5e563b5ddb43b541b9705de4e01a50e82194d2b183c1835" +checksum = "e418701588729bef95e7a655f2b483ad64bb97c46e8e79fde83efd92aaab6d82" dependencies = [ "quote", "rust_decimal", @@ -2940,18 +2909,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", @@ -2960,9 +2929,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -3260,7 +3229,7 @@ checksum = "ef501316ee93fbd86c2e30d0f1ccbef5b53be4877550e2afa055203ead7c53c3" dependencies = [ "cached", "chrono", - "derive_builder 0.20.0", + "derive_builder", "opentelemetry", "rust_decimal", "rusty-money", @@ -3541,7 +3510,7 @@ version = "0.12.5-dev" dependencies = [ "anyhow", "chrono", - "derive_builder 0.12.0", + "derive_builder", "futures", "governor", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index 7e9ba69e..e9e22082 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,8 +20,8 @@ tokio-tungstenite = { version = "0.20.1", features = ["rustls-tls-webpki-roots"] url = { version = "2.5.0", features = ["serde"] } axum = "0.6.11" axum-core = "0.3.4" -serde = { version = "1.0.196", features = ["derive"] } -serde_json = "1.0.113" +serde = { version = "1.0.197", features = ["derive"] } +serde_json = "1.0.114" serde_yaml = "0.9.31" serde_with = { version = "3.6.1", features = ["chrono_0_4"] } sqlx = { version = "0.7.2", features = [ "runtime-tokio-rustls", "postgres", "rust_decimal", "uuid", "chrono", "json" ] } @@ -39,12 +39,12 @@ opentelemetry-otlp = { version = "0.15.0", features = ["http-proto", "reqwest-cl opentelemetry = { version = "0.22.0" } opentelemetry_sdk = { version = "0.22.1", features = ["rt-tokio"] } opentelemetry-http = "0.11.0" -chrono = { version = "0.4", features = ["clock", "serde"], default-features = false } +chrono = { version = "0.4.35", features = ["clock", "serde"], default-features = false } ring = "0.16.20" uuid = { version = "1.7.0", features = ["v4", "serde"] } data-encoding = "2.5.0" rust_decimal = "1.34.3" -rust_decimal_macros = "1.29.0" +rust_decimal_macros = "1.34.2" governor = "0.5.1" lazy_static = "1.4.0" rand = "0.8.5" @@ -56,4 +56,4 @@ prost = "0.12.1" prost-wkt-types = { version = "0.5.0", features = ["vendored-protoc"]} graphql_client = {version = "0.12.0", features = ["reqwest"]} rusty-money = "0.4.1" -derive_builder = "0.12.0" +derive_builder = "0.20.0" diff --git a/hedging/src/okex/config.rs b/hedging/src/okex/config.rs index 6c9b4325..8c25106d 100644 --- a/hedging/src/okex/config.rs +++ b/hedging/src/okex/config.rs @@ -130,5 +130,5 @@ fn default_high_bound_buffer_percentage() -> Decimal { dec!(0.9) } fn default_deposit_lost_timeout_seconds() -> chrono::Duration { - chrono::Duration::seconds(3600) + chrono::Duration::try_seconds(3600).expect("should always be able to create a timeout duration") } diff --git a/shared/src/time.rs b/shared/src/time.rs index 9605d610..1bf29214 100644 --- a/shared/src/time.rs +++ b/shared/src/time.rs @@ -58,8 +58,7 @@ impl TryFrom<&TimeStampMilliStr> for TimeStamp { fn try_from(value: &TimeStampMilliStr) -> Result { let millis = value.0.parse::()?; - if let Some(naive) = NaiveDateTime::from_timestamp_opt(millis / 1000, 0) { - let datetime: DateTime = DateTime::from_naive_utc_and_offset(naive, Utc); + if let Some(datetime) = DateTime::from_timestamp(millis / 1000, 0) { Ok(Self(datetime)) } else { Err(TimeStampError::EmptyNaiveDateTime(