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

I don't receive any response bei webSocketClient onUserDataUpdateEvent!! #438

@saeid1

Description

@saeid1

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;

/**

  • User data stream endpoints examples.

  • It illustrates how to create a stream to obtain updates on a user account,

  • 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();

     // 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...");
    

    }
    }
    `

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions