Open jmscraig opened 2 years ago
I believe this issue has been resolved. Level 3 has been completely deprecated and there may have been some correlation here.
However, notably... the Console app is not the project, it is the sample. I am not as concerned with bugs in the console app as I am with bugs in the base library.
The peculiar reason the order book was disappearing was probably a connection was reset or an order book fell out of alignment and something on the front end was catching it in an inconsistent state.
If I have just one coin or fifty coins the Console app crashes within 2-10 minutes.
Running the Console published or in debug mode consistently surfaces Null Reference Exceptions.
==== some text deleted.
A Credential problem related to the other issue posted?
Pilot error?
API Key permissions problem? The API Key used is limited to "General" read-only permissions. Trade and Withdrawal are not enabled.
Thanks! James
================ 02-10-21022 Update:
-Trying to solve a bug is a great way to learn a bit of code
-It appears that despite the Credential Tool error message the API key was saved and is working successfully
Regarding the Null Reference Exception that appear after running the console for 2 - 10 mins:
I am using either the default 10 or more commonly using just 3-4 symbols so I am testing with a lighter load than implied default of 10 symbols.
I am commonly seeing Null Reference Exceptions at these line numbers in the Console project's program.cs: 1124, 1128, 1190, 1246 and 1327. See doc image and txt file attached below.
I added an image of the KuCoinNet Console after freezing upon a Null Ref Exception while running just three symbols.
In all cases the first NullRefException is thrown at Console program.cs line # 1124 or 1128 1124 lock (a.Level3OrderBook.LockObject) >> NullReferenceException 1128 lock (b.Level3OrderBook.LockObject) >> NullReferenceException
The image below shows that a.Level3OrderBook is NULL as the cause of the exception.
This image shows that in sortobs[1] (BTC) the Level3OrderBook value was NULL so is no surprise a.Level3OrderBook.LockObject was found to be NULL.
Root Cause? Possible Fixes?
The current question is why is Observers item.Level3OrderBook frequently null and can that be fixed.
If consistent inclusion of tem.Level3OrderBook can not be fixed then the question turns to what do we do to find a reliable resolution.
What I tried so far: In Line# 1118 I added a null reference check item.Level3OrderBook as a condition for inclusion in the sortobs list but the did not work out well.
Your thoughts on the assessment and do you have a recommendation for a fix?
Thanks!
James
KuCoinNET Sample Console Program-NULL-EXCEPTIONS-.txt
==== UPDATE: Feb 12th 2022
I spent a few minutes on this again today. All of the Null Ref Exception trouble I have seen is related to the intermittent null value for Level3Orderbook within Observers and sortobs entries.
Still not sure if this is: 1) A Websock feed input quality issue from the Kucoin side 2) An artifact that occurs when exchange transaction volume for a token gets very light 3) A bug in the logic loading Observers and/or the logic loading sortobs.
Any insight?
James