PeggyJV / sommelier-strangelove

https://sommelier.strangelove.ventures/
5 stars 4 forks source link

Cellar metrics update-datapoints - 2. iteration #587

Open henrio123 opened 2 years ago

henrio123 commented 2 years ago

Link to Figma: https://www.figma.com/file/7IAQbLyzapnrow9sIcO77P/App?node-id=2195%3A101337

  1. "Token price" 1 M change vs "ETH/BTC 50/50" 1 M change (%)

  2. Strategy performance chart block- "Token price" atm "Token price" 1 W change (%) "Token price" 1 M change (%) "Token price" 1 Y change (%) "Token price" All change (%)

  3. For chart lines, should we sum them cumulative in front-end side? "Token price" daily change historically until today (%) "ETH/BTC 50/50" daily change historically until today (%) "BTC" daily change historically until today (%) "ETH" daily change historically until today (%)

sandbochs commented 2 years ago

Use coingecko API to get 1W change price:

https://www.coingecko.com/en/api/documentation

image
id: wrapped-bitcoin
vs_currency: usd
days: 7
interval: daily

id: weth
vs_currency: usd
days: 7
interval: daily

https://api.coingecko.com/api/v3/coins/wrapped-bitcoin/market_chart?vs_currency=usd&days=7&interval=daily https://api.coingecko.com/api/v3/coins/weth/market_chart?vs_currency=usd&days=7&interval=daily

The price delta between cellar and eth/btc 50/50 should be:

cellar_interval_gain_pct - ((eth_interval_gain_pct + btc_interval_gain_pct) / 2)

function getGainPct(priceNow, priceBefore) {
  return (priceNow - priceBefore) / priceBefore
}