Published
Edited
Oct 13, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
md`### Code for Metalog`
Insert cell
Insert cell
Insert cell
md`### Code for Quantiles`
Insert cell
### Fetching setup
Insert cell
import {text, select} from "@jashkenas/inputs"
Insert cell
Insert cell
Insert cell
data = fetch(proxy + url, {
headers: {
Accept: "*/*",
"Accept-Language": "en-US,en;q=0.5",
Referer: "https://observablehq.com/@randomfractals/fetch"
},
//credentials: 'include',
cache: "no-store",
mode: "cors",
redirect: "follow"
})
.then((response) => {
if (!response.ok) throw new Error(response.status);
return response.json();
})
.catch((error) => {
return error;
})
Insert cell
### Flipside Query as reference
Insert cell
{
/*
WITH curve_users AS (
SELECT
DISTINCT(from_address) as user_address
FROM ethereum.transactions
WHERE to_label = 'curve fi' AND
function_name = 'deposit' AND
success = true
),

wallet_share AS (
SELECT
balance_date,
SUM(amount_usd) as total_wallet_value,
SUM(IFF(contract_address = '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', amount_usd, 0)) as total_uni_value,
SUM(IFF(contract_address = '0xd533a949740bb3306d119cc777fa900ba034cd52', amount_usd, 0)) as total_curve_value
FROM
ethereum.erc20_balances
WHERE
user_address IN (
SELECT
user_address
FROM
curve_users
) AND
balance_date >= DATEADD('day', -365, CURRENT_DATE)
GROUP BY
balance_date
),

pcts AS (
SELECT
balance_date,
(total_uni_value / total_wallet_value) * 100 AS total_uni_pct,
(total_curve_value / total_wallet_value) * 100 AS total_curve_pct
FROM
wallet_share
ORDER BY
balance_date DESC
)

select
min(total_curve_pct) AS minValue,
approx_percentile(total_curve_pct, 0.1) AS tenP,
approx_percentile(total_curve_pct, 0.5) AS fiftyP,
approx_percentile(total_curve_pct, 0.9) AS ninetyP,
max(total_curve_pct) AS maxValue
from pcts
*/
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more