burakoner / OKEx.Net

Open source .Net API wrapper for the @OKEx V5 Rest API and V5 Websocket API
MIT License
86 stars 48 forks source link

Authenticated websocket handler not working. #62

Closed xxtbg closed 2 years ago

xxtbg commented 2 years ago

I am having trouble using the websocket to get order and position updates. I can see the data showing up in the debug output but it is never being sent to the callback. I have only tested on swap markets. I confirmed the issue is happening when using the demo example code as well. It seems to be having issues handling the pong messages as well. Here is a shortened version of what I am seeing in the output.

2022/04/27 17:44:58:230 | Error | OKEx WS Api | Deserialize JsonReaderException: Unexpected character encountered while parsing value: p. Path '', line 0, position 0., Path: , LineNumber: 0, LinePosition: 0. Data: pong

2022/04/27 17:39:29:524 | Warning | OKEx WS Api | Socket 1 Message not handled: pong 2022/04/27 17:39:31:810 | Warning | OKEx WS Api | Socket 1 Message not handled: { "arg": { "channel": "positions",

hadevnet commented 2 years ago

I get same error

cosinguyen commented 2 years ago

First:

  1. Okex.Net/RestObjects/Account/OkexPositionMode.cs
  2. Okex.Net/RestObjects/Account/OkexGreeksType.cs

Download this entire library. Access 2 classes above, find all models calling both, edit to Enums. Example: Okex.Net/RestObjects/Account/OkexConfiguration.cs

Change from OkexPositionMode PositionMode to Enums.OkexPositionMode PositionMode And OkexGreeksType GreeksType To Enums.OkexGreeksType GreeksType

Will help you first issue

Second: That issue happen because CryptoExchange library not handle pong message from Okx server. You can download that library and handle it. So if you want control your code, you need download this Okex library and CryptoExchange also

xxtbg commented 2 years ago

Thanks!

cosinguyen commented 2 years ago

Thanks!

or check it for second issue https://github.com/burakoner/OKEx.Net/pull/63/commits/bf90792730a3330e766c7d17dad1ddf2bcafcc79