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
830
stars
622
forks
source link
I don't receive any response bei webSocketClient onUserDataUpdateEvent!! #438
// First, we obtain a listenKey which is required to interact with the user data stream
String listenKey = client.startUserDataStream();
// Then, we open a new web socket client, and provide a callback that is called on every update
BinanceApiWebSocketClient webSocketClient = factory.newWebSocketClient();
// Listen for changes in the account
webSocketClient.onUserDataUpdateEvent(listenKey, response -> {
if (response.getEventType() == UserDataUpdateEventType.ACCOUNT_POSITION_UPDATE) {
AccountUpdateEvent accountUpdateEvent = response.getOutboundAccountPositionUpdateEvent();
// Print new balances of every available asset
System.out.println(accountUpdateEvent.getBalances());
} else {
OrderTradeUpdateEvent orderTradeUpdateEvent = response.getOrderTradeUpdateEvent();
// Print details about an order/trade
System.out.println(orderTradeUpdateEvent);
// Print original quantity
System.out.println(orderTradeUpdateEvent.getOriginalQuantity());
// Or price
System.out.println(orderTradeUpdateEvent.getPrice());
}
});
System.out.println("Waiting for events...");
can some body help me? I post a new order, change balances and ... but it's not append?
`package com.binance.api.examples;
import com.binance.api.client.BinanceApiClientFactory; import com.binance.api.client.BinanceApiRestClient; import com.binance.api.client.BinanceApiWebSocketClient; import com.binance.api.client.domain.account.AssetBalance; import com.binance.api.client.domain.account.Order; import com.binance.api.client.domain.account.request.OrderRequest; import com.binance.api.client.domain.event.AccountUpdateEvent; import com.binance.api.client.domain.event.OrderTradeUpdateEvent; import com.binance.api.client.domain.event.UserDataUpdateEvent.UserDataUpdateEventType;
import java.util.List;
/**
as well as update on trades/orders on a user account. */ public class UserDataStreamExample {
public static void main(String[] args) { BinanceApiClientFactory factory = BinanceApiClientFactory.newInstance("*", ""); BinanceApiRestClient client = factory.newRestClient();
} } `