global: snapshot

This commit is contained in:
nym21
2026-03-18 21:04:12 +01:00
parent 92e1a0ccaf
commit d8b55340f7
16 changed files with 215 additions and 143 deletions
+4 -4
View File
@@ -5,7 +5,7 @@ import {
dots,
line,
price,
sumsTree,
sumsArray,
multiSeriesTree,
percentRatioDots,
} from "./series.js";
@@ -311,7 +311,7 @@ export function createCointimeSection() {
}),
],
},
sumsTree({ windows: pattern.sum, title, unit: Unit.coinblocks }),
...sumsArray({ windows: pattern.sum, title, unit: Unit.coinblocks }),
{
name: "Cumulative",
title: `${title} (Total)`,
@@ -366,7 +366,7 @@ export function createCointimeSection() {
line({ series: pattern.base, name, color, unit: Unit.usd }),
],
},
sumsTree({ windows: pattern.sum, title, unit: Unit.usd }),
...sumsArray({ windows: pattern.sum, title, unit: Unit.usd }),
{
name: "Cumulative",
title: `${title} (Total)`,
@@ -402,7 +402,7 @@ export function createCointimeSection() {
}),
],
},
sumsTree({
...sumsArray({
windows: vocdd.pattern.sum,
title: vocdd.title,
unit: Unit.usd,
+2 -2
View File
@@ -44,7 +44,7 @@ export function buildCohortData() {
color: colors.bitcoin,
tree: utxoCohorts.all,
addressCount: {
inner: addrs.funded.all,
base: addrs.funded.all,
delta: addrs.delta.all,
},
};
@@ -170,7 +170,7 @@ export function buildCohortData() {
color: colors.at(i, arr.length),
tree: utxoCohorts.type[key],
addressCount: {
inner: addrs.funded[key],
base: addrs.funded[key],
delta: addrs.delta[key],
},
};
+107 -18
View File
@@ -481,7 +481,14 @@ export function statsAtWindow(pattern, window) {
* @param {(args: {series: AnySeriesPattern, name: string, color: Color, unit: Unit}) => AnyFetchedSeriesBlueprint} [args.series]
* @returns {PartialOptionsGroup}
*/
function rollingWindowsTree({ windows, title, windowTitle, unit, name, series = line }) {
function rollingWindowsTree({
windows,
title,
windowTitle,
unit,
name,
series = line,
}) {
return {
name,
tree: [
@@ -514,7 +521,25 @@ function rollingWindowsTree({ windows, title, windowTitle, unit, name, series =
}
/**
* Rolling sums tree
* Flat array of rolling sum charts (one per window)
* @param {Object} args
* @param {{ _24h: AnySeriesPattern, _1w: AnySeriesPattern, _1m: AnySeriesPattern, _1y: AnySeriesPattern }} args.windows
* @param {string} args.title
* @param {Unit} args.unit
* @returns {PartialChartOption[]}
*/
export function sumsArray({ windows, title, unit }) {
return ROLLING_WINDOWS.map((w) => ({
name: w.name,
title: `${title} ${w.title} Sum`,
bottom: [
line({ series: windows[w.key], name: w.name, color: w.color, unit }),
],
}));
}
/**
* Rolling sums tree (Compare + individual windows in a folder)
* @param {Object} args
* @param {{ _24h: AnySeriesPattern, _1w: AnySeriesPattern, _1m: AnySeriesPattern, _1y: AnySeriesPattern }} args.windows
* @param {string} args.title
@@ -523,7 +548,14 @@ function rollingWindowsTree({ windows, title, windowTitle, unit, name, series =
* @returns {PartialOptionsGroup}
*/
export function sumsTree({ windows, title, unit, series }) {
return rollingWindowsTree({ windows, title, windowTitle: (w) => `${title} ${w.title} Sum`, unit, name: "Sums", ...(series ? { series } : {}) });
return rollingWindowsTree({
windows,
title,
windowTitle: (w) => `${title} ${w.title} Sum`,
unit,
name: "Sums",
...(series ? { series } : {}),
});
}
/**
@@ -536,7 +568,13 @@ export function sumsTree({ windows, title, unit, series }) {
* @returns {PartialOptionsGroup}
*/
export function averagesTree({ windows, title, unit, name = "Averages" }) {
return rollingWindowsTree({ windows, title, windowTitle: (w) => `${title} ${w.title} Average`, unit, name });
return rollingWindowsTree({
windows,
title,
windowTitle: (w) => `${title} ${w.title} Average`,
unit,
name,
});
}
/**
@@ -556,7 +594,12 @@ export function distributionWindowsTree({ pattern, base, title, unit }) {
name: "Compare",
title: `${title} Average`,
bottom: ROLLING_WINDOWS.map((w) =>
line({ series: pattern.average[w.key], name: w.name, color: w.color, unit }),
line({
series: pattern.average[w.key],
name: w.name,
color: w.color,
unit,
}),
),
},
...ROLLING_WINDOWS.map((w) => ({
@@ -658,8 +701,20 @@ export function fromSupplyPattern({ pattern, title, color }) {
*/
export function percentRatio({ pattern, name, color, defaultActive }) {
return [
line({ series: pattern.percent, name, color, defaultActive, unit: Unit.percentage }),
line({ series: pattern.ratio, name, color, defaultActive, unit: Unit.ratio }),
line({
series: pattern.percent,
name,
color,
defaultActive,
unit: Unit.percentage,
}),
line({
series: pattern.ratio,
name,
color,
defaultActive,
unit: Unit.ratio,
}),
];
}
@@ -674,8 +729,20 @@ export function percentRatio({ pattern, name, color, defaultActive }) {
*/
export function percentRatioDots({ pattern, name, color, defaultActive }) {
return [
dots({ series: pattern.percent, name, color, defaultActive, unit: Unit.percentage }),
dots({ series: pattern.ratio, name, color, defaultActive, unit: Unit.ratio }),
dots({
series: pattern.percent,
name,
color,
defaultActive,
unit: Unit.percentage,
}),
dots({
series: pattern.ratio,
name,
color,
defaultActive,
unit: Unit.ratio,
}),
];
}
@@ -690,7 +757,12 @@ export function percentRatioDots({ pattern, name, color, defaultActive }) {
*/
export function percentRatioBaseline({ pattern, name, defaultActive }) {
return [
baseline({ series: pattern.percent, name, defaultActive, unit: Unit.percentage }),
baseline({
series: pattern.percent,
name,
defaultActive,
unit: Unit.percentage,
}),
baseline({ series: pattern.ratio, name, defaultActive, unit: Unit.ratio }),
];
}
@@ -704,7 +776,12 @@ export function percentRatioBaseline({ pattern, name, defaultActive }) {
* @param {(args: {pattern: { percent: AnySeriesPattern, ratio: AnySeriesPattern }, name: string, color?: Color}) => AnyFetchedSeriesBlueprint[]} [args.series]
* @returns {PartialOptionsGroup}
*/
export function rollingPercentRatioTree({ windows, title, name = "Sums", series = percentRatio }) {
export function rollingPercentRatioTree({
windows,
title,
name = "Sums",
series = percentRatio,
}) {
return {
name,
tree: [
@@ -712,7 +789,11 @@ export function rollingPercentRatioTree({ windows, title, name = "Sums", series
name: "Compare",
title: `${title} Rolling`,
bottom: ROLLING_WINDOWS.flatMap((w) =>
percentRatio({ pattern: windows[w.key], name: w.name, color: w.color }),
percentRatio({
pattern: windows[w.key],
name: w.name,
color: w.color,
}),
),
},
...ROLLING_WINDOWS.map((w) => ({
@@ -764,7 +845,12 @@ export function deltaTree({ delta, title, unit, extract }) {
})),
],
},
rollingPercentRatioTree({ windows: delta.rate, title: `${title} Growth Rate`, name: "Growth Rate", series: percentRatioBaseline }),
rollingPercentRatioTree({
windows: delta.rate,
title: `${title} Growth Rate`,
name: "Growth Rate",
series: percentRatioBaseline,
}),
];
}
@@ -785,7 +871,6 @@ export function simpleDeltaTree({ delta, title, unit }) {
// ============================================================================
// These split patterns into separate Sum/Distribution/Cumulative charts
/**
* Create btc/sats/usd series from patterns
* @param {Object} args
@@ -870,7 +955,7 @@ export const chartsFromFullPerBlock = (args) =>
/**
* Split pattern with sum + distribution + cumulative into 3 charts (no base)
* @param {Object} args
* @param {FullStatsPattern} args.pattern
* @param {AggregatedPattern} args.pattern
* @param {string} args.title
* @param {Unit} args.unit
* @param {string} [args.distributionSuffix]
@@ -893,7 +978,11 @@ export function chartsFromAggregated({
bottom: [{ series: pattern.sum, title: "base", color: stat.sum, unit }],
},
sumsTree({ windows: pattern.rolling.sum, title, unit }),
distributionWindowsTree({ pattern: pattern.rolling, title: distTitle, unit }),
distributionWindowsTree({
pattern: pattern.rolling,
title: distTitle,
unit,
}),
{
name: "Cumulative",
title: `${title} (Total)`,
@@ -905,7 +994,7 @@ export function chartsFromAggregated({
/**
* Split pattern into 3 charts with "per Block" in distribution title (no base)
* @param {Object} args
* @param {FullStatsPattern} args.pattern
* @param {AggregatedPattern} args.pattern
* @param {string} args.title
* @param {Unit} args.unit
* @returns {PartialOptionsTree}
@@ -947,7 +1036,7 @@ export function chartsFromBlockAnd6b({ pattern, title, unit }) {
*/
export function chartsFromSumsCumulative({ pattern, title, unit, color }) {
return [
sumsTree({ windows: pattern.sum, title, unit }),
...sumsArray({ windows: pattern.sum, title, unit }),
{
name: "Cumulative",
title: `${title} (Total)`,
+9 -25
View File
@@ -231,31 +231,15 @@ export function satsBtcUsdFullTree({ pattern, name, title, color }) {
title,
bottom: satsBtcUsd({ pattern: pattern.base, name, color }),
},
{
name: "Sums",
tree: [
{
name: "Compare",
title: `${title} Rolling`,
bottom: ROLLING_WINDOWS.flatMap((w) =>
satsBtcUsd({
pattern: pattern.sum[w.key],
name: w.name,
color: w.color,
}),
),
},
...ROLLING_WINDOWS.map((w) => ({
name: w.name,
title: `${title} (${w.name})`,
bottom: satsBtcUsd({
pattern: pattern.sum[w.key],
name: w.name,
color: w.color,
}),
})),
],
},
...ROLLING_WINDOWS.map((w) => ({
name: w.name,
title: `${title} ${w.title} Sum`,
bottom: satsBtcUsd({
pattern: pattern.sum[w.key],
name: w.name,
color: w.color,
}),
})),
{
name: "Cumulative",
title: `${title} (Total)`,
+3 -3
View File
@@ -196,7 +196,7 @@
* @property {string} title
* @property {Color} color
* @property {PatternAll} tree
* @property {AddressCountDeltaPattern} addressCount
* @property {AddrCountPattern} addressCount
*
* Full cohort: adjustedSopr + percentiles + RelToMarketCap (term.short)
* @typedef {Object} CohortFull
@@ -265,7 +265,7 @@
* ============================================================================
*
* Addressable cohort with address count (for "type" cohorts - uses OutputsRealizedSupplyUnrealizedPattern2)
* @typedef {{ name: string, title: string, color: Color, tree: EmptyPattern, addressCount: AddressCountDeltaPattern }} CohortAddr
* @typedef {{ name: string, title: string, color: Color, tree: EmptyPattern, addressCount: AddrCountPattern }} CohortAddr
*
* ============================================================================
* Cohort Group Types (by capability)
@@ -333,7 +333,7 @@
* @property {string} title
* @property {Color} color
* @property {AddrCohortPattern} tree
* @property {AddressCountDeltaPattern} addressCount
* @property {AddrCountPattern} addressCount
*
* @typedef {UtxoCohortObject | AddrCohortObject | CohortWithoutRelative} CohortObject
*