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:
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:
There are 4 symbols related to
BCH
asset:
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
- BREAKING: Replace string to Symbol implicit conversion with Symbol.Get() For issue #89. Update Symbol unit tests. Update versions. Update static assets and symbols. — committed to sonvister/Binance by sonvister 6 years ago
- BREAKING: Abstract Symbol/Asset Cache and redirect static definitions For issue #89. Change Asset.Cache and Symbol.Cache from IDictionary to IAssetCache and ISymbolCache respectively. Redirect static... — committed to sonvister/Binance by sonvister 6 years ago
- Refactor asset and symbol cache implementations For #89. Update static assets and symbols. — committed to sonvister/Binance by sonvister 6 years ago
0.2.0-beta4 released.
I’ve refactored to use
Set()
andClear()
and reduced interfaces toIObjectCache<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
overstring
for implicit conversion target type I am guessing it is becauseSymbol
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 usingClientOrder
validation.Having an abstraction around the
Symbol
cache query and updating, perhaps anISymbolCache
interface would be better. Then a default implementation would use the dictionary and an alternate implementation as anIDistributedCache
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: