knowm / XChange

XChange is a Java library providing a streamlined API for interacting with 60+ Bitcoin and Altcoin exchanges providing a consistent interface for trading and accessing market data.
http://knowm.org/open-source/xchange/
MIT License
3.86k stars 1.94k forks source link

Livecoin have XBT currency (not BTC) ! Therefore XBT - BTC conflict #2535

Open CapDev12 opened 6 years ago

CapDev12 commented 6 years ago

I have XBT on the ballance

accountService.getAccountInfo().getWallets

BTC override XBT XBT lost


package org.knowm.xchange.currency; /**

public static final Currency BTC = createCurrency("BTC", "Bitcoin", null, "XBT");

npomfret commented 6 years ago

This is a common problem (see https://github.com/knowm/XChange/issues/2394), and one for which we don't have a common solution for yet.

Personally I believe the existing Currency class shouldn't have ticker symbols in in, but should just be a bunch of constants representing the abstract concept of the currency (i.e. BITCOIN or BITCOIN_CASH).

Then there could be a mapping that takes place inside each exchange implementation that translates the Currency into t a ticker symbol. The mapping would be the same for 99% of the currencies, but where an exchange uses BCC v's BCH, or XBT v's BTC you could have per-exchange mappings.

Currently it's not done consistently, some exchanges explicitly do some mapping, others don't.

This idea is quite a bit of work, and would be a breaking change.

walec51 commented 6 years ago

isn't XBT some kind of legacy thing in Livecoin and besides XBT they also use BTC in their responces / requests?

walec51 commented 6 years ago

@npomfret another possible approach would be to maintain a standardized list of codes and do proper mapping it exchange API implementations, I think many applications that use this library to this in their code as they them self need ticker codes

jnorthrup commented 6 years ago

@SunFrost @npomfret @timmolter does this commit accurately demonstrate the problem in the unit test and a desirable first pass at moving ahead in the same unit test?

https://github.com/knowm/XChange/pull/2534/commits/516c4ffc506e3eb7a922892578ecc00ff87b89df