nmoschkin / KuCoin.NET

KuCoin API Libraries written in .NET 6.0 and Standard 2.0
Apache License 2.0
8 stars 8 forks source link

NullReferenceExceptions - API Reliability? API Key Permissions? Better logic filters? #3

Open jmscraig opened 2 years ago

jmscraig commented 2 years ago

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.

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:

The image below shows that a.Level3OrderBook is NULL as the cause of the exception.

KuCoin NET-NREx-Line#-1124-Level3OrderBook-is-NULL

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.

Level3OrderBook-is-NULL

Root Cause? Possible Fixes?

Your thoughts on the assessment and do you have a recommendation for a fix?

Thanks!

James

KuCoinNET Sample Console Program-NULL-EXCEPTIONS-.txt

KuCoinNEt-Console-Display-After-NREx-

==== 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

nmoschkin commented 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.