mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: snapshot
This commit is contained in:
@@ -13,45 +13,17 @@
|
||||
|
||||
import { Unit } from "../../utils/units.js";
|
||||
import { line, baseline, dotsBaseline, dots } from "../series.js";
|
||||
import { satsBtcUsd, mapCohortsWithAll, flatMapCohortsWithAll } from "../shared.js";
|
||||
import {
|
||||
satsBtcUsd,
|
||||
mapCohortsWithAll,
|
||||
flatMapCohortsWithAll,
|
||||
} from "../shared.js";
|
||||
import { colors } from "../../utils/colors.js";
|
||||
|
||||
// ============================================================================
|
||||
// Shared Helpers
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Create SOPR series from realized pattern (30d > 7d > raw order)
|
||||
* @param {{ sopr: AnyMetricPattern, sopr7dEma: AnyMetricPattern, sopr30dEma: AnyMetricPattern }} realized
|
||||
* @param {string} rawName - Name for the raw SOPR series
|
||||
* @returns {AnyFetchedSeriesBlueprint[]}
|
||||
*/
|
||||
function soprSeries(realized, rawName = "SOPR") {
|
||||
return [
|
||||
baseline({
|
||||
metric: realized.sopr30dEma,
|
||||
name: "30d EMA",
|
||||
color: colors.bi.p3,
|
||||
unit: Unit.ratio,
|
||||
base: 1,
|
||||
}),
|
||||
baseline({
|
||||
metric: realized.sopr7dEma,
|
||||
name: "7d EMA",
|
||||
color: colors.bi.p2,
|
||||
unit: Unit.ratio,
|
||||
base: 1,
|
||||
}),
|
||||
dotsBaseline({
|
||||
metric: realized.sopr,
|
||||
name: rawName,
|
||||
color: colors.bi.p1,
|
||||
unit: Unit.ratio,
|
||||
base: 1,
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create grouped SOPR chart entries (Raw, 7d EMA, 30d EMA)
|
||||
* @template {{ color: Color, name: string }} T
|
||||
@@ -237,18 +209,308 @@ function coinsDestroyedTree(list, all, title) {
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// SOPR Helpers
|
||||
// Rolling Helpers
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Create SOPR series for single cohort (30d > 7d > raw order)
|
||||
* @param {UtxoCohortObject | CohortWithoutRelative} cohort
|
||||
* @returns {AnyFetchedSeriesBlueprint[]}
|
||||
* Rolling SOPR tree for single cohort
|
||||
* @param {Object} m
|
||||
* @param {AnyMetricPattern} m.s24h
|
||||
* @param {AnyMetricPattern} m.s7d
|
||||
* @param {AnyMetricPattern} m.s30d
|
||||
* @param {AnyMetricPattern} m.s1y
|
||||
* @param {AnyMetricPattern} m.ema24h7d
|
||||
* @param {AnyMetricPattern} m.ema24h30d
|
||||
* @param {(metric: string) => string} title
|
||||
* @param {string} prefix
|
||||
* @returns {PartialOptionsTree}
|
||||
*/
|
||||
function createSingleSoprSeries(cohort) {
|
||||
return soprSeries(cohort.tree.realized);
|
||||
function singleRollingSoprTree(m, title, prefix = "") {
|
||||
return [
|
||||
{
|
||||
name: "Compare",
|
||||
title: title(`Rolling ${prefix}SOPR`),
|
||||
bottom: [
|
||||
baseline({ metric: m.s24h, name: "24h", color: colors.time._24h, unit: Unit.ratio, base: 1 }),
|
||||
baseline({ metric: m.s7d, name: "7d", color: colors.time._1w, unit: Unit.ratio, base: 1 }),
|
||||
baseline({ metric: m.s30d, name: "30d", color: colors.time._1m, unit: Unit.ratio, base: 1 }),
|
||||
baseline({ metric: m.s1y, name: "1y", color: colors.time._1y, unit: Unit.ratio, base: 1 }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "24h",
|
||||
title: title(`${prefix}SOPR (24h)`),
|
||||
bottom: [
|
||||
baseline({ metric: m.ema24h30d, name: "30d EMA", color: colors.bi.p3, unit: Unit.ratio, base: 1 }),
|
||||
baseline({ metric: m.ema24h7d, name: "7d EMA", color: colors.bi.p2, unit: Unit.ratio, base: 1 }),
|
||||
dotsBaseline({ metric: m.s24h, name: "24h", color: colors.bi.p1, unit: Unit.ratio, base: 1 }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "7d",
|
||||
title: title(`${prefix}SOPR (7d)`),
|
||||
bottom: [baseline({ metric: m.s7d, name: "SOPR", unit: Unit.ratio, base: 1 })],
|
||||
},
|
||||
{
|
||||
name: "30d",
|
||||
title: title(`${prefix}SOPR (30d)`),
|
||||
bottom: [baseline({ metric: m.s30d, name: "SOPR", unit: Unit.ratio, base: 1 })],
|
||||
},
|
||||
{
|
||||
name: "1y",
|
||||
title: title(`${prefix}SOPR (1y)`),
|
||||
bottom: [baseline({ metric: m.s1y, name: "SOPR", unit: Unit.ratio, base: 1 })],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Rolling sell side risk tree for single cohort
|
||||
* @param {AnyRealizedPattern} r
|
||||
* @param {(metric: string) => string} title
|
||||
* @returns {PartialOptionsTree}
|
||||
*/
|
||||
function singleRollingSellSideRiskTree(r, title) {
|
||||
return [
|
||||
{
|
||||
name: "Compare",
|
||||
title: title("Rolling Sell Side Risk"),
|
||||
bottom: [
|
||||
line({ metric: r.sellSideRiskRatio24h, name: "24h", color: colors.time._24h, unit: Unit.ratio }),
|
||||
line({ metric: r.sellSideRiskRatio7d, name: "7d", color: colors.time._1w, unit: Unit.ratio }),
|
||||
line({ metric: r.sellSideRiskRatio30d, name: "30d", color: colors.time._1m, unit: Unit.ratio }),
|
||||
line({ metric: r.sellSideRiskRatio1y, name: "1y", color: colors.time._1y, unit: Unit.ratio }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "24h",
|
||||
title: title("Sell Side Risk (24h)"),
|
||||
bottom: [
|
||||
line({ metric: r.sellSideRiskRatio24h30dEma, name: "30d EMA", color: colors.time._1m, unit: Unit.ratio }),
|
||||
line({ metric: r.sellSideRiskRatio24h7dEma, name: "7d EMA", color: colors.time._1w, unit: Unit.ratio }),
|
||||
dots({ metric: r.sellSideRiskRatio24h, name: "Raw", color: colors.bitcoin, unit: Unit.ratio }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "7d",
|
||||
title: title("Sell Side Risk (7d)"),
|
||||
bottom: [line({ metric: r.sellSideRiskRatio7d, name: "Risk", unit: Unit.ratio })],
|
||||
},
|
||||
{
|
||||
name: "30d",
|
||||
title: title("Sell Side Risk (30d)"),
|
||||
bottom: [line({ metric: r.sellSideRiskRatio30d, name: "Risk", unit: Unit.ratio })],
|
||||
},
|
||||
{
|
||||
name: "1y",
|
||||
title: title("Sell Side Risk (1y)"),
|
||||
bottom: [line({ metric: r.sellSideRiskRatio1y, name: "Risk", unit: Unit.ratio })],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Rolling value created/destroyed tree for single cohort
|
||||
* @param {Object} m
|
||||
* @param {AnyMetricPattern} m.created24h
|
||||
* @param {AnyMetricPattern} m.created7d
|
||||
* @param {AnyMetricPattern} m.created30d
|
||||
* @param {AnyMetricPattern} m.created1y
|
||||
* @param {AnyMetricPattern} m.destroyed24h
|
||||
* @param {AnyMetricPattern} m.destroyed7d
|
||||
* @param {AnyMetricPattern} m.destroyed30d
|
||||
* @param {AnyMetricPattern} m.destroyed1y
|
||||
* @param {(metric: string) => string} title
|
||||
* @param {string} prefix
|
||||
* @returns {PartialOptionsTree}
|
||||
*/
|
||||
function singleRollingValueTree(m, title, prefix = "") {
|
||||
return [
|
||||
{
|
||||
name: "Compare",
|
||||
tree: [
|
||||
{
|
||||
name: "Created",
|
||||
title: title(`Rolling ${prefix}Value Created`),
|
||||
bottom: [
|
||||
line({ metric: m.created24h, name: "24h", color: colors.time._24h, unit: Unit.usd }),
|
||||
line({ metric: m.created7d, name: "7d", color: colors.time._1w, unit: Unit.usd }),
|
||||
line({ metric: m.created30d, name: "30d", color: colors.time._1m, unit: Unit.usd }),
|
||||
line({ metric: m.created1y, name: "1y", color: colors.time._1y, unit: Unit.usd }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Destroyed",
|
||||
title: title(`Rolling ${prefix}Value Destroyed`),
|
||||
bottom: [
|
||||
line({ metric: m.destroyed24h, name: "24h", color: colors.time._24h, unit: Unit.usd }),
|
||||
line({ metric: m.destroyed7d, name: "7d", color: colors.time._1w, unit: Unit.usd }),
|
||||
line({ metric: m.destroyed30d, name: "30d", color: colors.time._1m, unit: Unit.usd }),
|
||||
line({ metric: m.destroyed1y, name: "1y", color: colors.time._1y, unit: Unit.usd }),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "24h",
|
||||
title: title(`${prefix}Value Created & Destroyed (24h)`),
|
||||
bottom: [
|
||||
line({ metric: m.created24h, name: "Created", color: colors.usd, unit: Unit.usd }),
|
||||
line({ metric: m.destroyed24h, name: "Destroyed", color: colors.loss, unit: Unit.usd }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "7d",
|
||||
title: title(`${prefix}Value Created & Destroyed (7d)`),
|
||||
bottom: [
|
||||
line({ metric: m.created7d, name: "Created", color: colors.usd, unit: Unit.usd }),
|
||||
line({ metric: m.destroyed7d, name: "Destroyed", color: colors.loss, unit: Unit.usd }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "30d",
|
||||
title: title(`${prefix}Value Created & Destroyed (30d)`),
|
||||
bottom: [
|
||||
line({ metric: m.created30d, name: "Created", color: colors.usd, unit: Unit.usd }),
|
||||
line({ metric: m.destroyed30d, name: "Destroyed", color: colors.loss, unit: Unit.usd }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1y",
|
||||
title: title(`${prefix}Value Created & Destroyed (1y)`),
|
||||
bottom: [
|
||||
line({ metric: m.created1y, name: "Created", color: colors.usd, unit: Unit.usd }),
|
||||
line({ metric: m.destroyed1y, name: "Destroyed", color: colors.loss, unit: Unit.usd }),
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Rolling SOPR charts for grouped cohorts
|
||||
* @template {{ color: Color, name: string }} T
|
||||
* @param {readonly T[]} list
|
||||
* @param {T} all
|
||||
* @param {(item: T) => AnyMetricPattern} get24h
|
||||
* @param {(item: T) => AnyMetricPattern} get7d
|
||||
* @param {(item: T) => AnyMetricPattern} get30d
|
||||
* @param {(item: T) => AnyMetricPattern} get1y
|
||||
* @param {(metric: string) => string} title
|
||||
* @param {string} prefix
|
||||
* @returns {PartialOptionsTree}
|
||||
*/
|
||||
function groupedRollingSoprCharts(list, all, get24h, get7d, get30d, get1y, title, prefix = "") {
|
||||
return [
|
||||
{
|
||||
name: "24h",
|
||||
title: title(`${prefix}SOPR (24h)`),
|
||||
bottom: mapCohortsWithAll(list, all, (c) =>
|
||||
baseline({ metric: get24h(c), name: c.name, color: c.color, unit: Unit.ratio, base: 1 }),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "7d",
|
||||
title: title(`${prefix}SOPR (7d)`),
|
||||
bottom: mapCohortsWithAll(list, all, (c) =>
|
||||
baseline({ metric: get7d(c), name: c.name, color: c.color, unit: Unit.ratio, base: 1 }),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "30d",
|
||||
title: title(`${prefix}SOPR (30d)`),
|
||||
bottom: mapCohortsWithAll(list, all, (c) =>
|
||||
baseline({ metric: get30d(c), name: c.name, color: c.color, unit: Unit.ratio, base: 1 }),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "1y",
|
||||
title: title(`${prefix}SOPR (1y)`),
|
||||
bottom: mapCohortsWithAll(list, all, (c) =>
|
||||
baseline({ metric: get1y(c), name: c.name, color: c.color, unit: Unit.ratio, base: 1 }),
|
||||
),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Rolling sell side risk charts for grouped cohorts
|
||||
* @param {readonly CohortObject[]} list
|
||||
* @param {CohortObject} all
|
||||
* @param {(metric: string) => string} title
|
||||
* @returns {PartialOptionsTree}
|
||||
*/
|
||||
function groupedRollingSellSideRiskCharts(list, all, title) {
|
||||
return [
|
||||
{
|
||||
name: "24h",
|
||||
title: title("Sell Side Risk (24h)"),
|
||||
bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) =>
|
||||
line({ metric: tree.realized.sellSideRiskRatio24h, name, color, unit: Unit.ratio }),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "7d",
|
||||
title: title("Sell Side Risk (7d)"),
|
||||
bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) =>
|
||||
line({ metric: tree.realized.sellSideRiskRatio7d, name, color, unit: Unit.ratio }),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "30d",
|
||||
title: title("Sell Side Risk (30d)"),
|
||||
bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) =>
|
||||
line({ metric: tree.realized.sellSideRiskRatio30d, name, color, unit: Unit.ratio }),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "1y",
|
||||
title: title("Sell Side Risk (1y)"),
|
||||
bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) =>
|
||||
line({ metric: tree.realized.sellSideRiskRatio1y, name, color, unit: Unit.ratio }),
|
||||
),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Rolling value created/destroyed charts for grouped cohorts
|
||||
* @template {{ color: Color, name: string }} T
|
||||
* @param {readonly T[]} list
|
||||
* @param {T} all
|
||||
* @param {readonly { name: string, getCreated: (item: T) => AnyMetricPattern, getDestroyed: (item: T) => AnyMetricPattern }[]} windows
|
||||
* @param {(metric: string) => string} title
|
||||
* @param {string} prefix
|
||||
* @returns {PartialOptionsTree}
|
||||
*/
|
||||
function groupedRollingValueCharts(list, all, windows, title, prefix = "") {
|
||||
return [
|
||||
{
|
||||
name: "Created",
|
||||
tree: windows.map((w) => ({
|
||||
name: w.name,
|
||||
title: title(`${prefix}Value Created (${w.name})`),
|
||||
bottom: mapCohortsWithAll(list, all, (item) =>
|
||||
line({ metric: w.getCreated(item), name: item.name, color: item.color, unit: Unit.usd }),
|
||||
),
|
||||
})),
|
||||
},
|
||||
{
|
||||
name: "Destroyed",
|
||||
tree: windows.map((w) => ({
|
||||
name: w.name,
|
||||
title: title(`${prefix}Value Destroyed (${w.name})`),
|
||||
bottom: mapCohortsWithAll(list, all, (item) =>
|
||||
line({ metric: w.getDestroyed(item), name: item.name, color: item.color, unit: Unit.usd }),
|
||||
),
|
||||
})),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// SOPR Helpers
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Create SOPR tree with normal and adjusted sub-sections
|
||||
* @param {CohortAll | CohortFull | CohortWithAdjusted} cohort
|
||||
@@ -256,23 +518,21 @@ function createSingleSoprSeries(cohort) {
|
||||
* @returns {PartialOptionsTree}
|
||||
*/
|
||||
function createSingleSoprTreeWithAdjusted(cohort, title) {
|
||||
const { realized } = cohort.tree;
|
||||
const r = cohort.tree.realized;
|
||||
return [
|
||||
{
|
||||
name: "Normal",
|
||||
title: title("SOPR"),
|
||||
bottom: soprSeries(realized),
|
||||
tree: singleRollingSoprTree(
|
||||
{ s24h: r.sopr24h, s7d: r.sopr7d, s30d: r.sopr30d, s1y: r.sopr1y, ema24h7d: r.sopr24h7dEma, ema24h30d: r.sopr24h30dEma },
|
||||
title,
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "Adjusted",
|
||||
title: title("Adjusted SOPR"),
|
||||
bottom: soprSeries(
|
||||
{
|
||||
sopr: realized.adjustedSopr,
|
||||
sopr7dEma: realized.adjustedSopr7dEma,
|
||||
sopr30dEma: realized.adjustedSopr30dEma,
|
||||
},
|
||||
"Adjusted SOPR",
|
||||
tree: singleRollingSoprTree(
|
||||
{ s24h: r.adjustedSopr24h, s7d: r.adjustedSopr7d, s30d: r.adjustedSopr30d, s1y: r.adjustedSopr1y, ema24h7d: r.adjustedSopr24h7dEma, ema24h30d: r.adjustedSopr24h30dEma },
|
||||
title,
|
||||
"Adjusted ",
|
||||
),
|
||||
},
|
||||
];
|
||||
@@ -308,27 +568,56 @@ function createGroupedSoprTreeWithAdjusted(list, all, title) {
|
||||
return [
|
||||
{
|
||||
name: "Normal",
|
||||
tree: groupedSoprCharts(
|
||||
list,
|
||||
all,
|
||||
(c) => c.tree.realized.sopr,
|
||||
(c) => c.tree.realized.sopr7dEma,
|
||||
(c) => c.tree.realized.sopr30dEma,
|
||||
title,
|
||||
"",
|
||||
),
|
||||
tree: [
|
||||
...groupedSoprCharts(
|
||||
list,
|
||||
all,
|
||||
(c) => c.tree.realized.sopr,
|
||||
(c) => c.tree.realized.sopr7dEma,
|
||||
(c) => c.tree.realized.sopr30dEma,
|
||||
title,
|
||||
"",
|
||||
),
|
||||
{
|
||||
name: "Rolling",
|
||||
tree: groupedRollingSoprCharts(
|
||||
list,
|
||||
all,
|
||||
(c) => c.tree.realized.sopr24h,
|
||||
(c) => c.tree.realized.sopr7d,
|
||||
(c) => c.tree.realized.sopr30d,
|
||||
(c) => c.tree.realized.sopr1y,
|
||||
title,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Adjusted",
|
||||
tree: groupedSoprCharts(
|
||||
list,
|
||||
all,
|
||||
(c) => c.tree.realized.adjustedSopr,
|
||||
(c) => c.tree.realized.adjustedSopr7dEma,
|
||||
(c) => c.tree.realized.adjustedSopr30dEma,
|
||||
title,
|
||||
"Adjusted ",
|
||||
),
|
||||
tree: [
|
||||
...groupedSoprCharts(
|
||||
list,
|
||||
all,
|
||||
(c) => c.tree.realized.adjustedSopr,
|
||||
(c) => c.tree.realized.adjustedSopr7dEma,
|
||||
(c) => c.tree.realized.adjustedSopr30dEma,
|
||||
title,
|
||||
"Adjusted ",
|
||||
),
|
||||
{
|
||||
name: "Rolling",
|
||||
tree: groupedRollingSoprCharts(
|
||||
list,
|
||||
all,
|
||||
(c) => c.tree.realized.adjustedSopr24h,
|
||||
(c) => c.tree.realized.adjustedSopr7d,
|
||||
(c) => c.tree.realized.adjustedSopr30d,
|
||||
(c) => c.tree.realized.adjustedSopr1y,
|
||||
title,
|
||||
"Adjusted ",
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
@@ -344,6 +633,7 @@ function createGroupedSoprTreeWithAdjusted(list, all, title) {
|
||||
* @param {(metric: string) => string} args.title
|
||||
* @param {AnyFetchedSeriesBlueprint[]} [args.valueMetrics] - Optional additional value metrics
|
||||
* @param {PartialOptionsTree} [args.soprTree] - Optional SOPR tree override
|
||||
* @param {PartialOptionsTree} [args.valueRollingTree] - Optional value rolling tree override
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createActivitySection({
|
||||
@@ -351,6 +641,7 @@ export function createActivitySection({
|
||||
title,
|
||||
valueMetrics = [],
|
||||
soprTree,
|
||||
valueRollingTree,
|
||||
}) {
|
||||
const { tree, color } = cohort;
|
||||
|
||||
@@ -431,17 +722,18 @@ export function createActivitySection({
|
||||
},
|
||||
],
|
||||
},
|
||||
soprTree
|
||||
? { name: "SOPR", tree: soprTree }
|
||||
: {
|
||||
name: "SOPR",
|
||||
title: title("SOPR"),
|
||||
bottom: createSingleSoprSeries(cohort),
|
||||
},
|
||||
{
|
||||
name: "SOPR",
|
||||
tree:
|
||||
soprTree ??
|
||||
singleRollingSoprTree(
|
||||
{ s24h: tree.realized.sopr24h, s7d: tree.realized.sopr7d, s30d: tree.realized.sopr30d, s1y: tree.realized.sopr1y, ema24h7d: tree.realized.sopr24h7dEma, ema24h30d: tree.realized.sopr24h30dEma },
|
||||
title,
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "Sell Side Risk",
|
||||
title: title("Sell Side Risk Ratio"),
|
||||
bottom: createSingleSellSideRiskSeries(tree),
|
||||
tree: singleRollingSellSideRiskTree(tree.realized, title),
|
||||
},
|
||||
{
|
||||
name: "Value",
|
||||
@@ -500,6 +792,20 @@ export function createActivitySection({
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Rolling",
|
||||
tree:
|
||||
valueRollingTree ??
|
||||
singleRollingValueTree(
|
||||
{
|
||||
created24h: tree.realized.valueCreated24h, created7d: tree.realized.valueCreated7d,
|
||||
created30d: tree.realized.valueCreated30d, created1y: tree.realized.valueCreated1y,
|
||||
destroyed24h: tree.realized.valueDestroyed24h, destroyed7d: tree.realized.valueDestroyed7d,
|
||||
destroyed30d: tree.realized.valueDestroyed30d, destroyed1y: tree.realized.valueDestroyed1y,
|
||||
},
|
||||
title,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -574,6 +880,33 @@ export function createActivitySectionWithAdjusted({ cohort, title }) {
|
||||
defaultActive: false,
|
||||
}),
|
||||
],
|
||||
valueRollingTree: [
|
||||
{
|
||||
name: "Normal",
|
||||
tree: singleRollingValueTree(
|
||||
{
|
||||
created24h: tree.realized.valueCreated24h, created7d: tree.realized.valueCreated7d,
|
||||
created30d: tree.realized.valueCreated30d, created1y: tree.realized.valueCreated1y,
|
||||
destroyed24h: tree.realized.valueDestroyed24h, destroyed7d: tree.realized.valueDestroyed7d,
|
||||
destroyed30d: tree.realized.valueDestroyed30d, destroyed1y: tree.realized.valueDestroyed1y,
|
||||
},
|
||||
title,
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "Adjusted",
|
||||
tree: singleRollingValueTree(
|
||||
{
|
||||
created24h: tree.realized.adjustedValueCreated24h, created7d: tree.realized.adjustedValueCreated7d,
|
||||
created30d: tree.realized.adjustedValueCreated30d, created1y: tree.realized.adjustedValueCreated1y,
|
||||
destroyed24h: tree.realized.adjustedValueDestroyed24h, destroyed7d: tree.realized.adjustedValueDestroyed7d,
|
||||
destroyed30d: tree.realized.adjustedValueDestroyed30d, destroyed1y: tree.realized.adjustedValueDestroyed1y,
|
||||
},
|
||||
title,
|
||||
"Adjusted ",
|
||||
),
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -701,16 +1034,45 @@ export function createGroupedActivitySection({
|
||||
},
|
||||
{
|
||||
name: "SOPR",
|
||||
tree: soprTree ?? createGroupedSoprTree(list, all, title),
|
||||
tree: soprTree ?? [
|
||||
...createGroupedSoprTree(list, all, title),
|
||||
{
|
||||
name: "Rolling",
|
||||
tree: groupedRollingSoprCharts(
|
||||
list,
|
||||
all,
|
||||
(c) => c.tree.realized.sopr24h,
|
||||
(c) => c.tree.realized.sopr7d,
|
||||
(c) => c.tree.realized.sopr30d,
|
||||
(c) => c.tree.realized.sopr1y,
|
||||
title,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Sell Side Risk",
|
||||
title: title("Sell Side Risk Ratio"),
|
||||
bottom: createGroupedSellSideRiskSeries(list, all),
|
||||
tree: groupedRollingSellSideRiskCharts(list, all, title),
|
||||
},
|
||||
{
|
||||
name: "Value",
|
||||
tree: valueTree ?? createGroupedValueTree(list, all, title),
|
||||
tree: valueTree ?? [
|
||||
...createGroupedValueTree(list, all, title),
|
||||
{
|
||||
name: "Rolling",
|
||||
tree: groupedRollingValueCharts(
|
||||
list,
|
||||
all,
|
||||
[
|
||||
{ name: "24h", getCreated: (c) => c.tree.realized.valueCreated24h, getDestroyed: (c) => c.tree.realized.valueDestroyed24h },
|
||||
{ name: "7d", getCreated: (c) => c.tree.realized.valueCreated7d, getDestroyed: (c) => c.tree.realized.valueDestroyed7d },
|
||||
{ name: "30d", getCreated: (c) => c.tree.realized.valueCreated30d, getDestroyed: (c) => c.tree.realized.valueDestroyed30d },
|
||||
{ name: "1y", getCreated: (c) => c.tree.realized.valueCreated1y, getDestroyed: (c) => c.tree.realized.valueDestroyed1y },
|
||||
],
|
||||
title,
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
{ name: "Coins Destroyed", tree: coinsDestroyedTree(list, all, title) },
|
||||
],
|
||||
@@ -786,6 +1148,40 @@ function createGroupedValueTreeWithAdjusted(list, all, title) {
|
||||
],
|
||||
},
|
||||
{ name: "Breakdown", tree: valueBreakdownTree(list, all, title) },
|
||||
{
|
||||
name: "Rolling",
|
||||
tree: [
|
||||
{
|
||||
name: "Normal",
|
||||
tree: groupedRollingValueCharts(
|
||||
list,
|
||||
all,
|
||||
[
|
||||
{ name: "24h", getCreated: (c) => c.tree.realized.valueCreated24h, getDestroyed: (c) => c.tree.realized.valueDestroyed24h },
|
||||
{ name: "7d", getCreated: (c) => c.tree.realized.valueCreated7d, getDestroyed: (c) => c.tree.realized.valueDestroyed7d },
|
||||
{ name: "30d", getCreated: (c) => c.tree.realized.valueCreated30d, getDestroyed: (c) => c.tree.realized.valueDestroyed30d },
|
||||
{ name: "1y", getCreated: (c) => c.tree.realized.valueCreated1y, getDestroyed: (c) => c.tree.realized.valueDestroyed1y },
|
||||
],
|
||||
title,
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "Adjusted",
|
||||
tree: groupedRollingValueCharts(
|
||||
list,
|
||||
all,
|
||||
[
|
||||
{ name: "24h", getCreated: (c) => c.tree.realized.adjustedValueCreated24h, getDestroyed: (c) => c.tree.realized.adjustedValueDestroyed24h },
|
||||
{ name: "7d", getCreated: (c) => c.tree.realized.adjustedValueCreated7d, getDestroyed: (c) => c.tree.realized.adjustedValueDestroyed7d },
|
||||
{ name: "30d", getCreated: (c) => c.tree.realized.adjustedValueCreated30d, getDestroyed: (c) => c.tree.realized.adjustedValueDestroyed30d },
|
||||
{ name: "1y", getCreated: (c) => c.tree.realized.adjustedValueCreated1y, getDestroyed: (c) => c.tree.realized.adjustedValueDestroyed1y },
|
||||
],
|
||||
title,
|
||||
"Adjusted ",
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -804,50 +1200,6 @@ export function createGroupedActivitySectionWithAdjusted({ list, all, title }) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create sell side risk ratio series for single cohort
|
||||
* @param {{ realized: AnyRealizedPattern }} tree
|
||||
* @returns {AnyFetchedSeriesBlueprint[]}
|
||||
*/
|
||||
function createSingleSellSideRiskSeries(tree) {
|
||||
return [
|
||||
line({
|
||||
metric: tree.realized.sellSideRiskRatio30dEma,
|
||||
name: "30d EMA",
|
||||
color: colors.time._1m,
|
||||
unit: Unit.ratio,
|
||||
}),
|
||||
line({
|
||||
metric: tree.realized.sellSideRiskRatio7dEma,
|
||||
name: "7d EMA",
|
||||
color: colors.time._1w,
|
||||
unit: Unit.ratio,
|
||||
}),
|
||||
dots({
|
||||
metric: tree.realized.sellSideRiskRatio,
|
||||
name: "Raw",
|
||||
color: colors.bitcoin,
|
||||
unit: Unit.ratio,
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create sell side risk ratio series for grouped cohorts
|
||||
* @param {readonly CohortObject[]} list
|
||||
* @param {CohortObject} all
|
||||
* @returns {AnyFetchedSeriesBlueprint[]}
|
||||
*/
|
||||
function createGroupedSellSideRiskSeries(list, all) {
|
||||
return flatMapCohortsWithAll(list, all, ({ name, color, tree }) => [
|
||||
line({
|
||||
metric: tree.realized.sellSideRiskRatio,
|
||||
name,
|
||||
color,
|
||||
unit: Unit.ratio,
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create value created & destroyed series for single cohort
|
||||
|
||||
@@ -238,7 +238,11 @@ export function createGroupedCostBasisSection({ list, all, title }) {
|
||||
* @param {{ list: readonly (CohortAll | CohortFull | CohortWithPercentiles)[], all: CohortAll, title: (metric: string) => string }} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedCostBasisSectionWithPercentiles({ list, all, title }) {
|
||||
export function createGroupedCostBasisSectionWithPercentiles({
|
||||
list,
|
||||
all,
|
||||
title,
|
||||
}) {
|
||||
return {
|
||||
name: "Cost Basis",
|
||||
tree: [
|
||||
|
||||
@@ -89,17 +89,15 @@ export function buildCohortData() {
|
||||
});
|
||||
|
||||
// Age range cohorts
|
||||
const dateRange = entries(utxoCohorts.ageRange).map(
|
||||
([key, tree], i, arr) => {
|
||||
const names = AGE_RANGE_NAMES[key];
|
||||
return {
|
||||
name: names.short,
|
||||
title: `UTXOs ${names.long}`,
|
||||
color: colors.at(i, arr.length),
|
||||
tree,
|
||||
};
|
||||
},
|
||||
);
|
||||
const dateRange = entries(utxoCohorts.ageRange).map(([key, tree], i, arr) => {
|
||||
const names = AGE_RANGE_NAMES[key];
|
||||
return {
|
||||
name: names.short,
|
||||
title: `UTXOs ${names.long}`,
|
||||
color: colors.at(i, arr.length),
|
||||
tree,
|
||||
};
|
||||
});
|
||||
|
||||
// Epoch cohorts
|
||||
const epoch = entries(utxoCohorts.epoch).map(([key, tree], i, arr) => {
|
||||
|
||||
@@ -15,7 +15,13 @@
|
||||
|
||||
import { Unit } from "../../utils/units.js";
|
||||
import { line, baseline } from "../series.js";
|
||||
import { satsBtcUsd, satsBtcUsdBaseline, mapCohorts, mapCohortsWithAll, flatMapCohortsWithAll } from "../shared.js";
|
||||
import {
|
||||
satsBtcUsd,
|
||||
satsBtcUsdBaseline,
|
||||
mapCohorts,
|
||||
mapCohortsWithAll,
|
||||
flatMapCohortsWithAll,
|
||||
} from "../shared.js";
|
||||
import { colors } from "../../utils/colors.js";
|
||||
import { priceLines } from "../constants.js";
|
||||
|
||||
@@ -26,10 +32,27 @@ import { priceLines } from "../constants.js";
|
||||
*/
|
||||
function baseSupplySeries(tree) {
|
||||
return [
|
||||
...satsBtcUsd({ pattern: tree.supply.total, name: "Total", color: colors.default }),
|
||||
...satsBtcUsd({ pattern: tree.unrealized.supplyInProfit, name: "In Profit", color: colors.profit }),
|
||||
...satsBtcUsd({ pattern: tree.unrealized.supplyInLoss, name: "In Loss", color: colors.loss }),
|
||||
...satsBtcUsd({ pattern: tree.supply.halved, name: "Halved", color: colors.gray, style: 4 }),
|
||||
...satsBtcUsd({
|
||||
pattern: tree.supply.total,
|
||||
name: "Total",
|
||||
color: colors.default,
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: tree.unrealized.supplyInProfit,
|
||||
name: "In Profit",
|
||||
color: colors.profit,
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: tree.unrealized.supplyInLoss,
|
||||
name: "In Loss",
|
||||
color: colors.loss,
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: tree.supply.halved,
|
||||
name: "Halved",
|
||||
color: colors.gray,
|
||||
style: 4,
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -40,8 +63,18 @@ function baseSupplySeries(tree) {
|
||||
*/
|
||||
function ownSupplyPctSeries(tree) {
|
||||
return [
|
||||
line({ metric: tree.relative.supplyInProfitRelToOwnSupply, name: "In Profit", color: colors.profit, unit: Unit.pctOwn }),
|
||||
line({ metric: tree.relative.supplyInLossRelToOwnSupply, name: "In Loss", color: colors.loss, unit: Unit.pctOwn }),
|
||||
line({
|
||||
metric: tree.relative.supplyInProfitRelToOwnSupply,
|
||||
name: "In Profit",
|
||||
color: colors.profit,
|
||||
unit: Unit.pctOwn,
|
||||
}),
|
||||
line({
|
||||
metric: tree.relative.supplyInLossRelToOwnSupply,
|
||||
name: "In Loss",
|
||||
color: colors.loss,
|
||||
unit: Unit.pctOwn,
|
||||
}),
|
||||
...priceLines({ numbers: [100, 50, 0], unit: Unit.pctOwn }),
|
||||
];
|
||||
}
|
||||
@@ -53,9 +86,24 @@ function ownSupplyPctSeries(tree) {
|
||||
*/
|
||||
function circulatingSupplyPctSeries(tree) {
|
||||
return [
|
||||
line({ metric: tree.relative.supplyRelToCirculatingSupply, name: "Total", color: colors.default, unit: Unit.pctSupply }),
|
||||
line({ metric: tree.relative.supplyInProfitRelToCirculatingSupply, name: "In Profit", color: colors.profit, unit: Unit.pctSupply }),
|
||||
line({ metric: tree.relative.supplyInLossRelToCirculatingSupply, name: "In Loss", color: colors.loss, unit: Unit.pctSupply }),
|
||||
line({
|
||||
metric: tree.relative.supplyRelToCirculatingSupply,
|
||||
name: "Total",
|
||||
color: colors.default,
|
||||
unit: Unit.pctSupply,
|
||||
}),
|
||||
line({
|
||||
metric: tree.relative.supplyInProfitRelToCirculatingSupply,
|
||||
name: "In Profit",
|
||||
color: colors.profit,
|
||||
unit: Unit.pctSupply,
|
||||
}),
|
||||
line({
|
||||
metric: tree.relative.supplyInLossRelToCirculatingSupply,
|
||||
name: "In Loss",
|
||||
color: colors.loss,
|
||||
unit: Unit.pctSupply,
|
||||
}),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -99,7 +147,12 @@ function grouped30dUtxoCountChangeChart(list, all, title) {
|
||||
name: "UTXO Count",
|
||||
title: title("UTXO Count 30d Change"),
|
||||
bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) =>
|
||||
baseline({ metric: tree.outputs.utxoCount30dChange, name, unit: Unit.count, color }),
|
||||
baseline({
|
||||
metric: tree.outputs.utxoCount30dChange,
|
||||
name,
|
||||
unit: Unit.count,
|
||||
color,
|
||||
}),
|
||||
),
|
||||
};
|
||||
}
|
||||
@@ -157,7 +210,12 @@ function singleAddressCountChart(cohort, title) {
|
||||
name: "Address Count",
|
||||
title: title("Address Count"),
|
||||
bottom: [
|
||||
line({ metric: cohort.addrCount.count, name: "Address Count", color: cohort.color, unit: Unit.count }),
|
||||
line({
|
||||
metric: cohort.addrCount.count,
|
||||
name: "Address Count",
|
||||
color: cohort.color,
|
||||
unit: Unit.count,
|
||||
}),
|
||||
],
|
||||
};
|
||||
}
|
||||
@@ -271,10 +329,27 @@ function createSingleSupplySeriesWithRelative(cohort) {
|
||||
function createSingleSupplySeriesWithOwnSupply(cohort) {
|
||||
const { tree } = cohort;
|
||||
return [
|
||||
...satsBtcUsd({ pattern: tree.unrealized.supplyInProfit, name: "In Profit", color: colors.profit }),
|
||||
...satsBtcUsd({ pattern: tree.unrealized.supplyInLoss, name: "In Loss", color: colors.loss }),
|
||||
...satsBtcUsd({ pattern: tree.supply.total, name: "Total", color: colors.default }),
|
||||
...satsBtcUsd({ pattern: tree.supply.halved, name: "Halved", color: colors.gray, style: 4 }),
|
||||
...satsBtcUsd({
|
||||
pattern: tree.unrealized.supplyInProfit,
|
||||
name: "In Profit",
|
||||
color: colors.profit,
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: tree.unrealized.supplyInLoss,
|
||||
name: "In Loss",
|
||||
color: colors.loss,
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: tree.supply.total,
|
||||
name: "Total",
|
||||
color: colors.default,
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: tree.supply.halved,
|
||||
name: "Halved",
|
||||
color: colors.gray,
|
||||
style: 4,
|
||||
}),
|
||||
...ownSupplyPctSeries(tree),
|
||||
];
|
||||
}
|
||||
@@ -518,7 +593,12 @@ export function createGroupedHoldingsSectionAddress({ list, all, title }) {
|
||||
name: "Address Count",
|
||||
title: title("Address Count 30d Change"),
|
||||
bottom: mapCohortsWithAll(list, all, ({ name, color, addrCount }) =>
|
||||
baseline({ metric: addrCount._30dChange, name, unit: Unit.count, color }),
|
||||
baseline({
|
||||
metric: addrCount._30dChange,
|
||||
name,
|
||||
unit: Unit.count,
|
||||
color,
|
||||
}),
|
||||
),
|
||||
},
|
||||
],
|
||||
@@ -532,7 +612,11 @@ export function createGroupedHoldingsSectionAddress({ list, all, title }) {
|
||||
* @param {{ list: readonly AddressCohortObject[], all: CohortAll, title: (metric: string) => string }} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedHoldingsSectionAddressAmount({ list, all, title }) {
|
||||
export function createGroupedHoldingsSectionAddressAmount({
|
||||
list,
|
||||
all,
|
||||
title,
|
||||
}) {
|
||||
return {
|
||||
name: "Holdings",
|
||||
tree: [
|
||||
@@ -635,7 +719,12 @@ export function createGroupedHoldingsSectionAddressAmount({ list, all, title })
|
||||
name: "Address Count",
|
||||
title: title("Address Count 30d Change"),
|
||||
bottom: mapCohortsWithAll(list, all, ({ name, color, addrCount }) =>
|
||||
baseline({ metric: addrCount._30dChange, name, unit: Unit.count, color }),
|
||||
baseline({
|
||||
metric: addrCount._30dChange,
|
||||
name,
|
||||
unit: Unit.count,
|
||||
color,
|
||||
}),
|
||||
),
|
||||
},
|
||||
],
|
||||
@@ -703,7 +792,11 @@ export function createGroupedHoldingsSection({ list, all, title }) {
|
||||
* @param {{ list: readonly (CohortAgeRange | CohortBasicWithoutMarketCap)[], all: CohortAll, title: (metric: string) => string }} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedHoldingsSectionWithOwnSupply({ list, all, title }) {
|
||||
export function createGroupedHoldingsSectionWithOwnSupply({
|
||||
list,
|
||||
all,
|
||||
title,
|
||||
}) {
|
||||
return {
|
||||
name: "Holdings",
|
||||
tree: [
|
||||
|
||||
@@ -321,7 +321,12 @@ export function createAddressCohortFolder(cohort) {
|
||||
* @param {CohortGroupFull} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedCohortFolderFull({ name, title: groupTitle, list, all }) {
|
||||
export function createGroupedCohortFolderFull({
|
||||
name,
|
||||
title: groupTitle,
|
||||
list,
|
||||
all,
|
||||
}) {
|
||||
const title = formatCohortTitle(groupTitle);
|
||||
return {
|
||||
name: name || "all",
|
||||
@@ -340,7 +345,12 @@ export function createGroupedCohortFolderFull({ name, title: groupTitle, list, a
|
||||
* @param {CohortGroupWithAdjusted} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedCohortFolderWithAdjusted({ name, title: groupTitle, list, all }) {
|
||||
export function createGroupedCohortFolderWithAdjusted({
|
||||
name,
|
||||
title: groupTitle,
|
||||
list,
|
||||
all,
|
||||
}) {
|
||||
const title = formatCohortTitle(groupTitle);
|
||||
return {
|
||||
name: name || "all",
|
||||
@@ -359,7 +369,12 @@ export function createGroupedCohortFolderWithAdjusted({ name, title: groupTitle,
|
||||
* @param {CohortGroupWithNuplPercentiles} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedCohortFolderWithNupl({ name, title: groupTitle, list, all }) {
|
||||
export function createGroupedCohortFolderWithNupl({
|
||||
name,
|
||||
title: groupTitle,
|
||||
list,
|
||||
all,
|
||||
}) {
|
||||
const title = formatCohortTitle(groupTitle);
|
||||
return {
|
||||
name: name || "all",
|
||||
@@ -378,7 +393,12 @@ export function createGroupedCohortFolderWithNupl({ name, title: groupTitle, lis
|
||||
* @param {CohortGroupLongTerm} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedCohortFolderLongTerm({ name, title: groupTitle, list, all }) {
|
||||
export function createGroupedCohortFolderLongTerm({
|
||||
name,
|
||||
title: groupTitle,
|
||||
list,
|
||||
all,
|
||||
}) {
|
||||
const title = formatCohortTitle(groupTitle);
|
||||
return {
|
||||
name: name || "all",
|
||||
@@ -397,7 +417,12 @@ export function createGroupedCohortFolderLongTerm({ name, title: groupTitle, lis
|
||||
* @param {CohortGroupAgeRange} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedCohortFolderAgeRange({ name, title: groupTitle, list, all }) {
|
||||
export function createGroupedCohortFolderAgeRange({
|
||||
name,
|
||||
title: groupTitle,
|
||||
list,
|
||||
all,
|
||||
}) {
|
||||
const title = formatCohortTitle(groupTitle);
|
||||
return {
|
||||
name: name || "all",
|
||||
@@ -406,7 +431,11 @@ export function createGroupedCohortFolderAgeRange({ name, title: groupTitle, lis
|
||||
createGroupedValuationSectionWithOwnMarketCap({ list, all, title }),
|
||||
createGroupedPricesSection({ list, all, title }),
|
||||
createGroupedCostBasisSectionWithPercentiles({ list, all, title }),
|
||||
createGroupedProfitabilitySectionWithInvestedCapitalPct({ list, all, title }),
|
||||
createGroupedProfitabilitySectionWithInvestedCapitalPct({
|
||||
list,
|
||||
all,
|
||||
title,
|
||||
}),
|
||||
createGroupedActivitySection({ list, all, title }),
|
||||
],
|
||||
};
|
||||
@@ -416,7 +445,12 @@ export function createGroupedCohortFolderAgeRange({ name, title: groupTitle, lis
|
||||
* @param {CohortGroupMinAge} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedCohortFolderMinAge({ name, title: groupTitle, list, all }) {
|
||||
export function createGroupedCohortFolderMinAge({
|
||||
name,
|
||||
title: groupTitle,
|
||||
list,
|
||||
all,
|
||||
}) {
|
||||
const title = formatCohortTitle(groupTitle);
|
||||
return {
|
||||
name: name || "all",
|
||||
@@ -435,7 +469,12 @@ export function createGroupedCohortFolderMinAge({ name, title: groupTitle, list,
|
||||
* @param {CohortGroupBasicWithMarketCap} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedCohortFolderBasicWithMarketCap({ name, title: groupTitle, list, all }) {
|
||||
export function createGroupedCohortFolderBasicWithMarketCap({
|
||||
name,
|
||||
title: groupTitle,
|
||||
list,
|
||||
all,
|
||||
}) {
|
||||
const title = formatCohortTitle(groupTitle);
|
||||
return {
|
||||
name: name || "all",
|
||||
@@ -454,7 +493,12 @@ export function createGroupedCohortFolderBasicWithMarketCap({ name, title: group
|
||||
* @param {CohortGroupBasicWithoutMarketCap} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedCohortFolderBasicWithoutMarketCap({ name, title: groupTitle, list, all }) {
|
||||
export function createGroupedCohortFolderBasicWithoutMarketCap({
|
||||
name,
|
||||
title: groupTitle,
|
||||
list,
|
||||
all,
|
||||
}) {
|
||||
const title = formatCohortTitle(groupTitle);
|
||||
return {
|
||||
name: name || "all",
|
||||
@@ -463,7 +507,11 @@ export function createGroupedCohortFolderBasicWithoutMarketCap({ name, title: gr
|
||||
createGroupedValuationSection({ list, all, title }),
|
||||
createGroupedPricesSection({ list, all, title }),
|
||||
createGroupedCostBasisSection({ list, all, title }),
|
||||
createGroupedProfitabilitySectionBasicWithInvestedCapitalPct({ list, all, title }),
|
||||
createGroupedProfitabilitySectionBasicWithInvestedCapitalPct({
|
||||
list,
|
||||
all,
|
||||
title,
|
||||
}),
|
||||
createGroupedActivitySection({ list, all, title }),
|
||||
],
|
||||
};
|
||||
@@ -473,7 +521,12 @@ export function createGroupedCohortFolderBasicWithoutMarketCap({ name, title: gr
|
||||
* @param {CohortGroupAddress} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedCohortFolderAddress({ name, title: groupTitle, list, all }) {
|
||||
export function createGroupedCohortFolderAddress({
|
||||
name,
|
||||
title: groupTitle,
|
||||
list,
|
||||
all,
|
||||
}) {
|
||||
const title = formatCohortTitle(groupTitle);
|
||||
return {
|
||||
name: name || "all",
|
||||
@@ -482,7 +535,11 @@ export function createGroupedCohortFolderAddress({ name, title: groupTitle, list
|
||||
createGroupedValuationSection({ list, all, title }),
|
||||
createGroupedPricesSection({ list, all, title }),
|
||||
createGroupedCostBasisSection({ list, all, title }),
|
||||
createGroupedProfitabilitySectionBasicWithInvestedCapitalPct({ list, all, title }),
|
||||
createGroupedProfitabilitySectionBasicWithInvestedCapitalPct({
|
||||
list,
|
||||
all,
|
||||
title,
|
||||
}),
|
||||
createGroupedActivitySection({ list, all, title }),
|
||||
],
|
||||
};
|
||||
@@ -492,7 +549,12 @@ export function createGroupedCohortFolderAddress({ name, title: groupTitle, list
|
||||
* @param {CohortGroupWithoutRelative} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedCohortFolderWithoutRelative({ name, title: groupTitle, list, all }) {
|
||||
export function createGroupedCohortFolderWithoutRelative({
|
||||
name,
|
||||
title: groupTitle,
|
||||
list,
|
||||
all,
|
||||
}) {
|
||||
const title = formatCohortTitle(groupTitle);
|
||||
return {
|
||||
name: name || "all",
|
||||
@@ -511,7 +573,12 @@ export function createGroupedCohortFolderWithoutRelative({ name, title: groupTit
|
||||
* @param {AddressCohortGroupObject} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedAddressCohortFolder({ name, title: groupTitle, list, all }) {
|
||||
export function createGroupedAddressCohortFolder({
|
||||
name,
|
||||
title: groupTitle,
|
||||
list,
|
||||
all,
|
||||
}) {
|
||||
const title = formatCohortTitle(groupTitle);
|
||||
return {
|
||||
name: name || "all",
|
||||
|
||||
@@ -28,10 +28,30 @@ function createCompareChart(tree, title) {
|
||||
name: "Compare",
|
||||
title: title("Prices"),
|
||||
top: [
|
||||
price({ metric: tree.realized.realizedPrice, name: "Realized", color: colors.realized }),
|
||||
price({ metric: tree.realized.investorPrice, name: "Investor", color: colors.investor }),
|
||||
price({ metric: tree.realized.upperPriceBand, name: "I²/R", color: colors.stat.max, style: 2, defaultActive: false }),
|
||||
price({ metric: tree.realized.lowerPriceBand, name: "R²/I", color: colors.stat.min, style: 2, defaultActive: false }),
|
||||
price({
|
||||
metric: tree.realized.realizedPrice,
|
||||
name: "Realized",
|
||||
color: colors.realized,
|
||||
}),
|
||||
price({
|
||||
metric: tree.realized.investorPrice,
|
||||
name: "Investor",
|
||||
color: colors.investor,
|
||||
}),
|
||||
price({
|
||||
metric: tree.realized.upperPriceBand,
|
||||
name: "I²/R",
|
||||
color: colors.stat.max,
|
||||
style: 2,
|
||||
defaultActive: false,
|
||||
}),
|
||||
price({
|
||||
metric: tree.realized.lowerPriceBand,
|
||||
name: "R²/I",
|
||||
color: colors.stat.min,
|
||||
style: 2,
|
||||
defaultActive: false,
|
||||
}),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,7 +6,13 @@ import { Unit } from "../../utils/units.js";
|
||||
import { line, baseline, dots, dotsBaseline } from "../series.js";
|
||||
import { colors } from "../../utils/colors.js";
|
||||
import { priceLine, priceLines } from "../constants.js";
|
||||
import { satsBtcUsd, satsBtcUsdFrom, mapCohorts, mapCohortsWithAll, flatMapCohortsWithAll } from "../shared.js";
|
||||
import {
|
||||
satsBtcUsd,
|
||||
satsBtcUsdFrom,
|
||||
mapCohorts,
|
||||
mapCohortsWithAll,
|
||||
flatMapCohortsWithAll,
|
||||
} from "../shared.js";
|
||||
|
||||
// ============================================================================
|
||||
// Core Series Builders (Composable Primitives)
|
||||
@@ -28,13 +34,33 @@ import { satsBtcUsd, satsBtcUsdFrom, mapCohorts, mapCohortsWithAll, flatMapCohor
|
||||
*/
|
||||
function pnlLines(metrics, unit) {
|
||||
const series = [
|
||||
line({ metric: metrics.profit, name: "Profit", color: colors.profit, unit }),
|
||||
line({
|
||||
metric: metrics.profit,
|
||||
name: "Profit",
|
||||
color: colors.profit,
|
||||
unit,
|
||||
}),
|
||||
line({ metric: metrics.loss, name: "Loss", color: colors.loss, unit }),
|
||||
];
|
||||
if (metrics.total) {
|
||||
series.push(line({ metric: metrics.total, name: "Total", color: colors.default, unit }));
|
||||
series.push(
|
||||
line({
|
||||
metric: metrics.total,
|
||||
name: "Total",
|
||||
color: colors.default,
|
||||
unit,
|
||||
}),
|
||||
);
|
||||
}
|
||||
series.push(line({ metric: metrics.negLoss, name: "Negative Loss", color: colors.loss, unit, defaultActive: false }));
|
||||
series.push(
|
||||
line({
|
||||
metric: metrics.negLoss,
|
||||
name: "Negative Loss",
|
||||
color: colors.loss,
|
||||
unit,
|
||||
defaultActive: false,
|
||||
}),
|
||||
);
|
||||
return series;
|
||||
}
|
||||
|
||||
@@ -83,7 +109,10 @@ function getUnrealizedMetrics(tree) {
|
||||
*/
|
||||
function unrealizedUsd(m) {
|
||||
return [
|
||||
...pnlLines({ profit: m.profit, loss: m.loss, negLoss: m.negLoss, total: m.total }, Unit.usd),
|
||||
...pnlLines(
|
||||
{ profit: m.profit, loss: m.loss, negLoss: m.negLoss, total: m.total },
|
||||
Unit.usd,
|
||||
),
|
||||
priceLine({ unit: Unit.usd, defaultActive: false }),
|
||||
];
|
||||
}
|
||||
@@ -708,6 +737,166 @@ function sentInPnlTree(tree, title) {
|
||||
];
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Rolling Realized Helpers
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Rolling realized value tree for single cohort (available on all realized patterns)
|
||||
* @param {AnyRealizedPattern} r
|
||||
* @param {(metric: string) => string} title
|
||||
* @returns {PartialOptionsTree}
|
||||
*/
|
||||
function singleRollingRealizedValueTree(r, title) {
|
||||
return [
|
||||
{
|
||||
name: "Compare",
|
||||
title: title("Rolling Realized Value"),
|
||||
bottom: [
|
||||
line({ metric: r.realizedValue24h, name: "24h", color: colors.time._24h, unit: Unit.usd }),
|
||||
line({ metric: r.realizedValue7d, name: "7d", color: colors.time._1w, unit: Unit.usd }),
|
||||
line({ metric: r.realizedValue30d, name: "30d", color: colors.time._1m, unit: Unit.usd }),
|
||||
line({ metric: r.realizedValue1y, name: "1y", color: colors.time._1y, unit: Unit.usd }),
|
||||
],
|
||||
},
|
||||
{ name: "24h", title: title("Realized Value (24h)"), bottom: [line({ metric: r.realizedValue24h, name: "Value", unit: Unit.usd })] },
|
||||
{ name: "7d", title: title("Realized Value (7d)"), bottom: [line({ metric: r.realizedValue7d, name: "Value", unit: Unit.usd })] },
|
||||
{ name: "30d", title: title("Realized Value (30d)"), bottom: [line({ metric: r.realizedValue30d, name: "Value", unit: Unit.usd })] },
|
||||
{ name: "1y", title: title("Realized Value (1y)"), bottom: [line({ metric: r.realizedValue1y, name: "Value", unit: Unit.usd })] },
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Rolling realized tree with P/L for single cohort (for RealizedWithExtras patterns)
|
||||
* @param {RealizedWithExtras} r
|
||||
* @param {(metric: string) => string} title
|
||||
* @returns {PartialOptionsTree}
|
||||
*/
|
||||
function singleRollingRealizedTreeWithExtras(r, title) {
|
||||
return [
|
||||
{
|
||||
name: "Value",
|
||||
tree: singleRollingRealizedValueTree(r, title),
|
||||
},
|
||||
{
|
||||
name: "Profit",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: title("Rolling Realized Profit"),
|
||||
bottom: [
|
||||
line({ metric: r.realizedProfit24h, name: "24h", color: colors.time._24h, unit: Unit.usd }),
|
||||
line({ metric: r.realizedProfit7d, name: "7d", color: colors.time._1w, unit: Unit.usd }),
|
||||
line({ metric: r.realizedProfit30d, name: "30d", color: colors.time._1m, unit: Unit.usd }),
|
||||
line({ metric: r.realizedProfit1y, name: "1y", color: colors.time._1y, unit: Unit.usd }),
|
||||
],
|
||||
},
|
||||
{ name: "24h", title: title("Realized Profit (24h)"), bottom: [line({ metric: r.realizedProfit24h, name: "Profit", color: colors.profit, unit: Unit.usd })] },
|
||||
{ name: "7d", title: title("Realized Profit (7d)"), bottom: [line({ metric: r.realizedProfit7d, name: "Profit", color: colors.profit, unit: Unit.usd })] },
|
||||
{ name: "30d", title: title("Realized Profit (30d)"), bottom: [line({ metric: r.realizedProfit30d, name: "Profit", color: colors.profit, unit: Unit.usd })] },
|
||||
{ name: "1y", title: title("Realized Profit (1y)"), bottom: [line({ metric: r.realizedProfit1y, name: "Profit", color: colors.profit, unit: Unit.usd })] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Loss",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: title("Rolling Realized Loss"),
|
||||
bottom: [
|
||||
line({ metric: r.realizedLoss24h, name: "24h", color: colors.time._24h, unit: Unit.usd }),
|
||||
line({ metric: r.realizedLoss7d, name: "7d", color: colors.time._1w, unit: Unit.usd }),
|
||||
line({ metric: r.realizedLoss30d, name: "30d", color: colors.time._1m, unit: Unit.usd }),
|
||||
line({ metric: r.realizedLoss1y, name: "1y", color: colors.time._1y, unit: Unit.usd }),
|
||||
],
|
||||
},
|
||||
{ name: "24h", title: title("Realized Loss (24h)"), bottom: [line({ metric: r.realizedLoss24h, name: "Loss", color: colors.loss, unit: Unit.usd })] },
|
||||
{ name: "7d", title: title("Realized Loss (7d)"), bottom: [line({ metric: r.realizedLoss7d, name: "Loss", color: colors.loss, unit: Unit.usd })] },
|
||||
{ name: "30d", title: title("Realized Loss (30d)"), bottom: [line({ metric: r.realizedLoss30d, name: "Loss", color: colors.loss, unit: Unit.usd })] },
|
||||
{ name: "1y", title: title("Realized Loss (1y)"), bottom: [line({ metric: r.realizedLoss1y, name: "Loss", color: colors.loss, unit: Unit.usd })] },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "P/L Ratio",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: title("Rolling Realized P/L Ratio"),
|
||||
bottom: [
|
||||
baseline({ metric: r.realizedProfitToLossRatio24h, name: "24h", color: colors.time._24h, unit: Unit.ratio }),
|
||||
baseline({ metric: r.realizedProfitToLossRatio7d, name: "7d", color: colors.time._1w, unit: Unit.ratio }),
|
||||
baseline({ metric: r.realizedProfitToLossRatio30d, name: "30d", color: colors.time._1m, unit: Unit.ratio }),
|
||||
baseline({ metric: r.realizedProfitToLossRatio1y, name: "1y", color: colors.time._1y, unit: Unit.ratio }),
|
||||
],
|
||||
},
|
||||
{ name: "24h", title: title("Realized P/L Ratio (24h)"), bottom: [baseline({ metric: r.realizedProfitToLossRatio24h, name: "P/L Ratio", unit: Unit.ratio })] },
|
||||
{ name: "7d", title: title("Realized P/L Ratio (7d)"), bottom: [baseline({ metric: r.realizedProfitToLossRatio7d, name: "P/L Ratio", unit: Unit.ratio })] },
|
||||
{ name: "30d", title: title("Realized P/L Ratio (30d)"), bottom: [baseline({ metric: r.realizedProfitToLossRatio30d, name: "P/L Ratio", unit: Unit.ratio })] },
|
||||
{ name: "1y", title: title("Realized P/L Ratio (1y)"), bottom: [baseline({ metric: r.realizedProfitToLossRatio1y, name: "P/L Ratio", unit: Unit.ratio })] },
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Grouped rolling realized value charts (available on all realized patterns)
|
||||
* @param {readonly CohortObject[]} list
|
||||
* @param {CohortObject} all
|
||||
* @param {(metric: string) => string} title
|
||||
* @returns {PartialOptionsTree}
|
||||
*/
|
||||
function groupedRollingRealizedValueCharts(list, all, title) {
|
||||
return [
|
||||
{ name: "24h", title: title("Realized Value (24h)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => line({ metric: tree.realized.realizedValue24h, name, color, unit: Unit.usd })) },
|
||||
{ name: "7d", title: title("Realized Value (7d)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => line({ metric: tree.realized.realizedValue7d, name, color, unit: Unit.usd })) },
|
||||
{ name: "30d", title: title("Realized Value (30d)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => line({ metric: tree.realized.realizedValue30d, name, color, unit: Unit.usd })) },
|
||||
{ name: "1y", title: title("Realized Value (1y)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => line({ metric: tree.realized.realizedValue1y, name, color, unit: Unit.usd })) },
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Grouped rolling realized charts with P/L (for RealizedWithExtras cohorts)
|
||||
* @param {readonly (CohortAgeRange | CohortLongTerm | CohortAll | CohortFull)[]} list
|
||||
* @param {CohortAll} all
|
||||
* @param {(metric: string) => string} title
|
||||
* @returns {PartialOptionsTree}
|
||||
*/
|
||||
function groupedRollingRealizedChartsWithExtras(list, all, title) {
|
||||
return [
|
||||
{
|
||||
name: "Value",
|
||||
tree: groupedRollingRealizedValueCharts(list, all, title),
|
||||
},
|
||||
{
|
||||
name: "Profit",
|
||||
tree: [
|
||||
{ name: "24h", title: title("Realized Profit (24h)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => line({ metric: tree.realized.realizedProfit24h, name, color, unit: Unit.usd })) },
|
||||
{ name: "7d", title: title("Realized Profit (7d)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => line({ metric: tree.realized.realizedProfit7d, name, color, unit: Unit.usd })) },
|
||||
{ name: "30d", title: title("Realized Profit (30d)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => line({ metric: tree.realized.realizedProfit30d, name, color, unit: Unit.usd })) },
|
||||
{ name: "1y", title: title("Realized Profit (1y)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => line({ metric: tree.realized.realizedProfit1y, name, color, unit: Unit.usd })) },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Loss",
|
||||
tree: [
|
||||
{ name: "24h", title: title("Realized Loss (24h)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => line({ metric: tree.realized.realizedLoss24h, name, color, unit: Unit.usd })) },
|
||||
{ name: "7d", title: title("Realized Loss (7d)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => line({ metric: tree.realized.realizedLoss7d, name, color, unit: Unit.usd })) },
|
||||
{ name: "30d", title: title("Realized Loss (30d)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => line({ metric: tree.realized.realizedLoss30d, name, color, unit: Unit.usd })) },
|
||||
{ name: "1y", title: title("Realized Loss (1y)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => line({ metric: tree.realized.realizedLoss1y, name, color, unit: Unit.usd })) },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "P/L Ratio",
|
||||
tree: [
|
||||
{ name: "24h", title: title("Realized P/L Ratio (24h)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => baseline({ metric: tree.realized.realizedProfitToLossRatio24h, name, color, unit: Unit.ratio })) },
|
||||
{ name: "7d", title: title("Realized P/L Ratio (7d)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => baseline({ metric: tree.realized.realizedProfitToLossRatio7d, name, color, unit: Unit.ratio })) },
|
||||
{ name: "30d", title: title("Realized P/L Ratio (30d)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => baseline({ metric: tree.realized.realizedProfitToLossRatio30d, name, color, unit: Unit.ratio })) },
|
||||
{ name: "1y", title: title("Realized P/L Ratio (1y)"), bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) => baseline({ metric: tree.realized.realizedProfitToLossRatio1y, name, color, unit: Unit.ratio })) },
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Realized Subfolder Builders
|
||||
// ============================================================================
|
||||
@@ -716,9 +905,10 @@ function sentInPnlTree(tree, title) {
|
||||
* Base realized subfolder (no P/L ratio)
|
||||
* @param {{ realized: AnyRealizedPattern }} tree
|
||||
* @param {(metric: string) => string} title
|
||||
* @param {PartialOptionsTree} [rollingTree]
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
function realizedSubfolder(tree, title) {
|
||||
function realizedSubfolder(tree, title, rollingTree) {
|
||||
const r = tree.realized;
|
||||
return {
|
||||
name: "Realized",
|
||||
@@ -761,6 +951,10 @@ function realizedSubfolder(tree, title) {
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Rolling",
|
||||
tree: rollingTree ?? singleRollingRealizedValueTree(r, title),
|
||||
},
|
||||
{
|
||||
name: "Cumulative",
|
||||
tree: [
|
||||
@@ -797,21 +991,21 @@ function realizedSubfolder(tree, title) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Realized subfolder with P/L ratio
|
||||
* Realized subfolder with P/L ratio and rolling P/L
|
||||
* @param {{ realized: RealizedWithExtras }} tree
|
||||
* @param {(metric: string) => string} title
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
function realizedSubfolderWithExtras(tree, title) {
|
||||
const base = realizedSubfolder(tree, title);
|
||||
const r = tree.realized;
|
||||
const base = realizedSubfolder(tree, title, singleRollingRealizedTreeWithExtras(r, title));
|
||||
// Insert P/L Ratio after Total (index 3)
|
||||
base.tree.splice(4, 0, {
|
||||
name: "P/L Ratio",
|
||||
title: title("Realized Profit/Loss Ratio"),
|
||||
bottom: [
|
||||
baseline({
|
||||
metric: r.realizedProfitToLossRatio,
|
||||
metric: r.realizedProfitToLossRatio1y,
|
||||
name: "P/L Ratio",
|
||||
unit: Unit.ratio,
|
||||
}),
|
||||
@@ -1706,7 +1900,7 @@ function groupedRealizedPnlSumWithExtras(list, all, title) {
|
||||
title: title("Realized Profit/Loss Ratio"),
|
||||
bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) =>
|
||||
baseline({
|
||||
metric: tree.realized.realizedProfitToLossRatio,
|
||||
metric: tree.realized.realizedProfitToLossRatio1y,
|
||||
name,
|
||||
color,
|
||||
unit: Unit.ratio,
|
||||
@@ -1929,6 +2123,10 @@ function groupedRealizedSubfolder(list, all, title) {
|
||||
}),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "Rolling",
|
||||
tree: groupedRollingRealizedValueCharts(list, all, title),
|
||||
},
|
||||
{
|
||||
name: "Cumulative",
|
||||
tree: [
|
||||
@@ -1987,6 +2185,10 @@ function groupedRealizedSubfolderWithExtras(list, all, title) {
|
||||
}),
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "Rolling",
|
||||
tree: groupedRollingRealizedChartsWithExtras(list, all, title),
|
||||
},
|
||||
{
|
||||
name: "Cumulative",
|
||||
tree: [
|
||||
@@ -2050,7 +2252,10 @@ export function createGroupedProfitabilitySectionBasicWithInvestedCapitalPct({
|
||||
{ name: "Unrealized", tree: groupedPnlCharts(list, all, title) },
|
||||
groupedRealizedSubfolder(list, all, title),
|
||||
{ name: "Volume", tree: groupedSentInPnl(list, all, title) },
|
||||
{ name: "Invested Capital", tree: groupedInvestedCapital(list, all, title) },
|
||||
{
|
||||
name: "Invested Capital",
|
||||
tree: groupedInvestedCapital(list, all, title),
|
||||
},
|
||||
groupedSentiment(list, all, title),
|
||||
],
|
||||
};
|
||||
@@ -2089,7 +2294,10 @@ export function createGroupedProfitabilitySectionWithInvestedCapitalPct({
|
||||
},
|
||||
groupedRealizedSubfolderWithExtras(list, all, title),
|
||||
{ name: "Volume", tree: groupedSentInPnl(list, all, title) },
|
||||
{ name: "Invested Capital", tree: groupedInvestedCapital(list, all, title) },
|
||||
{
|
||||
name: "Invested Capital",
|
||||
tree: groupedInvestedCapital(list, all, title),
|
||||
},
|
||||
groupedSentiment(list, all, title),
|
||||
],
|
||||
};
|
||||
@@ -2100,7 +2308,11 @@ export function createGroupedProfitabilitySectionWithInvestedCapitalPct({
|
||||
* @param {{ list: readonly (CohortFull | CohortBasicWithMarketCap)[], all: CohortAll, title: (metric: string) => string }} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedProfitabilitySectionWithNupl({ list, all, title }) {
|
||||
export function createGroupedProfitabilitySectionWithNupl({
|
||||
list,
|
||||
all,
|
||||
title,
|
||||
}) {
|
||||
return {
|
||||
name: "Profitability",
|
||||
tree: [
|
||||
@@ -2124,7 +2336,10 @@ export function createGroupedProfitabilitySectionWithNupl({ list, all, title })
|
||||
},
|
||||
groupedRealizedSubfolder(list, all, title),
|
||||
{ name: "Volume", tree: groupedSentInPnl(list, all, title) },
|
||||
{ name: "Invested Capital", tree: groupedInvestedCapital(list, all, title) },
|
||||
{
|
||||
name: "Invested Capital",
|
||||
tree: groupedInvestedCapital(list, all, title),
|
||||
},
|
||||
groupedSentiment(list, all, title),
|
||||
],
|
||||
};
|
||||
@@ -2135,7 +2350,11 @@ export function createGroupedProfitabilitySectionWithNupl({ list, all, title })
|
||||
* @param {{ list: readonly CohortLongTerm[], all: CohortAll, title: (metric: string) => string }} args
|
||||
* @returns {PartialOptionsGroup}
|
||||
*/
|
||||
export function createGroupedProfitabilitySectionLongTerm({ list, all, title }) {
|
||||
export function createGroupedProfitabilitySectionLongTerm({
|
||||
list,
|
||||
all,
|
||||
title,
|
||||
}) {
|
||||
return {
|
||||
name: "Profitability",
|
||||
tree: [
|
||||
@@ -2181,7 +2400,10 @@ export function createGroupedProfitabilitySectionLongTerm({ list, all, title })
|
||||
},
|
||||
groupedRealizedSubfolderWithExtras(list, all, title),
|
||||
{ name: "Volume", tree: groupedSentInPnl(list, all, title) },
|
||||
{ name: "Invested Capital", tree: groupedInvestedCapital(list, all, title) },
|
||||
{
|
||||
name: "Invested Capital",
|
||||
tree: groupedInvestedCapital(list, all, title),
|
||||
},
|
||||
groupedSentiment(list, all, title),
|
||||
],
|
||||
};
|
||||
@@ -2242,7 +2464,10 @@ export function createGroupedProfitabilitySectionWithPeakRegret({
|
||||
},
|
||||
groupedRealizedSubfolder(list, all, title),
|
||||
{ name: "Volume", tree: groupedSentInPnl(list, all, title) },
|
||||
{ name: "Invested Capital", tree: groupedInvestedCapital(list, all, title) },
|
||||
{
|
||||
name: "Invested Capital",
|
||||
tree: groupedInvestedCapital(list, all, title),
|
||||
},
|
||||
groupedSentiment(list, all, title),
|
||||
],
|
||||
};
|
||||
|
||||
@@ -193,6 +193,7 @@ export function createMarketSection() {
|
||||
range,
|
||||
indicators,
|
||||
lookback,
|
||||
dca,
|
||||
} = market;
|
||||
|
||||
const shortPeriodsBase = [
|
||||
@@ -671,45 +672,297 @@ export function createMarketSection() {
|
||||
tree: [
|
||||
{
|
||||
name: "RSI",
|
||||
title: "RSI (14d)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.rsi._1d.rsi,
|
||||
name: "RSI",
|
||||
color: colors.indicator.main,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1d.rsiMax,
|
||||
name: "Max",
|
||||
color: colors.stat.max,
|
||||
defaultActive: false,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1d.rsiMin,
|
||||
name: "Min",
|
||||
color: colors.stat.min,
|
||||
defaultActive: false,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
priceLine({ unit: Unit.index, number: 70 }),
|
||||
priceLine({ unit: Unit.index, number: 50, defaultActive: false }),
|
||||
priceLine({ unit: Unit.index, number: 30 }),
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "RSI Comparison",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.rsi._1d.rsi,
|
||||
name: "1d",
|
||||
color: colors.time._24h,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1w.rsi,
|
||||
name: "1w",
|
||||
color: colors.time._1w,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1m.rsi,
|
||||
name: "1m",
|
||||
color: colors.time._1m,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1y.rsi,
|
||||
name: "1y",
|
||||
color: colors.time._1y,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
priceLine({ unit: Unit.index, number: 70 }),
|
||||
priceLine({ unit: Unit.index, number: 30 }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1 Day",
|
||||
title: "RSI (1d)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.rsi._1d.rsi,
|
||||
name: "RSI",
|
||||
color: colors.indicator.main,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1d.rsiMax,
|
||||
name: "Max",
|
||||
color: colors.stat.max,
|
||||
defaultActive: false,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1d.rsiMin,
|
||||
name: "Min",
|
||||
color: colors.stat.min,
|
||||
defaultActive: false,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
priceLine({ unit: Unit.index, number: 70 }),
|
||||
priceLine({
|
||||
unit: Unit.index,
|
||||
number: 50,
|
||||
defaultActive: false,
|
||||
}),
|
||||
priceLine({ unit: Unit.index, number: 30 }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1 Week",
|
||||
title: "RSI (1w)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.rsi._1w.rsi,
|
||||
name: "RSI",
|
||||
color: colors.indicator.main,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1w.rsiMax,
|
||||
name: "Max",
|
||||
color: colors.stat.max,
|
||||
defaultActive: false,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1w.rsiMin,
|
||||
name: "Min",
|
||||
color: colors.stat.min,
|
||||
defaultActive: false,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
priceLine({ unit: Unit.index, number: 70 }),
|
||||
priceLine({
|
||||
unit: Unit.index,
|
||||
number: 50,
|
||||
defaultActive: false,
|
||||
}),
|
||||
priceLine({ unit: Unit.index, number: 30 }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1 Month",
|
||||
title: "RSI (1m)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.rsi._1m.rsi,
|
||||
name: "RSI",
|
||||
color: colors.indicator.main,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1m.rsiMax,
|
||||
name: "Max",
|
||||
color: colors.stat.max,
|
||||
defaultActive: false,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1m.rsiMin,
|
||||
name: "Min",
|
||||
color: colors.stat.min,
|
||||
defaultActive: false,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
priceLine({ unit: Unit.index, number: 70 }),
|
||||
priceLine({
|
||||
unit: Unit.index,
|
||||
number: 50,
|
||||
defaultActive: false,
|
||||
}),
|
||||
priceLine({ unit: Unit.index, number: 30 }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1 Year",
|
||||
title: "RSI (1y)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.rsi._1y.rsi,
|
||||
name: "RSI",
|
||||
color: colors.indicator.main,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1y.rsiMax,
|
||||
name: "Max",
|
||||
color: colors.stat.max,
|
||||
defaultActive: false,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1y.rsiMin,
|
||||
name: "Min",
|
||||
color: colors.stat.min,
|
||||
defaultActive: false,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
priceLine({ unit: Unit.index, number: 70 }),
|
||||
priceLine({
|
||||
unit: Unit.index,
|
||||
number: 50,
|
||||
defaultActive: false,
|
||||
}),
|
||||
priceLine({ unit: Unit.index, number: 30 }),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "StochRSI",
|
||||
title: "Stochastic RSI",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "Stochastic RSI Comparison",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.rsi._1d.stochRsiK,
|
||||
name: "1d K",
|
||||
color: colors.time._24h,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1w.stochRsiK,
|
||||
name: "1w K",
|
||||
color: colors.time._1w,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1m.stochRsiK,
|
||||
name: "1m K",
|
||||
color: colors.time._1m,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1y.stochRsiK,
|
||||
name: "1y K",
|
||||
color: colors.time._1y,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
...priceLines({ unit: Unit.index, numbers: [80, 20] }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1 Day",
|
||||
title: "Stochastic RSI (1d)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.rsi._1d.stochRsiK,
|
||||
name: "K",
|
||||
color: colors.indicator.fast,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1d.stochRsiD,
|
||||
name: "D",
|
||||
color: colors.indicator.slow,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
...priceLines({ unit: Unit.index, numbers: [80, 20] }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1 Week",
|
||||
title: "Stochastic RSI (1w)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.rsi._1w.stochRsiK,
|
||||
name: "K",
|
||||
color: colors.indicator.fast,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1w.stochRsiD,
|
||||
name: "D",
|
||||
color: colors.indicator.slow,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
...priceLines({ unit: Unit.index, numbers: [80, 20] }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1 Month",
|
||||
title: "Stochastic RSI (1m)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.rsi._1m.stochRsiK,
|
||||
name: "K",
|
||||
color: colors.indicator.fast,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1m.stochRsiD,
|
||||
name: "D",
|
||||
color: colors.indicator.slow,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
...priceLines({ unit: Unit.index, numbers: [80, 20] }),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1 Year",
|
||||
title: "Stochastic RSI (1y)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.rsi._1y.stochRsiK,
|
||||
name: "K",
|
||||
color: colors.indicator.fast,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1y.stochRsiD,
|
||||
name: "D",
|
||||
color: colors.indicator.slow,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
...priceLines({ unit: Unit.index, numbers: [80, 20] }),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Stochastic",
|
||||
title: "Stochastic Oscillator",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.rsi._1d.stochRsiK,
|
||||
metric: indicators.stochK,
|
||||
name: "K",
|
||||
color: colors.indicator.fast,
|
||||
unit: Unit.index,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.rsi._1d.stochRsiD,
|
||||
metric: indicators.stochD,
|
||||
name: "D",
|
||||
color: colors.indicator.slow,
|
||||
unit: Unit.index,
|
||||
@@ -719,25 +972,129 @@ export function createMarketSection() {
|
||||
},
|
||||
{
|
||||
name: "MACD",
|
||||
title: "MACD",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.macd._1d.line,
|
||||
name: "MACD",
|
||||
color: colors.indicator.fast,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.macd._1d.signal,
|
||||
name: "Signal",
|
||||
color: colors.indicator.slow,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
histogram({
|
||||
metric: indicators.macd._1d.histogram,
|
||||
name: "Histogram",
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "MACD Comparison",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.macd._1d.line,
|
||||
name: "1d",
|
||||
color: colors.time._24h,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.macd._1w.line,
|
||||
name: "1w",
|
||||
color: colors.time._1w,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.macd._1m.line,
|
||||
name: "1m",
|
||||
color: colors.time._1m,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.macd._1y.line,
|
||||
name: "1y",
|
||||
color: colors.time._1y,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1 Day",
|
||||
title: "MACD (1d)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.macd._1d.line,
|
||||
name: "MACD",
|
||||
color: colors.indicator.fast,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.macd._1d.signal,
|
||||
name: "Signal",
|
||||
color: colors.indicator.slow,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
histogram({
|
||||
metric: indicators.macd._1d.histogram,
|
||||
name: "Histogram",
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1 Week",
|
||||
title: "MACD (1w)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.macd._1w.line,
|
||||
name: "MACD",
|
||||
color: colors.indicator.fast,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.macd._1w.signal,
|
||||
name: "Signal",
|
||||
color: colors.indicator.slow,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
histogram({
|
||||
metric: indicators.macd._1w.histogram,
|
||||
name: "Histogram",
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1 Month",
|
||||
title: "MACD (1m)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.macd._1m.line,
|
||||
name: "MACD",
|
||||
color: colors.indicator.fast,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.macd._1m.signal,
|
||||
name: "Signal",
|
||||
color: colors.indicator.slow,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
histogram({
|
||||
metric: indicators.macd._1m.histogram,
|
||||
name: "Histogram",
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1 Year",
|
||||
title: "MACD (1y)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: indicators.macd._1y.line,
|
||||
name: "MACD",
|
||||
color: colors.indicator.fast,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
line({
|
||||
metric: indicators.macd._1y.signal,
|
||||
name: "Signal",
|
||||
color: colors.indicator.slow,
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
histogram({
|
||||
metric: indicators.macd._1y.histogram,
|
||||
name: "Histogram",
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -763,6 +1120,18 @@ export function createMarketSection() {
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
name: "DCA",
|
||||
title: "Dollar Cost Average Sats/Day",
|
||||
bottom: [
|
||||
line({
|
||||
metric: dca.dcaSatsPerDay,
|
||||
name: "Sats/Day",
|
||||
unit: Unit.sats,
|
||||
}),
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Indicators",
|
||||
tree: [
|
||||
|
||||
@@ -77,27 +77,27 @@ export function createMiningSection() {
|
||||
title: `Dominance: ${name}`,
|
||||
bottom: [
|
||||
dots({
|
||||
metric: pool._24hDominance,
|
||||
metric: pool.dominance24h,
|
||||
name: "24h",
|
||||
color: colors.time._24h,
|
||||
unit: Unit.percentage,
|
||||
defaultActive: false,
|
||||
}),
|
||||
line({
|
||||
metric: pool._1wDominance,
|
||||
metric: pool.dominance1w,
|
||||
name: "1w",
|
||||
color: colors.time._1w,
|
||||
unit: Unit.percentage,
|
||||
defaultActive: false,
|
||||
}),
|
||||
line({
|
||||
metric: pool._1mDominance,
|
||||
metric: pool.dominance1m,
|
||||
name: "1m",
|
||||
color: colors.time._1m,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: pool._1yDominance,
|
||||
metric: pool.dominance1y,
|
||||
name: "1y",
|
||||
color: colors.time._1y,
|
||||
unit: Unit.percentage,
|
||||
@@ -125,28 +125,28 @@ export function createMiningSection() {
|
||||
unit: Unit.count,
|
||||
}),
|
||||
line({
|
||||
metric: pool._24hBlocksMined,
|
||||
metric: pool.blocksMined24hSum,
|
||||
name: "24h",
|
||||
color: colors.time._24h,
|
||||
unit: Unit.count,
|
||||
defaultActive: false,
|
||||
}),
|
||||
line({
|
||||
metric: pool._1wBlocksMined,
|
||||
metric: pool.blocksMined1wSum,
|
||||
name: "1w",
|
||||
color: colors.time._1w,
|
||||
unit: Unit.count,
|
||||
defaultActive: false,
|
||||
}),
|
||||
line({
|
||||
metric: pool._1mBlocksMined,
|
||||
metric: pool.blocksMined1mSum,
|
||||
name: "1m",
|
||||
color: colors.time._1m,
|
||||
unit: Unit.count,
|
||||
defaultActive: false,
|
||||
}),
|
||||
line({
|
||||
metric: pool._1yBlocksMined,
|
||||
metric: pool.blocksMined1ySum,
|
||||
name: "1y",
|
||||
color: colors.time._1y,
|
||||
unit: Unit.count,
|
||||
@@ -406,13 +406,80 @@ export function createMiningSection() {
|
||||
name: "sum",
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: mining.rewards._24hCoinbaseSum,
|
||||
pattern: mining.rewards.coinbase24hSum,
|
||||
name: "24h",
|
||||
color: colors.time._24h,
|
||||
defaultActive: false,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Rolling",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "Coinbase Rolling Sum",
|
||||
bottom: [
|
||||
...satsBtcUsd({
|
||||
pattern: mining.rewards.coinbase24hSum,
|
||||
name: "24h",
|
||||
color: colors.time._24h,
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: mining.rewards.coinbase7dSum,
|
||||
name: "7d",
|
||||
color: colors.time._1w,
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: mining.rewards.coinbase30dSum,
|
||||
name: "30d",
|
||||
color: colors.time._1m,
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: mining.rewards.coinbase1ySum,
|
||||
name: "1y",
|
||||
color: colors.time._1y,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "24h",
|
||||
title: "Coinbase 24h Rolling Sum",
|
||||
bottom: satsBtcUsd({
|
||||
pattern: mining.rewards.coinbase24hSum,
|
||||
name: "24h",
|
||||
color: colors.time._24h,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "7d",
|
||||
title: "Coinbase 7d Rolling Sum",
|
||||
bottom: satsBtcUsd({
|
||||
pattern: mining.rewards.coinbase7dSum,
|
||||
name: "7d",
|
||||
color: colors.time._1w,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "30d",
|
||||
title: "Coinbase 30d Rolling Sum",
|
||||
bottom: satsBtcUsd({
|
||||
pattern: mining.rewards.coinbase30dSum,
|
||||
name: "30d",
|
||||
color: colors.time._1m,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "1y",
|
||||
title: "Coinbase 1y Rolling Sum",
|
||||
bottom: satsBtcUsd({
|
||||
pattern: mining.rewards.coinbase1ySum,
|
||||
name: "1y",
|
||||
color: colors.time._1y,
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Distribution",
|
||||
title: "Coinbase Rewards per Block Distribution",
|
||||
@@ -483,6 +550,73 @@ export function createMiningSection() {
|
||||
name: "sum",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "Rolling",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "Fee Rolling Sum",
|
||||
bottom: [
|
||||
...satsBtcUsd({
|
||||
pattern: mining.rewards.fee24hSum,
|
||||
name: "24h",
|
||||
color: colors.time._24h,
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: mining.rewards.fee7dSum,
|
||||
name: "7d",
|
||||
color: colors.time._1w,
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: mining.rewards.fee30dSum,
|
||||
name: "30d",
|
||||
color: colors.time._1m,
|
||||
}),
|
||||
...satsBtcUsd({
|
||||
pattern: mining.rewards.fee1ySum,
|
||||
name: "1y",
|
||||
color: colors.time._1y,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "24h",
|
||||
title: "Fee 24h Rolling Sum",
|
||||
bottom: satsBtcUsd({
|
||||
pattern: mining.rewards.fee24hSum,
|
||||
name: "24h",
|
||||
color: colors.time._24h,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "7d",
|
||||
title: "Fee 7d Rolling Sum",
|
||||
bottom: satsBtcUsd({
|
||||
pattern: mining.rewards.fee7dSum,
|
||||
name: "7d",
|
||||
color: colors.time._1w,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "30d",
|
||||
title: "Fee 30d Rolling Sum",
|
||||
bottom: satsBtcUsd({
|
||||
pattern: mining.rewards.fee30dSum,
|
||||
name: "30d",
|
||||
color: colors.time._1m,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "1y",
|
||||
title: "Fee 1y Rolling Sum",
|
||||
bottom: satsBtcUsd({
|
||||
pattern: mining.rewards.fee1ySum,
|
||||
name: "1y",
|
||||
color: colors.time._1y,
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Distribution",
|
||||
title: "Transaction Fee Revenue per Block Distribution",
|
||||
@@ -501,20 +635,174 @@ export function createMiningSection() {
|
||||
},
|
||||
{
|
||||
name: "Dominance",
|
||||
title: "Revenue Dominance",
|
||||
bottom: [
|
||||
line({
|
||||
metric: mining.rewards.subsidyDominance,
|
||||
name: "Subsidy",
|
||||
color: colors.mining.subsidy,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.feeDominance24h,
|
||||
name: "Fees",
|
||||
color: colors.mining.fee,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
tree: [
|
||||
{
|
||||
name: "Subsidy",
|
||||
title: "Subsidy Dominance",
|
||||
bottom: [
|
||||
line({
|
||||
metric: mining.rewards.subsidyDominance,
|
||||
name: "All-time",
|
||||
color: colors.time.all,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.subsidyDominance24h,
|
||||
name: "24h",
|
||||
color: colors.time._24h,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.subsidyDominance7d,
|
||||
name: "7d",
|
||||
color: colors.time._1w,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.subsidyDominance30d,
|
||||
name: "30d",
|
||||
color: colors.time._1m,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.subsidyDominance1y,
|
||||
name: "1y",
|
||||
color: colors.time._1y,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Fees",
|
||||
title: "Fee Dominance",
|
||||
bottom: [
|
||||
line({
|
||||
metric: mining.rewards.feeDominance,
|
||||
name: "All-time",
|
||||
color: colors.time.all,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.feeDominance24h,
|
||||
name: "24h",
|
||||
color: colors.time._24h,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.feeDominance7d,
|
||||
name: "7d",
|
||||
color: colors.time._1w,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.feeDominance30d,
|
||||
name: "30d",
|
||||
color: colors.time._1m,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.feeDominance1y,
|
||||
name: "1y",
|
||||
color: colors.time._1y,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "All-time",
|
||||
title: "Revenue Dominance (All-time)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: mining.rewards.subsidyDominance,
|
||||
name: "Subsidy",
|
||||
color: colors.mining.subsidy,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.feeDominance,
|
||||
name: "Fees",
|
||||
color: colors.mining.fee,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "24h",
|
||||
title: "Revenue Dominance (24h)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: mining.rewards.subsidyDominance24h,
|
||||
name: "Subsidy",
|
||||
color: colors.mining.subsidy,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.feeDominance24h,
|
||||
name: "Fees",
|
||||
color: colors.mining.fee,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "7d",
|
||||
title: "Revenue Dominance (7d)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: mining.rewards.subsidyDominance7d,
|
||||
name: "Subsidy",
|
||||
color: colors.mining.subsidy,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.feeDominance7d,
|
||||
name: "Fees",
|
||||
color: colors.mining.fee,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "30d",
|
||||
title: "Revenue Dominance (30d)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: mining.rewards.subsidyDominance30d,
|
||||
name: "Subsidy",
|
||||
color: colors.mining.subsidy,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.feeDominance30d,
|
||||
name: "Fees",
|
||||
color: colors.mining.fee,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "1y",
|
||||
title: "Revenue Dominance (1y)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: mining.rewards.subsidyDominance1y,
|
||||
name: "Subsidy",
|
||||
color: colors.mining.subsidy,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
line({
|
||||
metric: mining.rewards.feeDominance1y,
|
||||
name: "Fees",
|
||||
color: colors.mining.fee,
|
||||
unit: Unit.percentage,
|
||||
}),
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
@@ -675,7 +963,7 @@ export function createMiningSection() {
|
||||
title: "Dominance: Major Pools (1m)",
|
||||
bottom: majorPools.map((p, i) =>
|
||||
line({
|
||||
metric: p.pool._1mDominance,
|
||||
metric: p.pool.dominance1m,
|
||||
name: p.name,
|
||||
color: colors.at(i, majorPools.length),
|
||||
unit: Unit.percentage,
|
||||
@@ -687,7 +975,7 @@ export function createMiningSection() {
|
||||
title: "Blocks Mined: Major Pools (1m)",
|
||||
bottom: majorPools.map((p, i) =>
|
||||
line({
|
||||
metric: p.pool._1mBlocksMined,
|
||||
metric: p.pool.blocksMined1mSum,
|
||||
name: p.name,
|
||||
color: colors.at(i, majorPools.length),
|
||||
unit: Unit.count,
|
||||
@@ -717,7 +1005,7 @@ export function createMiningSection() {
|
||||
title: "Dominance: AntPool & Friends (1m)",
|
||||
bottom: antpoolFriends.map((p, i) =>
|
||||
line({
|
||||
metric: p.pool._1mDominance,
|
||||
metric: p.pool.dominance1m,
|
||||
name: p.name,
|
||||
color: colors.at(i, antpoolFriends.length),
|
||||
unit: Unit.percentage,
|
||||
@@ -729,7 +1017,7 @@ export function createMiningSection() {
|
||||
title: "Blocks Mined: AntPool & Friends (1m)",
|
||||
bottom: antpoolFriends.map((p, i) =>
|
||||
line({
|
||||
metric: p.pool._1mBlocksMined,
|
||||
metric: p.pool.blocksMined1mSum,
|
||||
name: p.name,
|
||||
color: colors.at(i, antpoolFriends.length),
|
||||
unit: Unit.count,
|
||||
|
||||
@@ -622,25 +622,25 @@ export function createNetworkSection() {
|
||||
title: "Block Count (Rolling)",
|
||||
bottom: [
|
||||
line({
|
||||
metric: blocks.count._24hBlockCount,
|
||||
metric: blocks.count.blockCount24hSum,
|
||||
name: "24h",
|
||||
color: colors.time._24h,
|
||||
unit: Unit.count,
|
||||
}),
|
||||
line({
|
||||
metric: blocks.count._1wBlockCount,
|
||||
metric: blocks.count.blockCount1wSum,
|
||||
name: "1w",
|
||||
color: colors.time._1w,
|
||||
unit: Unit.count,
|
||||
}),
|
||||
line({
|
||||
metric: blocks.count._1mBlockCount,
|
||||
metric: blocks.count.blockCount1mSum,
|
||||
name: "1m",
|
||||
color: colors.time._1m,
|
||||
unit: Unit.count,
|
||||
}),
|
||||
line({
|
||||
metric: blocks.count._1yBlockCount,
|
||||
metric: blocks.count.blockCount1ySum,
|
||||
name: "1y",
|
||||
color: colors.time._1y,
|
||||
unit: Unit.count,
|
||||
|
||||
Reference in New Issue
Block a user