JKorf / Bittrex.Net

A C# .Net wrapper for the Bittrex web API including all features easily accessible and usable
MIT License
141 stars 62 forks source link

SubscribeToOrderUpdatesAsync - Not receiving any data? #186

Closed pspsales closed 3 years ago

pspsales commented 3 years ago

Sample code:

Await socketClient.SubscribeToOrderUpdatesAsync(Sub(data) RecordData("OrderUpdate", New String() {data.Delta.Id, data.Delta.FillQuantity, data.Delta.Status, data.Delta.Symbol, data.Delta.Direction}))

 Private Sub RecordData(ByVal DataType As String, ByVal DataParts() As String)
        Select Case DataType
            Case "OrderUpdate"
                MessageBox.Show("An Order Update Occured")
        End Select
End Sub

Also while I'm posting this: Examples / ClientConsole / Program.cs - Line 62 - SubscribeToAccountUpdates - Does not exist.

pspsales commented 3 years ago

Update: It does seem to be receiving data, just always shows as Closed as the status message, is this normal for Bittrex?

JKorf commented 3 years ago

If it is closed that would be normal ;)

Are you sure they aren't supposed to be closed?

pspsales commented 3 years ago

Sorry for the late reply, it seems to be on/off working when I update the Nuget packages.

Full sample receiving no data & web socket closes just after creation: 2021/03/13 12:53:54:503 | Bittrex | Info | Authentication successful 2021/03/13 12:53:55:548 | Bittrex | Info | Socket 1 closed

`Public Class Form1 Private API_Key As String = "xxxxx" Private API_Secret As String = "xxxxx" Private Bittrex_socketClient As Bittrex.Net.BittrexSocketClient

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim TmpOptions As New BittrexSocketClientOptions
    TmpOptions.ApiCredentials = New ApiCredentials(API_Key, API_Secret)
    Bittrex_socketClient = New BittrexSocketClient(TmpOptions)
    TmpOptions.AutoReconnect = True
    Bittrex_SubscribeToOrderUpdates()
End Sub

Private Sub SocketListener1(ByVal OrderData() As String)
    MessageBox.Show("I Received Some Data!")
End Sub

' Subscribe To Trade Listener
Private Async Sub Bittrex_SubscribeToOrderUpdates()
    Await Bittrex_socketClient.SubscribeToOrderUpdatesAsync(Sub(data As Sockets.BittrexOrderUpdate) SocketListener1(New String() {"I Received Some Data"}))
End Sub

End Class`

pspsales commented 3 years ago

Reverting to 4.3.1 & switching to V3 class names resolves the issue currently.

Sample working (4.3.1):

`Public Class Form1 Private API_Key As String = "xxxxxx" Private API_Secret As String = "xxxxxx" Private Bittrex_socketClient As Bittrex.Net.BittrexSocketClientV3

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    Dim TmpOptions As New BittrexSocketClientV3Options
    TmpOptions.ApiCredentials = New ApiCredentials(API_Key, API_Secret)
    Bittrex_socketClient = New BittrexSocketClientV3(TmpOptions)
    TmpOptions.AutoReconnect = True
    Bittrex_SubscribeToOrderUpdates()
End Sub

Private Sub SocketListener1(ByVal OrderData() As String)
    MessageBox.Show("I Received Some Data!")
End Sub

' Subscribe To Trade Listener
Private Async Sub Bittrex_SubscribeToOrderUpdates()
    Await Bittrex_socketClient.SubscribeToOrderUpdatesAsync(Sub(data As Sockets.BittrexOrderUpdate) SocketListener1(New String() {"I Received Some Data"}))
End Sub

End Class `

Guftel commented 3 years ago

It looks like since version 5.0.0 the SocketClient stopped working. I changed my program from 4,3,1 to 5 and changed all V3-calls. Now it doesn't subscribe to any Socket anymore.

JKorf commented 3 years ago

You're right, there was an issue with the authentication in the socket client. I've resolved this in 5.0.1. Let me know if you have any other issues.

pspsales commented 3 years ago

Many many thanks, still playing with the API, it seems to work very well for data tracking :)

Shall definitely be donating soon!!

JKorf commented 3 years ago

Appreciated :)