Trouble with ListenTradeEndpoint
ELMComputerSystemsAdmin opened this issue · 2 comments
I have integrated the Binance.API.Csharp.Client and can get the following listener to work
binanceClient.ListenTradeEndpoint("ethbtc", AggregateTradesHandler3)
So it works in principle.
However, when I try to implement user data it does not initialize:
binanceClient.ListenUserDataEndpoint(AccountHandler, TradesHandler, OrdersHandler);
(I copied the code + the three callback functions from the documentation.)
It fails silently on this line. I can step through it and can see the line where it loses control.
It gets to the following function
public async Task CallAsync(ApiMethod method, string endpoint, bool isSigned = false, string parameters = null)
and does not make it through this line.
var response = await _httpClient.SendAsync(request).ConfigureAwait(false);
I downloaded the API a few days ago and have not made any changes to the wrapper code.
Any ideas as to how to approach this? Does this part of the api work for others?
Thanks
More information
public async Task StartUserStream()
{
var result = await _apiClient.CallAsync(ApiMethod.POST, EndPoints.StartUserStream, false);
return result;
}
It seem sto run through the .CallAsync and opens the connection, gets a result, but cannot return the result to this function.
I am using VS2017, making a windows app, running on Windows 7.
I am also wondering why the signed parameter needs to be false here. How does it know it is me and give me specific account information?
Thanks
Stephen
In ConnectToUserDataWebSocket change these lines,
string data = eventData.e;
switch (data)
Then you will need to fix the account model which this will best reflect it
public class AccountUpdatedMessage
{
[JsonProperty("e")]
public string EventType { get; set; }
[JsonProperty("E")]
public long EventTime { get; set; }
[JsonProperty("m")]
public int MakerCommission { get; set; }
[JsonProperty("t")]
public int TakerCommission { get; set; }
[JsonProperty("b")]
public int BuyerCommission { get; set; }
[JsonProperty("s")]
public int SellerCommission { get; set; }
[JsonProperty("T")]
public bool CanTrade { get; set; }
[JsonProperty("w")]
public bool CanWithdraw { get; set; }
[JsonProperty("d")]
public bool CanDeposit { get; set; }
[JsonProperty("B")]
public IEnumerable Balances { get; set; }
}