global: chain + cointime datasets

This commit is contained in:
nym21
2025-09-13 18:26:28 +02:00
parent 38d5c7dff6
commit 01aa425f81
13 changed files with 807 additions and 305 deletions

View File

@@ -12,57 +12,57 @@
/**
* @typedef {"" |
* "BTC" |
* "Cents" |
* "coinblocks" |
* "coindays" |
* "satblocks" |
* "satdays" |
* "Count" |
* "Date" |
* "Difficulty" |
* "ExaHash / Second" |
* "Gigabytes" |
* "Hash" |
* "Index" |
* "percentage" |
* "Ratio" |
* "Sats" |
* "secs" |
* "Timestamp" |
* "tx" |
* "Type" |
* "USD/(TH/s)/day" |
* "USD/(PH/s)/day" |
* "Sats/(TH/s)/day" |
* "Sats/(PH/s)/day" |
* "USD" |
* "Version" |
* "WU" |
* "Bool" |
* "Days" |
* "%mcap" |
* "blocks" |
* "%all" |
* "%cmcap" |
* "%cp+l" |
* "%mcap" |
* "%pnl" |
* "%rcap" |
* "%self" |
* "%all" |
* "Years" |
* "H/s" |
* "Locktime" |
* "sat/vB" |
* "%pnl" |
* "constant" |
* "vB" |
* "block" |
* "id" |
* "/sec" |
* "address data" |
* "block" |
* "blocks" |
* "bool" |
* "btc" |
* "bytes" |
* "cents" |
* "coinblocks" |
* "coindays" |
* "constant" |
* "count" |
* "date" |
* "days" |
* "difficulty" |
* "epoch" |
* "gigabytes" |
* "h/s" |
* "hash" |
* "height" |
* "id" |
* "index" |
* "locktime" |
* "percentage" |
* "ratio" |
* "sat/vb" |
* "satblocks" |
* "satdays" |
* "sats" |
* "sats/(ph/s)/day" |
* "sats/(th/s)/day" |
* "sd" |
* "Epoch" |
* "Height" |
* "Bytes"
* } Unit
* "secs" |
* "timestamp" |
* "tx" |
* "type" |
* "usd" |
* "usd/(ph/s)/day" |
* "usd/(th/s)/day" |
* "vb" |
* "version" |
* "wu" |
* "years" |
* "" } Unit
*/
const localhost = window.location.hostname === "localhost";
@@ -765,16 +765,16 @@ function createUtils() {
id.endsWith("dominance")
)))
) {
setUnit("Sats");
setUnit("sats");
}
if (
(!unit || thoroughUnitCheck) &&
!id.startsWith("velocity") &&
!id.endsWith("velocity") &&
((id.includes("_btc") &&
!(id.includes("0k_btc") || id.includes("1k_btc"))) ||
id.endsWith("_btc"))
) {
setUnit("BTC");
setUnit("btc");
}
if ((!unit || thoroughUnitCheck) && id === "chain") {
setUnit("block");
@@ -798,7 +798,7 @@ function createUtils() {
id === "price_ath" ||
id === "market_cap" ||
id.startsWith("price_true_range") ||
(id.includes("_usd") && !id.startsWith("velocity")) ||
(id.includes("_usd") && !id.endsWith("velocity")) ||
id.includes("cointime_value") ||
id.endsWith("_ago") ||
id.endsWith("price_paid") ||
@@ -817,10 +817,10 @@ function createUtils() {
!id.includes("hash_rate")) ||
id === "ath")
) {
setUnit("USD");
setUnit("usd");
}
if ((!unit || thoroughUnitCheck) && id.endsWith("cents")) {
setUnit("Cents");
setUnit("cents");
}
if (
((!unit || thoroughUnitCheck) &&
@@ -843,15 +843,15 @@ function createUtils() {
id.includes("liveliness") ||
id.includes("vaultedness") ||
id == "puell_multiple" ||
id.startsWith("velocity")
id.endsWith("velocity")
) {
setUnit("Ratio");
setUnit("ratio");
}
if (
(!unit || thoroughUnitCheck) &&
(id === "price_drawdown" ||
id === "difficulty_adjustment" ||
id.startsWith("inflation_rate") ||
id.endsWith("inflation_rate") ||
id.endsWith("_oscillator") ||
id.endsWith("_dominance") ||
id.endsWith("_returns") ||
@@ -869,25 +869,25 @@ function createUtils() {
id.includes("blocks_mined") ||
(id.includes("tx_v") && !id.includes("vsize")))
) {
setUnit("Count");
setUnit("count");
}
if (
(!unit || thoroughUnitCheck) &&
(id.startsWith("hash_rate") || id.endsWith("as_hash"))
) {
setUnit("H/s");
setUnit("h/s");
}
if ((!unit || thoroughUnitCheck) && id === "pool") {
setUnit("id");
}
if ((!unit || thoroughUnitCheck) && id.includes("fee_rate")) {
setUnit("sat/vB");
setUnit("sat/vb");
}
if ((!unit || thoroughUnitCheck) && id.startsWith("is_")) {
setUnit("Bool");
setUnit("bool");
}
if ((!unit || thoroughUnitCheck) && id.endsWith("type")) {
setUnit("Type");
setUnit("type");
}
if (
(!unit || thoroughUnitCheck) &&
@@ -895,12 +895,15 @@ function createUtils() {
) {
setUnit("secs");
}
if ((!unit || thoroughUnitCheck) && id.endsWith("_per_sec")) {
setUnit("/sec");
}
if ((!unit || thoroughUnitCheck) && id.endsWith("locktime")) {
setUnit("Locktime");
setUnit("locktime");
}
if ((!unit || thoroughUnitCheck) && id.endsWith("version")) {
setUnit("Version");
setUnit("version");
}
if (
(!unit || thoroughUnitCheck) &&
@@ -910,7 +913,7 @@ function createUtils() {
id.endsWith("total_size") ||
id.includes("block_size"))
) {
setUnit("Bytes");
setUnit("bytes");
}
if ((!unit || thoroughUnitCheck) && id.endsWith("_sd")) {
setUnit("sd");
@@ -919,25 +922,25 @@ function createUtils() {
(!unit || thoroughUnitCheck) &&
(id.includes("vsize") || id.includes("vbytes"))
) {
setUnit("vB");
setUnit("vb");
}
if ((!unit || thoroughUnitCheck) && id.includes("weight")) {
setUnit("WU");
setUnit("wu");
}
if ((!unit || thoroughUnitCheck) && id.endsWith("index")) {
setUnit("Index");
setUnit("index");
}
if (
(!unit || thoroughUnitCheck) &&
(id === "date" || id === "date_fixed")
) {
setUnit("Date");
setUnit("date");
}
if (
(!unit || thoroughUnitCheck) &&
(id === "timestamp" || id === "timestamp_fixed")
) {
setUnit("Timestamp");
setUnit("timestamp");
}
if ((!unit || thoroughUnitCheck) && id.includes("coinblocks")) {
setUnit("coinblocks");
@@ -952,7 +955,7 @@ function createUtils() {
setUnit("satdays");
}
if ((!unit || thoroughUnitCheck) && id.endsWith("height")) {
setUnit("Height");
setUnit("height");
}
if ((!unit || thoroughUnitCheck) && id.endsWith("rel_to_market_cap")) {
setUnit("%mcap");
@@ -986,25 +989,25 @@ function createUtils() {
setUnit("%self");
}
if ((!unit || thoroughUnitCheck) && id.endsWith("epoch")) {
setUnit("Epoch");
setUnit("epoch");
}
if ((!unit || thoroughUnitCheck) && id === "difficulty") {
setUnit("Difficulty");
setUnit("difficulty");
}
if ((!unit || thoroughUnitCheck) && id === "blockhash") {
setUnit("Hash");
setUnit("hash");
}
if ((!unit || thoroughUnitCheck) && id.startsWith("hash_price_phs")) {
setUnit("USD/(PH/s)/day");
setUnit("usd/(ph/s)/day");
}
if ((!unit || thoroughUnitCheck) && id.startsWith("hash_price_ths")) {
setUnit("USD/(TH/s)/day");
setUnit("usd/(th/s)/day");
}
if ((!unit || thoroughUnitCheck) && id.startsWith("hash_value_phs")) {
setUnit("Sats/(PH/s)/day");
setUnit("sats/(ph/s)/day");
}
if ((!unit || thoroughUnitCheck) && id.startsWith("hash_value_ths")) {
setUnit("Sats/(TH/s)/day");
setUnit("sats/(th/s)/day");
}
if (
@@ -1013,10 +1016,10 @@ function createUtils() {
id.includes("days_since") ||
id.startsWith("days_before"))
) {
setUnit("Days");
setUnit("days");
}
if ((!unit || thoroughUnitCheck) && id.includes("years_between")) {
setUnit("Years");
setUnit("years");
}
if ((!unit || thoroughUnitCheck) && id.startsWith("constant")) {
setUnit("constant");

View File

@@ -1468,7 +1468,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
: []),
createPriceLine({
number: 1,
unit: "Ratio",
unit: "ratio",
}),
],
},
@@ -1537,7 +1537,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
}),
...createPriceLines({
numbers: [0, 1, 2, 3, 4, -1, -2, -3, -4],
unit: "Ratio",
unit: "ratio",
}),
],
},
@@ -1653,7 +1653,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
}),
...createPriceLines({
numbers: [0, 1, 2, 3, 4, -1, -2, -3, -4],
unit: "Ratio",
unit: "ratio",
}),
],
})),
@@ -2133,7 +2133,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
}),
),
createPriceLine({
unit: "Ratio",
unit: "ratio",
number: 1,
}),
],
@@ -2166,7 +2166,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
defaultActive: false,
}),
createPriceLine({
unit: "USD",
unit: "usd",
defaultActive: false,
}),
]
@@ -2191,6 +2191,16 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
color: colors.red,
defaultActive: false,
}),
...(`${fixKey(args.key)}realized_profit_to_loss_ratio` in
vecIdToIndexes
? [
createBaseSeries({
key: `${fixKey(args.key)}realized_profit_to_loss_ratio`,
name: "proft / loss",
color: colors.yellow,
}),
]
: []),
createBaseSeries({
key: `${fixKey(args.key)}total_realized_pnl`,
name: "Total",
@@ -2240,7 +2250,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
unit: "%rcap",
}),
createPriceLine({
unit: "USD",
unit: "usd",
defaultActive: false,
}),
],
@@ -2297,7 +2307,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
unit: "%rcap",
}),
createPriceLine({
unit: "USD",
unit: "usd",
}),
]),
},
@@ -2392,7 +2402,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
: []),
createPriceLine({
number: 1,
unit: "Ratio",
unit: "ratio",
}),
];
}),
@@ -2420,7 +2430,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
]);
}),
createPriceLine({
unit: "USD",
unit: "usd",
}),
],
},
@@ -2445,7 +2455,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
]);
}),
createPriceLine({
unit: "USD",
unit: "usd",
}),
],
},
@@ -2461,6 +2471,16 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
name,
color,
}),
...(`${key}realized_profit_to_loss_ratio` in
vecIdToIndexes
? [
createBaseSeries({
key: `${key}realized_profit_to_loss_ratio`,
name,
color,
}),
]
: []),
]);
}),
],
@@ -2486,7 +2506,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
}),
]),
createPriceLine({
unit: "USD",
unit: "usd",
}),
createPriceLine({
unit: "%rcap",
@@ -2538,7 +2558,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
}),
]),
createPriceLine({
unit: "USD",
unit: "usd",
}),
],
},
@@ -2573,7 +2593,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
}),
]),
createPriceLine({
unit: "USD",
unit: "usd",
}),
createPriceLine({
unit: "%mcap",
@@ -2602,7 +2622,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
]),
createPriceLine({
number: 1,
unit: "Ratio",
unit: "ratio",
}),
],
},
@@ -2633,7 +2653,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
),
createPriceLine({
number: 1,
unit: "Ratio",
unit: "ratio",
}),
],
},
@@ -2643,7 +2663,6 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
],
},
]),
{
name: "Sell Side Risk",
title: `Sell Side Risk Ratio ${title}`,
@@ -2675,6 +2694,146 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
}),
]),
},
{
name: "value",
tree: [
...(!("list" in args)
? [
{
name: "created",
title: `value created ${title}`,
bottom: list.flatMap(({ color, name, key }) => {
const normalKey = `${fixKey(key)}value_created`;
const adjKey = `${fixKey(key)}adjusted_value_created`;
return [
createBaseSeries({
key: normalKey,
name: "normal",
color: colors.emerald,
}),
...(adjKey in vecIdToIndexes
? [
createBaseSeries({
key: adjKey,
name: "adjusted",
color: colors.lime,
}),
]
: []),
];
}),
},
{
name: "destroyed",
title: `value destroyed ${title}`,
bottom: list.flatMap(({ color, name, key }) => {
const normalKey = `${fixKey(key)}value_destroyed`;
const adjKey = `${fixKey(key)}adjusted_value_destroyed`;
return [
createBaseSeries({
key: normalKey,
name: "normal",
color: colors.red,
}),
...(adjKey in vecIdToIndexes
? [
createBaseSeries({
key: adjKey,
name: "adjusted",
color: colors.pink,
}),
]
: []),
];
}),
},
]
: [
{
name: "created",
tree: [
{
name: "Normal",
title: `Value Created ${title}`,
bottom: list.flatMap(({ color, name, key }) => [
createBaseSeries({
key: `${fixKey(key)}value_created`,
name,
color,
}),
]),
},
...(() => {
const reducedList = list
.map(({ color, name, key }) => ({
color,
name,
key: `${fixKey(key)}adjusted_value_created`,
}))
.filter(({ key }) => key in vecIdToIndexes);
return reducedList.length
? [
{
name: "Adjusted",
title: `Adjusted value created ${title}`,
bottom: reducedList.map(
({ color, name, key }) =>
createBaseSeries({
key,
name,
color,
}),
),
},
]
: [];
})(),
],
},
{
name: "destroyed",
tree: [
{
name: "Normal",
title: `Value destroyed ${title}`,
bottom: list.flatMap(({ color, name, key }) => [
createBaseSeries({
key: `${fixKey(key)}value_destroyed`,
name,
color,
}),
]),
},
...(() => {
const reducedList = list
.map(({ color, name, key }) => ({
color,
name,
key: `${fixKey(key)}adjusted_value_destroyed`,
}))
.filter(({ key }) => key in vecIdToIndexes);
return reducedList.length
? [
{
name: "Adjusted",
title: `Adjusted value destroyed ${title}`,
bottom: reducedList.map(
({ color, name, key }) =>
createBaseSeries({
key,
name,
color,
}),
),
},
]
: [];
})(),
],
},
]),
],
},
],
},
{
@@ -2780,7 +2939,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
]
: []),
createPriceLine({
unit: "USD",
unit: "usd",
defaultActive: false,
}),
createPriceLine({
@@ -2885,7 +3044,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
: []),
]),
createPriceLine({
unit: "USD",
unit: "usd",
}),
createPriceLine({
unit: "%mcap",
@@ -3230,11 +3389,11 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
color: colors.red,
}),
createPriceLine({
unit: "Index",
unit: "index",
number: 61.8,
}),
createPriceLine({
unit: "Index",
unit: "index",
number: 38.2,
}),
],
@@ -3589,19 +3748,29 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
},
{
name: "Velocity",
title: "Transaction Velocity",
title: "Transactions Velocity",
bottom: [
createBaseSeries({
key: "velocity_btc",
key: "tx_btc_velocity",
name: "bitcoin",
}),
createBaseSeries({
key: "velocity_usd",
key: "tx_usd_velocity",
name: "dollars",
color: colors.emerald,
}),
],
},
{
name: "Speed",
title: "Transactions Per Second",
bottom: [
createBaseSeries({
key: "tx_per_sec",
name: "Transactions",
}),
],
},
],
},
{
@@ -3620,6 +3789,16 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
}),
],
},
{
name: "Speed",
title: "Inputs Per Second",
bottom: [
createBaseSeries({
key: "inputs_per_sec",
name: "Inputs",
}),
],
},
// {
// name: "Value",
// title: "Transaction Input Value",
@@ -3639,13 +3818,23 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
bottom: [
createAverageSeries({ concat: "output_count" }),
createCumulativeSeries({
concat: "input_count",
concat: "output_count",
}),
...createMinMaxPercentilesSeries({
concat: "output_count",
}),
],
},
{
name: "Speed",
title: "Outputs Per Second",
bottom: [
createBaseSeries({
key: "outputs_per_sec",
name: "Outputs",
}),
],
},
// {
// name: "Value",
// title: "Transaction Output Value",
@@ -4453,6 +4642,11 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
name: "Vaultedness",
color: colors.lime,
}),
createBaseSeries({
key: "activity_to_vaultedness_ratio",
name: "Liveliness / Vaultedness",
color: colors.purple,
}),
],
},
{
@@ -4494,6 +4688,53 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
}),
],
},
{
name: "Adjusted",
tree: [
{
name: "inflation",
title: "Cointime-Adjusted inflation rate",
bottom: [
createBaseSeries({
key: "inflation_rate",
name: "base",
color: colors.orange,
}),
createBaseSeries({
key: "cointime_adj_inflation_rate",
name: "base",
color: colors.purple,
}),
],
},
{
name: "Velocity",
title: "Cointime-Adjusted transactions velocity",
bottom: [
createBaseSeries({
key: "tx_btc_velocity",
name: "btc",
color: colors.orange,
}),
createBaseSeries({
key: "cointime_adj_tx_btc_velocity",
name: "adj. btc",
color: colors.red,
}),
createBaseSeries({
key: "tx_usd_velocity",
name: "usd",
color: colors.emerald,
}),
createBaseSeries({
key: "cointime_adj_tx_usd_velocity",
name: "adj. usd",
color: colors.lime,
}),
],
},
],
},
],
},
],