mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-16 21:48:10 -07:00
global: big snapshot
This commit is contained in:
@@ -9,7 +9,6 @@ import { Unit } from "../utils/units.js";
|
||||
*/
|
||||
export function createChainSection(ctx) {
|
||||
const { colors, brk, s, createPriceLine } = ctx;
|
||||
const { mergeMetricPatterns } = brk;
|
||||
const {
|
||||
blocks,
|
||||
transactions,
|
||||
@@ -33,7 +32,7 @@ export function createChainSection(ctx) {
|
||||
*/
|
||||
const fromBlockCount = (pattern, name, unit, sumColor, cumulativeColor) => [
|
||||
s({
|
||||
metric: mergeMetricPatterns(pattern.base, pattern.sum),
|
||||
metric: pattern.sum,
|
||||
name: `${name} sum`,
|
||||
color: sumColor,
|
||||
unit,
|
||||
@@ -55,7 +54,7 @@ export function createChainSection(ctx) {
|
||||
* @param {Unit} unit
|
||||
*/
|
||||
const fromBlockSize = (pattern, name, unit) => [
|
||||
s({ metric: pattern.distribution.average, name: `${name} avg`, unit }),
|
||||
s({ metric: pattern.average, name: `${name} avg`, unit }),
|
||||
s({
|
||||
metric: pattern.sum,
|
||||
name: `${name} sum`,
|
||||
@@ -85,35 +84,35 @@ export function createChainSection(ctx) {
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.distribution.percentiles.pct10,
|
||||
metric: pattern.percentiles.pct10,
|
||||
name: `${name} pct10`,
|
||||
color: colors.rose,
|
||||
unit,
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.distribution.percentiles.pct25,
|
||||
metric: pattern.percentiles.pct25,
|
||||
name: `${name} pct25`,
|
||||
color: colors.pink,
|
||||
unit,
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.distribution.percentiles.median,
|
||||
metric: pattern.percentiles.median,
|
||||
name: `${name} median`,
|
||||
color: colors.purple,
|
||||
unit,
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.distribution.percentiles.pct75,
|
||||
metric: pattern.percentiles.pct75,
|
||||
name: `${name} pct75`,
|
||||
color: colors.violet,
|
||||
unit,
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.distribution.percentiles.pct90,
|
||||
metric: pattern.percentiles.pct90,
|
||||
name: `${name} pct90`,
|
||||
color: colors.fuchsia,
|
||||
unit,
|
||||
@@ -159,35 +158,35 @@ export function createChainSection(ctx) {
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.distribution.percentiles.pct10,
|
||||
metric: pattern.percentiles.pct10,
|
||||
name: `${name} pct10`,
|
||||
color: colors.rose,
|
||||
unit,
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.distribution.percentiles.pct25,
|
||||
metric: pattern.percentiles.pct25,
|
||||
name: `${name} pct25`,
|
||||
color: colors.pink,
|
||||
unit,
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.distribution.percentiles.median,
|
||||
metric: pattern.percentiles.median,
|
||||
name: `${name} median`,
|
||||
color: colors.purple,
|
||||
unit,
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.distribution.percentiles.pct75,
|
||||
metric: pattern.percentiles.pct75,
|
||||
name: `${name} pct75`,
|
||||
color: colors.violet,
|
||||
unit,
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.distribution.percentiles.pct90,
|
||||
metric: pattern.percentiles.pct90,
|
||||
name: `${name} pct90`,
|
||||
color: colors.fuchsia,
|
||||
unit,
|
||||
@@ -335,7 +334,7 @@ export function createChainSection(ctx) {
|
||||
*/
|
||||
const fromValuePattern = (pattern, name, sumColor, cumulativeColor) => [
|
||||
s({
|
||||
metric: pattern.sats.base,
|
||||
metric: pattern.sats.sum,
|
||||
name: `${name}`,
|
||||
color: sumColor,
|
||||
unit: Unit.sats,
|
||||
@@ -348,7 +347,7 @@ export function createChainSection(ctx) {
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.bitcoin.base,
|
||||
metric: pattern.bitcoin.sum,
|
||||
name: `${name}`,
|
||||
color: sumColor,
|
||||
unit: Unit.btc,
|
||||
@@ -361,7 +360,7 @@ export function createChainSection(ctx) {
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.dollars.base,
|
||||
metric: pattern.dollars.sum,
|
||||
name: `${name}`,
|
||||
color: sumColor,
|
||||
unit: Unit.usd,
|
||||
@@ -398,7 +397,7 @@ export function createChainSection(ctx) {
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pattern.bitcoin.base,
|
||||
metric: pattern.bitcoin.sum,
|
||||
name: `${name}`,
|
||||
color: sumColor,
|
||||
unit: Unit.btc,
|
||||
@@ -439,16 +438,6 @@ export function createChainSection(ctx) {
|
||||
name: "Dominance",
|
||||
title: `Mining Dominance of ${poolName}`,
|
||||
bottom: [
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
pool._1dDominance.base,
|
||||
pool._1dDominance.sum,
|
||||
),
|
||||
name: "1d",
|
||||
color: colors.rose,
|
||||
unit: Unit.percentage,
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: pool._1wDominance,
|
||||
name: "1w",
|
||||
@@ -465,10 +454,7 @@ export function createChainSection(ctx) {
|
||||
defaultActive: false,
|
||||
}),
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
pool.dominance.base,
|
||||
pool.dominance.sum,
|
||||
),
|
||||
metric: pool.dominance,
|
||||
name: "all time",
|
||||
color: colors.teal,
|
||||
unit: Unit.percentage,
|
||||
@@ -481,10 +467,7 @@ export function createChainSection(ctx) {
|
||||
title: `Blocks mined by ${poolName}`,
|
||||
bottom: [
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
pool.blocksMined.base,
|
||||
pool.blocksMined.sum,
|
||||
),
|
||||
metric: pool.blocksMined.sum,
|
||||
name: "Sum",
|
||||
unit: Unit.count,
|
||||
}),
|
||||
@@ -650,10 +633,7 @@ export function createChainSection(ctx) {
|
||||
title: "Transaction Volume",
|
||||
bottom: [
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
transactions.volume.sentSum.sats.base,
|
||||
transactions.volume.sentSum.sats.rest,
|
||||
),
|
||||
metric: transactions.volume.sentSum.sats.sum,
|
||||
name: "Sent",
|
||||
unit: Unit.sats,
|
||||
}),
|
||||
@@ -663,10 +643,7 @@ export function createChainSection(ctx) {
|
||||
unit: Unit.btc,
|
||||
}),
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
transactions.volume.sentSum.dollars.base,
|
||||
transactions.volume.sentSum.dollars.rest,
|
||||
),
|
||||
metric: transactions.volume.sentSum.dollars,
|
||||
name: "Sent",
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
|
||||
@@ -198,7 +198,6 @@ function createRealizedCapWithExtras(ctx, list, args, useGroupName) {
|
||||
*/
|
||||
function createRealizedPnlSection(ctx, args, title) {
|
||||
const { colors, s } = ctx;
|
||||
const { mergeMetricPatterns } = ctx.brk;
|
||||
const { realized } = args.tree;
|
||||
|
||||
return [
|
||||
@@ -234,10 +233,13 @@ function createRealizedPnlSection(ctx, args, title) {
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
realized.negRealizedLoss.base,
|
||||
realized.negRealizedLoss.sum,
|
||||
),
|
||||
metric: realized.negRealizedLoss.sum,
|
||||
name: "Negative Loss",
|
||||
color: colors.red,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
s({
|
||||
metric: realized.negRealizedLoss.cumulative,
|
||||
name: "Negative Loss",
|
||||
color: colors.red,
|
||||
unit: Unit.usd,
|
||||
@@ -360,7 +362,6 @@ function createCostBasisSection(ctx, list, useGroupName, title) {
|
||||
*/
|
||||
function createActivitySection(ctx, list, useGroupName, title) {
|
||||
const { s, brk } = ctx;
|
||||
const { mergeMetricPatterns } = brk;
|
||||
|
||||
return [
|
||||
{
|
||||
@@ -371,10 +372,13 @@ function createActivitySection(ctx, list, useGroupName, title) {
|
||||
title: `Coinblocks Destroyed ${title}`,
|
||||
bottom: list.flatMap(({ color, name, tree }) => [
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
tree.activity.coinblocksDestroyed.base,
|
||||
tree.activity.coinblocksDestroyed.sum,
|
||||
),
|
||||
metric: tree.activity.coinblocksDestroyed.sum,
|
||||
name: useGroupName ? name : "Coinblocks",
|
||||
color,
|
||||
unit: Unit.coinblocks,
|
||||
}),
|
||||
s({
|
||||
metric: tree.activity.coinblocksDestroyed.cumulative,
|
||||
name: useGroupName ? name : "Coinblocks",
|
||||
color,
|
||||
unit: Unit.coinblocks,
|
||||
@@ -386,10 +390,13 @@ function createActivitySection(ctx, list, useGroupName, title) {
|
||||
title: `Coindays Destroyed ${title}`,
|
||||
bottom: list.flatMap(({ color, name, tree }) => [
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
tree.activity.coindaysDestroyed.base,
|
||||
tree.activity.coindaysDestroyed.sum,
|
||||
),
|
||||
metric: tree.activity.coindaysDestroyed.sum,
|
||||
name: useGroupName ? name : "Coindays",
|
||||
color,
|
||||
unit: Unit.coindays,
|
||||
}),
|
||||
s({
|
||||
metric: tree.activity.coindaysDestroyed.cumulative,
|
||||
name: useGroupName ? name : "Coindays",
|
||||
color,
|
||||
unit: Unit.coindays,
|
||||
|
||||
@@ -228,7 +228,12 @@ function createRealizedPriceOptions(ctx, args, title) {
|
||||
name: "price",
|
||||
title: `Realized Price ${title}`,
|
||||
top: [
|
||||
s({ metric: tree.realized.realizedPrice, name: "realized", color, unit: Unit.usd }),
|
||||
s({
|
||||
metric: tree.realized.realizedPrice,
|
||||
name: "realized",
|
||||
color,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -275,7 +280,11 @@ function createRealizedCapWithExtras(ctx, list, args, useGroupName) {
|
||||
options: { baseValue: { price: 100 } },
|
||||
colors: [colors.red, colors.green],
|
||||
}),
|
||||
createPriceLine({ unit: Unit.pctOwnMcap, defaultActive: true, number: 100 }),
|
||||
createPriceLine({
|
||||
unit: Unit.pctOwnMcap,
|
||||
defaultActive: true,
|
||||
number: 100,
|
||||
}),
|
||||
]
|
||||
: []),
|
||||
]);
|
||||
@@ -290,7 +299,6 @@ function createRealizedCapWithExtras(ctx, list, args, useGroupName) {
|
||||
*/
|
||||
function createRealizedPnlSection(ctx, args, title) {
|
||||
const { colors, s, brk } = ctx;
|
||||
const { mergeMetricPatterns } = brk;
|
||||
const { tree } = args;
|
||||
|
||||
return [
|
||||
@@ -335,10 +343,13 @@ function createRealizedPnlSection(ctx, args, title) {
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
tree.realized.negRealizedLoss.base,
|
||||
tree.realized.negRealizedLoss.sum,
|
||||
),
|
||||
metric: tree.realized.negRealizedLoss.sum,
|
||||
name: "Negative Loss",
|
||||
color: colors.red,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
s({
|
||||
metric: tree.realized.negRealizedLoss.cumulative,
|
||||
name: "Negative Loss",
|
||||
color: colors.red,
|
||||
unit: Unit.usd,
|
||||
@@ -509,7 +520,6 @@ function createCostBasisSectionBasic(ctx, list, useGroupName, title) {
|
||||
*/
|
||||
function createActivitySection(ctx, list, useGroupName, title) {
|
||||
const { s, brk } = ctx;
|
||||
const { mergeMetricPatterns } = brk;
|
||||
|
||||
return [
|
||||
{
|
||||
|
||||
@@ -167,7 +167,6 @@ function createCointimePriceWithRatioOptions(
|
||||
*/
|
||||
export function createCointimeSection(ctx) {
|
||||
const { colors, brk, s } = ctx;
|
||||
const { mergeMetricPatterns } = brk;
|
||||
const { cointime, distribution, supply } = brk.tree.computed;
|
||||
const { pricing, cap, activity, supply: cointimeSupply, adjusted } = cointime;
|
||||
const { all } = distribution.utxoCohorts;
|
||||
@@ -381,10 +380,7 @@ export function createCointimeSection(ctx) {
|
||||
bottom: [
|
||||
// Destroyed comes from the all cohort's activity
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
all.activity.coinblocksDestroyed.base,
|
||||
all.activity.coinblocksDestroyed.sum,
|
||||
),
|
||||
metric: all.activity.coinblocksDestroyed.sum,
|
||||
name: "Destroyed",
|
||||
color: colors.red,
|
||||
unit: Unit.coinblocks,
|
||||
@@ -398,10 +394,7 @@ export function createCointimeSection(ctx) {
|
||||
}),
|
||||
// Created and stored from cointime
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
activity.coinblocksCreated.base,
|
||||
activity.coinblocksCreated.sum,
|
||||
),
|
||||
metric: activity.coinblocksCreated.sum,
|
||||
name: "Created",
|
||||
color: colors.orange,
|
||||
unit: Unit.coinblocks,
|
||||
@@ -414,10 +407,7 @@ export function createCointimeSection(ctx) {
|
||||
unit: Unit.coinblocks,
|
||||
}),
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
activity.coinblocksStored.base,
|
||||
activity.coinblocksStored.sum,
|
||||
),
|
||||
metric: activity.coinblocksStored.sum,
|
||||
name: "Stored",
|
||||
color: colors.green,
|
||||
unit: Unit.coinblocks,
|
||||
@@ -464,10 +454,7 @@ export function createCointimeSection(ctx) {
|
||||
title: "Cointime-Adjusted Transactions Velocity",
|
||||
bottom: [
|
||||
s({
|
||||
metric: mergeMetricPatterns(
|
||||
supply.velocity.btc.dateindex,
|
||||
supply.velocity.btc.rest,
|
||||
),
|
||||
metric: supply.velocity.btc.dateindex,
|
||||
name: "BTC",
|
||||
color: colors.orange,
|
||||
unit: Unit.ratio,
|
||||
|
||||
Reference in New Issue
Block a user