Igosuki / binance-rs-async

Async client for the Binance APIs
https://crates.io/crates/binance-rs-async
Other
184 stars 113 forks source link

errors while using the wallet feature? #45

Closed Matelasse closed 2 years ago

Matelasse commented 2 years ago

I get these errors when trying to use the wallet_api feature

error[E0599]: no method named `sub` found for enum `std::option::Option` in the current scope
   --> rust/.cargo/registry/src/github.com-1ecc6299db9ec823/binance-rs-async-1.1.10/src/wallet.rs:175:66
    |
175 |         let mut current_period_start: DateTime<Utc> = start_from.sub(interval_duration);
    |                                                                  ^^^ method not found in `std::option::Option<DateTime<Utc>>`
    |
note: the method `sub` exists on the type `DateTime<Utc>`
   --> rust/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/arith.rs:221:5
    |
221 |     fn sub(self, rhs: Rhs) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider using `Option::expect` to unwrap the `DateTime<Utc>` value, panicking if the value is an `Option::None`
    |
175 |         let mut current_period_start: DateTime<Utc> = start_from.expect("REASON").sub(interval_duration);
    |                                                                 +++++++++++++++++

error[E0308]: mismatched types
   --> rust/.cargo/registry/src/github.com-1ecc6299db9ec823/binance-rs-async-1.1.10/src/wallet.rs:184:48
    |
184 |             let records = self.deposit_history(&query).await?;
    |                                --------------- ^^^^^^ expected struct `rest_model::DepositHistoryQuery`, found `&rest_model::DepositHistoryQuery`
    |                                |
    |                                arguments to this function are incorrect
    |
note: associated function defined here
   --> rust/.cargo/registry/src/github.com-1ecc6299db9ec823/binance-rs-async-1.1.10/src/wallet.rs:148:18
    |
148 |     pub async fn deposit_history(&self, query: DepositHistoryQuery) -> Result<Vec<DepositRecord>> {
    |                  ^^^^^^^^^^^^^^^ -----  --------------------------
help: consider removing the borrow
    |
184 -             let records = self.deposit_history(&query).await?;
184 +             let records = self.deposit_history(query).await?;
    |

error[E0368]: binary assignment operation `-=` cannot be applied to type `DateTime<Utc>`
   --> rust/.cargo/registry/src/github.com-1ecc6299db9ec823/binance-rs-async-1.1.10/src/wallet.rs:195:13
    |
195 |             current_period_start -= interval_duration;
    |             --------------------^^^^^^^^^^^^^^^^^^^^^
    |             |
    |             cannot use `-=` on type `DateTime<Utc>`

error[E0368]: binary assignment operation `-=` cannot be applied to type `DateTime<Utc>`
   --> rust/.cargo/registry/src/github.com-1ecc6299db9ec823/binance-rs-async-1.1.10/src/wallet.rs:196:13
    |
196 |             current_period_end -= interval_duration;
    |             ------------------^^^^^^^^^^^^^^^^^^^^^
    |             |
    |             cannot use `-=` on type `DateTime<Utc>`

error[E0599]: no method named `sub` found for enum `std::option::Option` in the current scope
   --> rust/.cargo/registry/src/github.com-1ecc6299db9ec823/binance-rs-async-1.1.10/src/wallet.rs:241:66
    |
241 |         let mut current_period_start: DateTime<Utc> = start_from.sub(interval_duration);
    |                                                                  ^^^ method not found in `std::option::Option<DateTime<Utc>>`
    |
note: the method `sub` exists on the type `DateTime<Utc>`
   --> rust/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/arith.rs:221:5
    |
221 |     fn sub(self, rhs: Rhs) -> Self::Output;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: consider using `Option::expect` to unwrap the `DateTime<Utc>` value, panicking if the value is an `Option::None`
    |
241 |         let mut current_period_start: DateTime<Utc> = start_from.expect("REASON").sub(interval_duration);
    |                                                                 +++++++++++++++++

error[E0308]: mismatched types
   --> rust/.cargo/registry/src/github.com-1ecc6299db9ec823/binance-rs-async-1.1.10/src/wallet.rs:250:49
    |
250 |             let records = self.withdraw_history(&query).await?;
    |                                ---------------- ^^^^^^ expected struct `rest_model::WithdrawalHistoryQuery`, found `&rest_model::WithdrawalHistoryQuery`
    |                                |
    |                                arguments to this function are incorrect
    |
note: associated function defined here
   --> rust/.cargo/registry/src/github.com-1ecc6299db9ec823/binance-rs-async-1.1.10/src/wallet.rs:212:18
    |
212 |     pub async fn withdraw_history(&self, query: WithdrawalHistoryQuery) -> Result<Vec<WithdrawalRecord>> {
    |                  ^^^^^^^^^^^^^^^^ -----  -----------------------------
help: consider removing the borrow
    |
250 -             let records = self.withdraw_history(&query).await?;
250 +             let records = self.withdraw_history(query).await?;
    |

error[E0368]: binary assignment operation `-=` cannot be applied to type `DateTime<Utc>`
   --> rust/.cargo/registry/src/github.com-1ecc6299db9ec823/binance-rs-async-1.1.10/src/wallet.rs:261:13
    |
261 |             current_period_start -= interval_duration;
    |             --------------------^^^^^^^^^^^^^^^^^^^^^
    |             |
    |             cannot use `-=` on type `DateTime<Utc>`

error[E0368]: binary assignment operation `-=` cannot be applied to type `DateTime<Utc>`
   --> rust/.cargo/registry/src/github.com-1ecc6299db9ec823/binance-rs-async-1.1.10/src/wallet.rs:262:13
    |
262 |             current_period_end -= interval_duration;
    |             ------------------^^^^^^^^^^^^^^^^^^^^^
    |             |
    |             cannot use `-=` on type `DateTime<Utc>`
Igosuki commented 2 years ago

I will fix this immediatly

Igosuki commented 2 years ago

fixed by https://github.com/Igosuki/binance-rs-async/commit/66388006502ad526940389661fde413d1104391b