burakoner / OKX.Api

Up-to-date, most-complete, well-organized, well-documented, easy-to-use, multi-task and multi-thread compatible OKX Cryptocurrency Exchange Rest and Websocket Api Wrapper
MIT License
39 stars 15 forks source link

websocket #37

Closed 810961186 closed 1 year ago

810961186 commented 1 year ago

use private channel subscribe back {"Data":null,"Raw":null,"Error":{"Code":null,"Message":"Authentication failed: No credentials provided for private endpoint","Data":null},"Success":false}

burakoner commented 1 year ago

Did you provide your API credentials?

810961186 commented 1 year ago

yes,I wrote it like this: var ws = new OKXWebSocketApiClient(); ws.SetApiCredentials("XXX", "XXX", "XXX");
var response=await ws.OrderBookTrading.Trade.SubscribeToOrderUpdatesAsync((data) => { if (data != null) { Console.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{JsonConvert.SerializeObject(data)}"); // ... Your logic here } }, OkxInstrumentType.Any, "", ""); Console.WriteLine($"{DateTime.Now.ToString("HH:mm:ss")}:{JsonConvert.SerializeObject(response)}"); response is {"Data":null,"Raw":null,"Error":{"Code":null,"Message":"Authentication failed: No credentials provided for private endpoint","Data":null},"Success":false}

HH-T commented 1 year ago

same result. How to fix it?

burakoner commented 1 year ago

The problem is completely different. I tried many times, there is no problem with login. But problem is related with your request. Even API docs says some parameters is optional, websocket returns message below

{ "event":"error", "msg":"channel:orders,instType:ANY,instFamily:,instId: doesn't exist", "code":"60018" }

I've fixed this situation, it shows correct error response now. I'll release new version today. I wont close this issue and wait for your response.

Thanks for feedback.