provinzio / CoinTaxman

Calculate your taxes from cryptocurrency gains
GNU Affero General Public License v3.0
142 stars 31 forks source link

Implement fallback fiat prices #90

Closed Griffsano closed 2 years ago

Griffsano commented 2 years ago

Similar to the issue addressed in https://github.com/provinzio/CoinTaxman/issues/15, some exchanges do not offer trading in EUR and only rely on USD / USDT or other USD stablecoins. Hence, no historic EUR price information can be obtained, which would be necessary to compute the tax-relevant EUR prices.

Therefore, I suggest to implement a fallback fiat API that allows to convert between USD and EUR or any other fiat currency. I've searched for such APIs, and most of them require a (free) API key, which would mean that each CoinTaxman user would need to generate one. However, for example this one does not require any API key: https://github.com/fawazahmed0/currency-api#readme One possible drawback is that the prices are only updated daily. Given that fiat currencies is not as dynamic as crypto currencies, this might still be sufficient for tax calculation. Example API call: https://cdn.jsdelivr.net/gh/fawazahmed0/currency-api@1/2021-12-01/currencies/eur/usd.json

What do you think about this?

scientes commented 2 years ago

14 should fix this (almost finished) because it Supports any asset as base asset (eur, usdt, busd, gbp, btc, as long as the exchange has it)

Griffsano commented 2 years ago

Thanks, that sounds good, I'll try it once PR #16 is merged. As far as I have seen, Gate.io does not offer EUR at all, only USD, USDT, BTC and ETH for trading: https://www.gate.io/marketlist This would mean we would still need some other source to convert from USD to EUR, right? However, as I mentioned above, it probably does not matter what source we use for fiat exchange rates as they're not so dynamic and don't vary at different exchanges.

scientes commented 2 years ago

The PR Supports getting prices over multiple exchanges ( for example eur/usdt via binance and btc/usdt via gate.io) and as long as the exchange Supports ccxt and fetching ohlcv data, it can be used for fetching the price data.

provinzio commented 2 years ago

kind of duplicate of #14