binance-exchange / binance-java-api

binance-java-api is a lightweight Java library for the Binance API, supporting synchronous and asynchronous requests, as well as event streaming using WebSockets.
MIT License
831 stars 628 forks source link

UserDataUpdateEvent: ACCOUNT_UPDATE is wrong #355

Closed mcourteaux closed 3 years ago

mcourteaux commented 3 years ago

The issue is this enum definition: https://github.com/binance-exchange/binance-java-api/blob/7781ee05492b197a6c6b54ac0dd0684e194e536e/src/main/java/com/binance/api/client/domain/event/UserDataUpdateEvent.java#L91

OfficialVreesie commented 3 years ago

@mcourteaux I have the same problem. My event listener also receives only the first order. I changed my code in the updateEvent to:

if (newEvent.getEventType() ==
    UserDataUpdateEvent.UserDataUpdateEventType.ACCOUNT_UPDATE) {
    System.out.println("### ACCOUNT_UPDATE");
    AccountUpdateEvent accountUpdateEvent = newEvent.getAccountUpdateEvent();
    // Print new balances of every available asset
    System.out.println(accountUpdateEvent.getBalances());
} else if (newEvent.getEventType() ==
           UserDataUpdateEvent.UserDataUpdateEventType.ORDER_TRADE_UPDATE) {
    System.out.println("### ORDER_TRADE_UPDATE");
    System.out.println(newEvent.getOrderTradeUpdateEvent().toString());
} else if (newEvent.getEventType() ==
           UserDataUpdateEvent.UserDataUpdateEventType
               .ACCOUNT_POSITION_UPDATE) {
    System.out.println("### ACCOUNT_POSITION_UPDATE");
    System.out.println(newEvent.toString());
} else if (newEvent.getEventType() ==
           UserDataUpdateEvent.UserDataUpdateEventType.BALANCE_UPDATE) {
    System.out.println("### BALANCE_UPDATE");
    System.out.println(newEvent.toString());
} else {
    System.out.println("### Unknown user account event type");
    System.out.println(newEvent.toString());
}

But I still have the same problem. What code do I need to change to get this working or is this issue not fixed yet?