Closed snrchang closed 6 years ago
Hi, Method not found sounds like there is a mismatch in versions somewhere. Try clear the packages folder and caches to make sure the latest versions get retrieved.
Hm, never mind that, seems to be an issue when not using .net core, some limitations in a reference library. Working on a fix.
Can you try version 3.0.6? Should be fixed in that one
yeah that sorted it, But for some reason it just closes socket.
02:28:41:162 | Info | Started symbol ticker stream for nanobtc 02:28:41:280 | Info | Disposing socket client, closing sockets
Using client = New BinanceSocketClient() Dim successDepth = client.SubscribeToSymbolTicker("NANOBTC", Sub(data)
BncWriteLog(data.BestAskPrice.ToString)
socketTick += 1
End Sub)
client.UnsubscribeFromStream(successDepth.Data)
BncWriteLog("Lost Using....")
End Using
There is no change it code from when it was previously working before update.
This is intended, when the socket client gets disposed the connection closes. It should work when you don't use Using, but instead just create the client as a variable
ok cool, weird it wasnt doing the before. Also setting the new Default options like this: `
Public BncClient As New BinanceClient
Private Async Sub BncConnectBtn_Click(sender As Object, e As EventArgs) Handles BncConnectBtn.Click
Dim defaultOptions As New BinanceClientOptions
defaultOptions.AutoTimestamp = True
defaultOptions.TradeRulesBehaviour = TradeRulesBehaviour.AutoComply
defaultOptions.LogVerbosity = CryptoExchange.Net.Logging.LogVerbosity.Debug
BncClient.SetDefaultOptions(defaultOptions) <-- Gets warning about "access of shared member will not be evaluated"
end sub`
It seems also not setting the autotimestamp since i still get the error of sever time is 1000ms defferent. Thanks
I´m not too familiar with VB.Net, but I think you´re using the static SetDefaultOptions
function on an instance.
I think what you want to be doing is BinanceClient.SetDefaultOptions(defaultOptions)
. Do this before you actually create your client and when you create a new client it should have the settings you set as default
Ahh i see, so before the update i could set autotimestamp like this
dim Client As New BinanceClient
client.AutoTimestamp = True
client.TradeRulesBehaviour = TradeRulesBehaviour.AutoComply
Now these option are not there. Also how do you stay inside the using block for symbol ticker then decide to leave? also is there a socket event handle for symbol ticker, for example if loss of internet so i can reconnect the socket. Once again thanks for all of this.
Easy reconnecting is something I still need to implement.
This will set the settings:
Dim options As New BinanceClientOptions
options.AutoTimestamp = True
options.TradeRulesBehaviour = TradeRulesBehaviour.AutoComply
options.LogVerbosity = CryptoExchange.Net.Logging.LogVerbosity.Debug
BncClient As New BinanceClient(options)
You can provide the options in the constructor of the client.
Probably easiest to use the socket client is without Using, something like:
Dim client as BinanceSocketClient
Dim subscription as BinanceStreamSubscription
Function Start()
client = New BinanceSocketClient()
subscription = client.SubscribeToSymbolTicker("NANOBTC",
Sub(data)
BncWriteLog(data.BestAskPrice.ToString)
socketTick += 1
End Sub)
End Function
Function Stop()
client.UnsubscribeFromStream(subscription.Data)
End Function
Might be some syntax errors, I never use Vb.Net
mate, thanks so much, I had coded it without using blocks. Didnt realise you can pass the options to the client in the constructor.
After half way coding cryptopia Libary i realise how much your wrappers are doing. Cryptopia is a nightmare. Thanks Jkorf
It can be quite a hassle ;) You're welcome mate!
08:22:36:288 | Error | Couldn't open socket stream: Method not found: 'System.Threading.Tasks.Task`1 WebSocket4Net.WebSocket.OpenAsync()'.
08:22:36:370 | Info | Disposing socket client, closing sockets
been working fine untill the update, wierd.