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

"For" with 3 Apikey runs all purchases only for the first (apikey) account of the list. #18

Open
csdiftec opened this issue Dec 23, 2018 · 0 comments

Comments

@csdiftec
Copy link

csdiftec commented Dec 23, 2018

I have 3 'ApiKey' different accounts and 1 invalid, but no matter what I do in the for the purchase is only posted to the account of the first ApiKey, example; if the first one is invalid all are invalid, if you launch the purchase and it is validated, all are being validated for the same account but with the correct values ​​of each purchase.
I do not know how to close or open each "session" something of the type.
What should I do?

              List<Ticket> listTicket = (List<Ticket>) ticketServiceImpl.findAll();	
               for (int i = 0; i < listTicket.size(); i++) {

			String apiKey = listTicket.get(i).getUser().getApiKey().toString();
			String secretKey = listTicket.get(i).getUser().getSecretKey().toString();	
							
			buy(currencyPair, stringAmountBuy, apiKey, secretKey, purchasePrice);			
			}
	     }

`public class Buy {

public  void buy(String currencyPair,String amountBTC,String apiKey,String secretKey,BigDecimal purchasePrice) {

	BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance(apiKey,secretKey);
	BinanceApiRestClient client = factory.newRestClient();
	
	String purchasePriceString = String.valueOf(purchasePrice);
	
	NewOrderResponse newOrderResponse = client.newOrder(limitBuy(currencyPair, TimeInForce.GTC, amountBTC, purchasePriceString));

	System.out.println("Class buy..."+ newOrderResponse);
		
}

}`

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

No branches or pull requests

1 participant