-
Notifications
You must be signed in to change notification settings - Fork 139
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
#BINANCEDOTNET C# STREAM USER DATA ConnectToUserDataWebSocket need help ! #61
Comments
Try this sample code:
|
@romjab thanks for your quick reply; using BinanceExchange.API.Client;
using BinanceExchange.API.Models.WebSocket;
using BinanceExchange.API.Websockets;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace CsharpBi
{
class Program
{
static void Main(string[] args)
{
MainAsync(args).Wait();
}
static async Task MainAsync(string[] args)
{
var client = new BinanceClient(new ClientConfiguration()
{
ApiKey = "xxxx",
SecretKey = "xxxxxx",
});
UserDataWebSocketMessages userDataWebSocketMessages = new UserDataWebSocketMessages()
{
AccountUpdateMessageHandler = new BinanceWebSocketMessageHandler<BinanceAccountUpdateData>(x =>
{
Console.WriteLine(x.Balances.Find(y => y.Asset == "XRP").Free);
})
};
using (var binanceWebSocketClient = new DisposableBinanceWebSocketClient(client))
{
await binanceWebSocketClient.ConnectToUserDataWebSocket(userDataWebSocketMessages);
await Task.Delay(-1);
}
}
}
} Any suggestion ? |
The code looks like it should work. Have you tried creating an order ? the websocket only broadcasts when an order is created/executed/cancelled. Also make sure you have the latest version of the wrapper (4.2.4 as of today), since there we're multiple fixes made on the userdatawebsocket on the latest update |
also try to add the other OrderUpdateMessageHandler and TradeUpdateMessageHandler , even if you're not gonna use it. I believe you need all 3 handlers to not be null, but I could be wrong.
|
@romjab thanks for your help I apreciate ! It could be great if there is a way to broadcast live user balances on websocket without creating/excuting/canceling orders. |
I also had the same problem, you solved issue? Help me :| But it cannot update data user |
Anyone knows how to stream user data with BinanceDotNet package ? I've tried everything I looked up for example but no one works. I'm desperate -.- !
It's C# Console application :
I am stuck at ConnectToUserDataWebSocket(new UserDataWebSocketMessages), I didnt find examples about this method and how to use it ! Anyone can help me plz ?!
The text was updated successfully, but these errors were encountered: