Coder Social home page Coder Social logo

Comments (5)

viktortnk avatar viktortnk commented on July 21, 2024 1

FYI, Looks correct when chaging config to CoinGecko
CleanShot 2020-11-22 at 22 12 28@2x

from bittytax.

nanonano avatar nanonano commented on July 21, 2024

Other data sources are correct.

% bittytax_price historic USDT 07/11/2020 -ds all
1 USDT=0.00006403008998220877 BTC via CoinGecko (Tether)
1 BTC=11,817.074841427373 GBP via CoinGecko (Bitcoin)
1 USDT=£0.76 GBP
1 USDT=0.0000653 BTC via CoinPaprika (Tether)
1 BTC=11,294.5 GBP via CryptoCompare (Bitcoin)
1 USDT=£0.74 GBP
1 USDT=0.00009221 BTC via CryptoCompare (Tether)
1 BTC=11,294.5 GBP via CryptoCompare (Bitcoin)
1 USDT=£1.04 GBP

Checked the endpoint from the debug.

price: GET https://min-api.cryptocompare.com/data/all/coinlist
price: GET https://min-api.cryptocompare.com/data/histoday?aggregate=1&extraParams=BittyTax/v0.4.2&fsym=USDT&tsym=BTC&limit=2000&tryConversion=false&toTs=1777503600
price: 2020-11-07, 1 USDT=0.00009221 BTC via CryptoCompare (Tether)
1 USDT=0.00009221 BTC via CryptoCompare (Tether)
price: GET https://min-api.cryptocompare.com/data/histoday?aggregate=1&extraParams=BittyTax/v0.4.2&fsym=BTC&tsym=GBP&limit=2000&tryConversion=false&toTs=1777503600
price: 2020-11-07, 1 BTC=11,294.5 GBP via CryptoCompare (Bitcoin)
1 BTC=11,294.5 GBP via CryptoCompare (Bitcoin)
1 USDT=£1.04 GBP

Response confirms it's an data issue with CryptoCompare.

{"time":1604707200,"close":0.00009221,"high":0.00009221,"low":0.00009221,"open":0.00009221,"volumefrom":0,"volumeto":0,"conversionType":"direct","conversionSymbol":""},

I've emailed CryptoCompare to raise the issue with them.

from bittytax.

nanonano avatar nanonano commented on July 21, 2024

Had a response from CryptoCompare (thankyou guys for being so quick to respond).

We noticed that you are trying to pull the data for the USDT/BTC pair, and since we don't have any active market that is included in our CCCAGG at the moment, the price you are getting with this endpoint ( https://min-api.cryptocompare.com/data/histoday?aggregate=1&extraParams=BittyTax/v0.4.2&fsym=USDT&tsym=BTC&limit=2000&tryConversion=false&toTs=1777503600) is the last trading price from a market from 1 year ago.
There is 1 active market where USDT/BTC pair trades, it is on the Hikenex exchange, but the last trade happened 2 days ago so we wouldn't recommend using this pair for reference as it doesn't have the most recent trades.

It appears the CryptoCompare API works differently to the other data sources we use, the requested trading pair is related to that specific market pair, not an aggregation of market data.

I don't fully understand the reason why you need to do so many conversions to get a price of the certain asset as you can simply use the endpoint that will give you the direct trading price, for example:
https://min-api.cryptocompare.com/data/histoday?aggregate=1&extraParams=BittyTax/v0.4.2&fsym=USDT&tsym=GBP&limit=50&tryConversion=false&toTs=1604707200

If you want to continue using several different endpoints, to calculate the price, we recommend using the active markets and pairs with BTC as a 'fsym':
https://min-api.cryptocompare.com/data/histoday?aggregate=1&extraParams=BittyTax/v0.4.2&fsym=BTC&tsym=USDT&limit=50&tryConversion=false&toTs=1604707200
https://min-api.cryptocompare.com/data/histoday?aggregate=1&extraParams=BittyTax/v0.4.2&fsym=BTC&tsym=GBP&limit=50&tryConversion=false&toTs=1604707200
and calculate the rate between the USDT and GBP.

Recommend everyone uses CoinGecko as a data source for stable coins for the moment, until I can think of the best way to implement a fix for this.

Ideally it would be better to use direct conversions from token to GBP where available instead of using BTC prices as an intermediary.

from bittytax.

nanonano avatar nanonano commented on July 21, 2024

On further investigation it appears that the tryConversion parameter being set to False was causing issues.

The API used to get the latest price (i.e. https://min-api.cryptocompare.com/data/price?extraParams=BittyTax/v0.4.2&fsym=USDT&tsyms=GBP) does not use the tryConversion parameter (it defaults to True) and returns correct prices.

This parameter causes the endpoint to try different conversions to return more accurate data. For example, it will invert the trading pair and recalculate the price if there is more liquidity for BTC/USDT than USDT/BTC.

CryptoCompare have confirmed this (big thank you to their excellent support team). Here is a blog post that explains the tryConversion parameter.

from bittytax.

nanonano avatar nanonano commented on July 21, 2024

This fix has been delivered in BittyTax v0.4.3.

If you have any stablecoins in your transaction records (i.e. USDT, USDC, etc) it is important that you upgrade.

pip install --upgrade BittyTax

You will also need to delete the existing price data cache for CryptoCompare, this will force the bittytax accounting tool to refresh the price data.

The data cache is in your home directory as shown below.

~/.bittytax/cache/CryptoCompare.json

from bittytax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.