I know this isn't the correct stack exchange site for this question but this question has to do with math and creating a formula.

I am trying to figure out how coinmarketcap calculates the bitcoin percent change for other coins. For example on ethereum:

enter image description here

I'm trying to figure out how they calculate that bottom BTC percent change 3.85%.

Their api (https://api.coinmarketcap.com/v1/ticker/?limit=100) spits out this data:

    "id": "bitcoin", 
    "name": "Bitcoin", 
    "symbol": "BTC", 
    "rank": "1", 
    "price_usd": "8397.08", 
    "price_btc": "1.0", 
    "24h_volume_usd": "8190950000.0", 
    "market_cap_usd": "141531834530", 
    "available_supply": "16854887.0", 
    "total_supply": "16854887.0", 
    "max_supply": "21000000.0", 
    "percent_change_1h": "-0.51", 
    "percent_change_24h": "1.0", 
    "percent_change_7d": "-1.88", 
    "last_updated": "1518191066"
    "id": "ethereum", 
    "name": "Ethereum", 
    "symbol": "ETH", 
    "rank": "2", 
    "price_usd": "846.675", 
    "price_btc": "0.101377", 
    "24h_volume_usd": "3096660000.0", 
    "market_cap_usd": "82559453770.0", 
    "available_supply": "97510206.0", 
    "total_supply": "97510206.0", 
    "max_supply": null, 
    "percent_change_1h": "-0.2", 
    "percent_change_24h": "4.14", 
    "percent_change_7d": "-5.14", 
    "last_updated": "1518191052"

The first number is stated in this "percent_change_24h": "4.14" but they dont show how they came up with that second number ( 3.85% ).

Is there some formula I can create with the data they provide? The data above is all they give, so it might not be possible, I've been messing with this data trying to figure it out for a while but still no solution.


  • $\begingroup$ Are the screenshot and the JSON from the api taken at slightly different time? $\endgroup$ – Dashi Feb 9 '18 at 17:27
  • $\begingroup$ @Dashi At most, a few seconds apart, are you asking because the value isnt the same? I think they round up to 2 decimals if thats the case. $\endgroup$ – cup_of Feb 9 '18 at 18:41

Let's start with their value in USD, 24 h ago:


$ (x)(1.01) = \$8397.08 \Rightarrow x = \$8313.94 $


$ (x)(1.0414) = \$846.68 \Rightarrow x = \$813.02 $

ETH/BTC 24 hours ago:

$ \frac{813.02}{8313.94}=0.097789 $


$ 0.101377 $

ETH/BTC 24hrs Change:

$(0.097789)x=0.101377 \Rightarrow = 1.03669$

Which means the increase at this point in time is: $3.669 \%$

  • $\begingroup$ your logic seems correct but this provides the increase for USD, not BTC. im looking on how they found the green number at the bottom (3.95%) $\endgroup$ – cup_of Feb 10 '18 at 2:27
  • $\begingroup$ I upvoted for your answer, i believe i can find the solution using your logic. thanks! $\endgroup$ – cup_of Feb 10 '18 at 2:31
  • 1
    $\begingroup$ @cup_of - it actually is the increase of ETH/BTC since you know what each cost 24 hours ago, you can get what their ratio was 24 hours ago, which according to the above calculations was 0.09778. I would be interested to see if there is any other answer though $\endgroup$ – Dashi Feb 10 '18 at 2:42
  • $\begingroup$ ok cool! im going to rework your logic with the current numbers and let you know $\endgroup$ – cup_of Feb 10 '18 at 2:59
  • $\begingroup$ seems like you are right, there is a very slight percent error. this is not your logic this is due to the data not being totally accurate. for example eth = 0.101377 btc. so if you times 0.101377 by the bitcoin price 8397.08 you should get the eth price 846.675 but you do not. you get 851.27077916. a percent error of -0.5399% $\endgroup$ – cup_of Feb 10 '18 at 4:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.