Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to login - Unknown variant #195

Open
dh-nunes opened this issue Sep 7, 2021 · 10 comments · Fixed by #199
Open

Unable to login - Unknown variant #195

dh-nunes opened this issue Sep 7, 2021 · 10 comments · Fixed by #199

Comments

@dh-nunes
Copy link

dh-nunes commented Sep 7, 2021

Trying to login to my regular account gives an error with: error decoding response body: unknown variant `RAW_REQUESTS`, expected `ORDERS` or `REQUEST_WEIGHT` at line 1 column 324

Code used:

let cred: BinanceCredentials;
if SANDBOX {
    cred = BinanceCredentials {
        api_key: TEST_KEY.to_string(),
        api_secret: TEST_SECRET.to_string(),
    };
} else {
    cred = BinanceCredentials {
        api_key: API_KEY.to_string(),
        api_secret: API_SECRET.to_string(),
    };
};
let params = BinanceParameters {
    sandbox: SANDBOX,
    credentials: Some(cred),
};
let client = Binance::new(params.clone()).await?;

When SANDBOX is true I can freely login but when it's false it gives the error above.

@dh-nunes
Copy link
Author

dh-nunes commented Sep 8, 2021

Looks like it can be fixed by adding RawRequests to the RateLimitType enum here. I don't think anything is being done with this information (yet) so a quick fix looks possible

@notdanilo notdanilo linked a pull request Nov 11, 2021 that will close this issue
@notdanilo
Copy link
Contributor

@GandaG both environments are tested in the PR above, so it should be working. Would you please check it after it's merged?

@jhoogstraat
Copy link

jhoogstraat commented Dec 5, 2021

I just got the exact same error 0.3.0.
Exact same code and error message as above.

@mohamedabdelbary
Copy link

mohamedabdelbary commented Jun 27, 2022

hi everyone - any chance that this issue can be re-opened and looked into? I get exactly the same error and with similar code

    let api_key = std::env::var("BINANCE_API_KEY").expect("API key not supplied");
    let api_secret = std::env::var("BINANCE_API_SECRET").expect("API Secret not supplied");
    let creds = BinanceCredentials {
        api_key,
        api_secret,
    };
    let params = BinanceParameters { environment: Environment::Production, credentials: Some(creds) };
    let binance_exchange= Binance::new(params).await?;

running on v0.3.0

@notdanilo
Copy link
Contributor

@mohamedabdelbary I also faced this few days ago. Maybe the API was updated. I will push a fix asap

@notdanilo notdanilo reopened this Jun 27, 2022
@mohamedabdelbary
Copy link

@notdanilo thank you so much 🙂

@mohamedabdelbary
Copy link

hi @notdanilo - any update on this?

@notdanilo
Copy link
Contributor

@mohamedabdelbary I just pushed a fix for it. Can you test it by grabbing the crate from git? I am not sure if I still have the credentials to publish the changes to crates.io, because I am no longer working at nash.

@mohamedabdelbary
Copy link

mohamedabdelbary commented Aug 2, 2022

hi @notdanilo . Thanks for this. I'm trying to add the dependency directly from git in my Cargo.toml file. I get an error that looks like it's due to 2 versions of the library being installed.

error[E0308]: mismatched types
  --> trader/src/main.rs:17:51
   |
17 |     let params = BinanceParameters { environment: Environment::Production, credentials: Some(creds) };
   |                                                   ^^^^^^^^^^^^^^^^^^^^^^^ expected enum `openlimits_exchange::exchange::Environment`, found enum `Environment`
   |
   = note: perhaps two different versions of crate `openlimits_exchange` are being used?


error[E0599]: no function or associated item named `new` found for struct `Binance` in the current scope
  --> trader/src/main.rs:18:37

Seems it's more a Rust dependency management issue though than an openlimits issue. I can definitely see two versions of the library being installed

   Compiling openlimits-exchange v0.3.0
   Compiling openlimits-exchange v0.3.1-alpha.0 (https://github.com/nash-io/openlimits?rev=4137b08b#4137b08b)
   Compiling openlimits-binance v0.3.1-alpha.0 (https://github.com/nash-io/openlimits?rev=4137b08b#4137b08b)

I've already tried deleting the target dir and re-running the Cargo install several times and still no luck. The relevant lines in my Cargo.toml file are

openlimits-exchange = { git = "https://github.com/nash-io/openlimits", rev = "4137b08b" }
openlimits-binance = { git = "https://github.com/nash-io/openlimits", rev = "4137b08b" }

Going to try and resolve this, but any pointers would be great, thanks!

@mohamedabdelbary
Copy link

mohamedabdelbary commented Aug 18, 2022

Took a further look. It seems that maybe this latest revision requires an earlier version which is incompatible. Can see the following in my Cargo.lock file

[[package]]
name = "openlimits-binance"
version = "0.3.1-alpha.0"
source = "git+https://github.com/nash-io/openlimits?rev=4137b08b#4137b08bb545d5a0475db15d2ea38aff4ec17a00"
dependencies = [
 "async-trait",
 "chrono",
 "futures 0.3.23",
 "hex",
 "hmac",
 "log",
 "openlimits-exchange 0.3.0",
 "reqwest",
 "rust_decimal",
 "serde",
 "serde_json",
 "serde_urlencoded",
 "sha2",
 "thiserror",
 "tokio 1.20.1",
 "tokio-tungstenite",
 "url",
]

Note the dependency of openlimits-binance version 0.3.1-alpha.0 on openlimits-exchange 0.3.0. But I'm also installing openlimits-exchange version 0.3.1-alpha.0 to get the latest changes, so two versions of openlimits-exchange are being installed, and they seem to be incompatible.

Could we maybe remove the dependency of openlimits-binance on openlimits-exchange 0.3.0 in version 0.3.1-alpha.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants