rdegges / cryptocompare

A static website that compares cryptocurrency prices for popular currencies.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Coin prices not displaying

dusward82 opened this issue · comments

I've cloned the code from the repository and when launching the browser the coin image urls display but the coin pricing data does not display. Any ideas? Here is a screenshot. https://prnt.sc/k518ii

@rdegges
Did you ever figure this out? It seems like maybe the API has changed, it's pulling in some of the data but not the rest.

"data": { "1": { "id": 1, "name": "Bitcoin", "symbol": "BTC", "website_slug": "bitcoin", "rank": 1, "circulating_supply": 17237300.0, "total_supply": 17237300.0, "max_supply": 21000000.0, "quotes": { "USD": { "price": 7037.41024674, "volume_24h": 4526809561.6146, "market_cap": 121305951646.0, "percent_change_1h": -0.45, "percent_change_24h": 1.95, "percent_change_7d": 5.94 } }, "last_updated": 1535512230 },

It's pulling in everything that is before the "quotes" nothing inside of the "quotes" area is working. Any help?

commented

Requires a few tweaks since the default CoinMarketCap API has changed.

In the app.js add "&structure=array":
axios.get(COINMARKETCAP_API_URI + "/v2/ticker/?limit=100&structure=array")

In the index.html the data will need to be traversed differently in the JSON:
<td>{{ coin.quotes.USD.price | currency }}</td> <td v-bind:style="getColor(coin.quotes.USD.percent_change_1h)"> <span v-if="coin.percent_change_1h > 0">+</span>{{ coin.quotes.USD.percent_change_1h }}% </td> <td v-bind:style="getColor(coin.quotes.USD.percent_change_24h)"> <span v-if="coin.percent_change_24h > 0">+</span>{{ coin.quotes.USD.percent_change_24h }}% </td> <td v-bind:style="getColor(coin.quotes.USD.percent_change_7d)"> <span v-if="coin.percent_change_7d > 0">+</span>{{ coin.quotes.USD.percent_change_7d }}% </td> <td>{{ coin.quotes.USD.market_cap | currency }}</td>

Fixes here: https://github.com/iwanether/cryptocompare

Working version:
screen shot 2018-09-04 at 9 45 36 am