Binance: Equality operation for new symbols is not working.

Hi there,

I have faced one new interesting issue. I’m having a kind of local cache of active symbols. And I have a problem with Symbol to string comparing FOR NEW SYMBOLS. There are 3 new symbols for the GNT asset.

Look at the screen: image image image

So for the new symbol GNTBTC I have to call .ToString() apart from the known ETHBTC. I think it can be related to the string interning maybe. But I was not able to find the difference between ETHBTC and GNTBTC.

Also there is the problem with the Symbol.Cache related to this issue: image There are 4 symbols related to BCH asset: image And it looks like removing part of the syncing is not working during cache updating. https://github.com/sonvister/Binance/blob/a2d43626c0a6cfc87f01596d473d1c06bdc23b3b/src/Binance/Symbol.cs#L839

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

0.2.0-beta4 released.

I’ve refactored to use Set() and Clear() and reduced interfaces to IObjectCache<T>.

Let me know what you think of these changes. I really hope this doesn’t cause issues… like with issue #60.

As for the runtime’s choice of Symbol over string for implicit conversion target type I am guessing it is because Symbol is the most specific target type.

The Symbol cache is there as a convenience for anyone referencing all symbols repeatedly since that information is relatively static and slow to query. I don’t see any reason to remove that especially since that information is still required if using ClientOrder validation.

Having an abstraction around the Symbol cache query and updating, perhaps an ISymbolCache interface would be better. Then a default implementation would use the dictionary and an alternate implementation as an IDistributedCache adapter could be created in your case.

Also, it was never a goal or requirement to create a new release for every new symbol added by Binance (others have brought this up and I have that stated in the documentation too). The static assets and symbols were just for convenience/reference. However, looking at them again, it would be better if the static properties also referenced the updated cache instances…

I may have considered ConcurrentDictionary before, but looking again at the update process, I would still choose to lock/unlock the dictionary once rather than multiple times with each access.

So, I’ll look into:

  • Creating symbol/asset cache abstraction(s) and default implementation(s).
  • Modifying static assets/symbols to reference updated cache instances.