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

_socketClient.UnifiedApi.Trading.SubscribeToOrderUpdatesAsync cause high cpu, with no trading and data subscription. #38

Open
anthonyyfu opened this issue Apr 18, 2024 · 1 comment

Comments

@anthonyyfu
Copy link

anthonyyfu commented Apr 18, 2024

I called this method (SubscribeToOrderUpdatesAsync()), and there's no trading, and of course no orderupdate callback received. wail for 20 minutes, the cpu usage will by very high. I'm using .net framework 4.7. and have tried on 3 different pc/server. all the same result. high cpu.
In this code, I firstly selected 20 symbols, and they called SubscribeToOrderUpdatesAsync() for each of them.

                var instrumentSecetedList = instrumentList.Where(record =>
                {
                    return record.Symbol.StartsWith("BTC-")
                           || record.Symbol.StartsWith("ETH-")
                           || record.Symbol.StartsWith("SOL-")
                           || record.Symbol.StartsWith("BCH-")
                           || record.Symbol.StartsWith("EOS-")
                           || record.Symbol.StartsWith("LTC-")
                           || record.Symbol.StartsWith("TRX-")
                           || record.Symbol.StartsWith("UNI-")
                           || record.Symbol.StartsWith("XLM-")
                           ;
                });

                Console.WriteLine(string.Join("\t", instrumentList.Select(a => a.Symbol)));

                foreach (var instrument in instrumentSecetedList)
                {

                    var result = _socketClient.UnifiedApi.Trading.SubscribeToOrderUpdatesAsync(OKXInstrumentType.Swap, instrument.Symbol, null, dataEvent => ExchangeTradingOrderUpdate(dataEvent.Data),
                        _clientCts.Token).Result;
                    Console.WriteLine($"{instrument} TradingApicSubscribed");

                    if (!result.Success)
                    {
                        Logger.Warn("futuresCoinUserDataUpdateResp failed! Message:(" + result.Error?.Message + ")");
                        throw new TxException("Client has not been initialized");
                    }
                }
@anthonyyfu
Copy link
Author

I'm using 32bit (x86), because I have to use a old component which have to be called in 32bit. hope it's not the reason of high cpu. 4 core/8 hyperthread, and use up to 30% of cpu whitout doing anything. Thank you for help!

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

1 participant