Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Conversation

@TanguyHerbron
Copy link

As I tried to work with multiple Binance accounts, I noticed, with the code following :

public static void main(String[] args) {
	  
	try {
	    BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance("0000", "0000");
	    BinanceApiRestClient client = factory.newRestClient();

	    // Get account balances
	    Account account = client.getAccount(6000000L, System.currentTimeMillis());
	    System.out.println(account.getAssetBalance("VEN"));
	} catch(BinanceApiException e) {
		e.printStackTrace();
	}
    
	try {
	    BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance("VALID API KEY", "VALID SECRET KEY");
	    BinanceApiRestClient client = factory.newRestClient();

	    // Get account balances
	    Account account = client.getAccount(6000000L, System.currentTimeMillis());
	    System.out.println(account.getAssetBalance("VEN"));
	} catch(BinanceApiException e) {
		e.printStackTrace();
	}
  }
  • Situtation 1 : First account valid, second account incorrect
    Both requests returns informations from the first, valid, account
    The second account is considered as valid (call.execute() line 53 in BinanceApiServiceGenerator returns true for both cases)

  • Situation 2 : First account incorrect, second account valid
    Behaves as intended, the first one throws an exception, the second one returns the balance present on the account

  • Situation 3 : Both accounts valid but from different Binance accounts
    Not tested

The modifications I propose allows the above code to detect an invalid account no matter the order its called.

I tried to read and understand the code as much as I could but I might have done something wrong, in this case I'm curious to know what and why.

Hope I'll hear news from you.

Copy link
Member

@joaopsilva joaopsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #133.

@joaopsilva
Copy link
Member

Fixed in #133.

@joaopsilva joaopsilva closed this Sep 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants