Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket OrderBookTrading.MarketData.SubscribeToCandlesticksAsync is not working #46

Closed
sonpxc005472 opened this issue Sep 15, 2023 · 5 comments

Comments

@sonpxc005472
Copy link

sonpxc005472 commented Sep 15, 2023

I don't see any data pushed after I subscribe a candlestick

@overstartup
Copy link

Could you share your code?

@sonpxc005472
Copy link
Author

Just like the sample:
var sample_pairs = new List<string> { "BCH-USDT-SWAP", "ETH-USDT-SWAP" }; var ws = new OKXWebSocketApiClient(); foreach (var pair in sample_pairs) { await ws.OrderBookTrading.MarketData.SubscribeToCandlesticksAsync((data) => { if (data != null) { // ... Your logic here } }, pair, OkxPeriod.FiveMinutes); }
After investigating, I see OKX already changed the websocket address follow this link. Now, the address is: wss://ws.okx.com:8443/ws/v5/business. Please take a look and update the lib

@sonpxc005472
Copy link
Author

Btw, the endpoint: api.PublicData.UnitConvertAsync(symbol, quantity, price, OkxConvertType.ContractToCurrency, OkxConvertUnit.Coin). The price and unit is optional for converting contract to currency and vice versa but if a do not pass one of these params the endpoint will be failed

@burakoner
Copy link
Owner

OKX divided websocket endpoints into public, private and business. In your case you get response below

{ "event": "error", "msg": "This channel has been migrated to the '/business' URL. Please subscribe using the new URL. More details can refer to: https://www.okx.com/help-center/changes-to-v5-api-websocket-subscription-parameter-and-url", "code": "64001" }

So, this problem is nbot related only one websocket endpoint. It's related with all websocket methods. I've fixed this issue.

Thanks for your feedback

@burakoner
Copy link
Owner

Version 1.4.0 has been released. Please check these out a233227 https://www.nuget.org/packages/OKX.Api/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants