global: v0.2 incoming

This commit is contained in:
nym21
2026-03-21 23:05:27 +01:00
parent 926721c482
commit ef491a3a66
26 changed files with 1718 additions and 16196 deletions

View File

@@ -266,7 +266,7 @@ export function createCointimeSection() {
}),
line({
series: activity.ratio,
name: "L/V Ratio",
name: "Liveliness / Vaultedness",
color: colors.activity,
unit: Unit.ratio,
defaultActive: false,

View File

@@ -66,7 +66,7 @@ function volumeTree(tv, color, title) {
})),
{
name: "Cumulative",
title: title("Cumulative Transfer Volume"),
title: title("Cumulative Transfer Volume Profitability"),
bottom: [
...satsBtcUsd({
pattern: tv.inProfit.cumulative,
@@ -231,7 +231,7 @@ function singleSellSideRiskTree(sellSideRisk, title) {
title: title(`${w.title} Sell Side Risk`),
bottom: percentRatio({
pattern: sellSideRisk[w.key],
name: "Risk",
name: "Sell Side Risk",
color: w.color,
}),
})),
@@ -381,7 +381,7 @@ export function createGroupedActivitySectionMinimal({ list, all, title }) {
return {
name: "Activity",
tree: groupedWindowsCumulativeSatsBtcUsd({
list, all, title, metricTitle: "Volume",
list, all, title, metricTitle: "Transfer Volume",
getMetric: (c) => c.tree.activity.transferVolume,
}),
};

View File

@@ -28,7 +28,7 @@ function percentileSeries(p, n = (x) => x) {
.map(([key, s], i, arr) =>
price({
series: s,
name: n(key.replace("pct", "p")),
name: n(key.replace("pct", "P")),
color: colors.at(i, arr.length),
...(ACTIVE_PCTS.has(key) ? {} : { defaultActive: false }),
}),
@@ -70,9 +70,9 @@ function singleWeightFolder({ avgPrice, avgName, inProfit, inLoss, percentiles,
title: title(`Cost Basis Distribution (${weightLabel})`),
top: [
price({ series: avgPrice, name: avgName, color }),
...(max ? [price({ series: max, name: "p100", color: colors.stat.max, defaultActive: false })] : []),
...(max ? [price({ series: max, name: "P100", color: colors.stat.max, defaultActive: false })] : []),
...percentileSeries(percentiles),
...(min ? [price({ series: min, name: "p0", color: colors.stat.min, defaultActive: false })] : []),
...(min ? [price({ series: min, name: "P0", color: colors.stat.min, defaultActive: false })] : []),
],
},
];

View File

@@ -18,12 +18,14 @@ import {
rollingPercentRatioTree,
percentRatio,
percentRatioBaseline,
chartsFromCount,
} from "../series.js";
import {
satsBtcUsd,
flatMapCohorts,
mapCohortsWithAll,
flatMapCohortsWithAll,
groupedWindowsCumulative,
} from "../shared.js";
import { colors } from "../../utils/colors.js";
import { priceLines } from "../constants.js";
@@ -46,18 +48,39 @@ function simpleSupplySeries(supply) {
* @param {CohortAll} all
* @param {(name: string) => string} title
*/
function groupedUtxoCountFolder(list, all, title) {
function groupedOutputsFolder(list, all, title) {
return {
name: "UTXOs",
name: "Outputs",
tree: [
{
name: "Count",
title: title("UTXO Count"),
name: "Unspent",
tree: [
{
name: "Count",
title: title("UTXO Count"),
bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) =>
line({ series: tree.outputs.unspentCount.base, name, color, unit: Unit.count }),
),
},
...groupedDeltaItems(list, all, (c) => c.tree.outputs.unspentCount.delta, Unit.count, title, "UTXO Count"),
],
},
{
name: "Spent",
tree: groupedWindowsCumulative({
list, all, title, metricTitle: "Spent UTXO Count",
getWindowSeries: (c, key) => c.tree.outputs.spentCount.sum[key],
getCumulativeSeries: (c) => c.tree.outputs.spentCount.cumulative,
seriesFn: line, unit: Unit.count,
}),
},
{
name: "Spending Rate",
title: title("Spending Rate"),
bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) =>
line({ series: tree.outputs.unspentCount.base, name, color, unit: Unit.count }),
line({ series: tree.outputs.spendingRate, name, color, unit: Unit.ratio }),
),
},
...groupedDeltaItems(list, all, (c) => c.tree.outputs.unspentCount.delta, Unit.count, title, "UTXO Count"),
],
};
}
@@ -211,7 +234,32 @@ function ownSupplyChart(supply, title) {
}
/**
* Count folder (UTXO or Address) with value + change
* @param {OutputsPattern} outputs
* @param {Color} color
* @param {(name: string) => string} title
* @returns {PartialOptionsGroup}
*/
function outputsFolder(outputs, color, title) {
return {
name: "Outputs",
tree: [
countFolder(outputs.unspentCount, "Unspent", "UTXO Count", color, title),
{
name: "Spent",
tree: chartsFromCount({ pattern: outputs.spentCount, title, metric: "Spent UTXO Count", unit: Unit.count, color }),
},
{
name: "Spending Rate",
title: title("Spending Rate"),
bottom: [
line({ series: outputs.spendingRate, name: "Rate", color, unit: Unit.ratio }),
],
},
],
};
}
/**
* @param {{ base: AnySeriesPattern, delta: DeltaPattern }} pattern
* @param {string} name
* @param {string} chartTitle
@@ -262,7 +310,7 @@ export function createHoldingsSection({ cohort, title }) {
...singleDeltaItems(supply.delta, Unit.sats, title, "Supply"),
],
},
countFolder(cohort.tree.outputs.unspentCount, "UTXOs", "UTXO Count", cohort.color, title),
outputsFolder(cohort.tree.outputs, cohort.color, title),
];
}
@@ -286,7 +334,7 @@ export function createHoldingsSectionAll({ cohort, title }) {
...singleDeltaItems(supply.delta, Unit.sats, title, "Supply"),
],
},
countFolder(cohort.tree.outputs.unspentCount, "UTXOs", "UTXO Count", cohort.color, title),
outputsFolder(cohort.tree.outputs, cohort.color, title),
countFolder(cohort.addressCount, "Addresses", "Address Count", cohort.color, title),
];
}
@@ -312,7 +360,7 @@ export function createHoldingsSectionWithRelative({ cohort, title }) {
...singleDeltaItems(supply.delta, Unit.sats, title, "Supply"),
],
},
countFolder(cohort.tree.outputs.unspentCount, "UTXOs", "UTXO Count", cohort.color, title),
outputsFolder(cohort.tree.outputs, cohort.color, title),
];
}
@@ -336,7 +384,7 @@ export function createHoldingsSectionWithOwnSupply({ cohort, title }) {
...singleDeltaItems(supply.delta, Unit.sats, title, "Supply"),
],
},
countFolder(cohort.tree.outputs.unspentCount, "UTXOs", "UTXO Count", cohort.color, title),
outputsFolder(cohort.tree.outputs, cohort.color, title),
];
}
@@ -359,7 +407,7 @@ export function createHoldingsSectionWithProfitLoss({ cohort, title }) {
...singleDeltaItems(supply.delta, Unit.sats, title, "Supply"),
],
},
countFolder(cohort.tree.outputs.unspentCount, "UTXOs", "UTXO Count", cohort.color, title),
outputsFolder(cohort.tree.outputs, cohort.color, title),
];
}
@@ -382,7 +430,7 @@ export function createHoldingsSectionAddress({ cohort, title }) {
...singleDeltaItems(supply.delta, Unit.sats, title, "Supply"),
],
},
countFolder(cohort.tree.outputs.unspentCount, "UTXOs", "UTXO Count", cohort.color, title),
outputsFolder(cohort.tree.outputs, cohort.color, title),
countFolder(cohort.addressCount, "Addresses", "Address Count", cohort.color, title),
];
}
@@ -405,7 +453,7 @@ export function createHoldingsSectionAddressAmount({ cohort, title }) {
...singleDeltaItems(supply.delta, Unit.sats, title, "Supply"),
],
},
countFolder(cohort.tree.outputs.unspentCount, "UTXOs", "UTXO Count", cohort.color, title),
outputsFolder(cohort.tree.outputs, cohort.color, title),
countFolder(cohort.addressCount, "Addresses", "Address Count", cohort.color, title),
];
}
@@ -457,7 +505,7 @@ export function createGroupedHoldingsSectionAddress({ list, all, title }) {
...groupedDeltaItems(list, all, (c) => c.tree.supply.delta, Unit.sats, title, "Supply"),
],
},
groupedUtxoCountFolder(list, all, title),
groupedOutputsFolder(list, all, title),
{
name: "Addresses",
tree: [
@@ -488,7 +536,7 @@ export function createGroupedHoldingsSectionAddressAmount({ list, all, title })
...groupedDeltaItems(list, all, (c) => c.tree.supply.delta, Unit.sats, title, "Supply"),
],
},
groupedUtxoCountFolder(list, all, title),
groupedOutputsFolder(list, all, title),
{
name: "Addresses",
tree: [
@@ -515,7 +563,7 @@ export function createGroupedHoldingsSection({ list, all, title }) {
...groupedDeltaItems(list, all, (c) => c.tree.supply.delta, Unit.sats, title, "Supply"),
],
},
groupedUtxoCountFolder(list, all, title),
groupedOutputsFolder(list, all, title),
];
}
@@ -530,7 +578,7 @@ export function createGroupedHoldingsSectionWithProfitLoss({ list, all, title })
...groupedDeltaItems(list, all, (c) => c.tree.supply.delta, Unit.sats, title, "Supply"),
],
},
groupedUtxoCountFolder(list, all, title),
groupedOutputsFolder(list, all, title),
];
}
@@ -546,7 +594,7 @@ export function createGroupedHoldingsSectionWithOwnSupply({ list, all, title })
...groupedDeltaItems(list, all, (c) => c.tree.supply.delta, Unit.sats, title, "Supply"),
],
},
groupedUtxoCountFolder(list, all, title),
groupedOutputsFolder(list, all, title),
];
}
@@ -568,6 +616,6 @@ export function createGroupedHoldingsSectionWithRelative({ list, all, title }) {
...groupedDeltaItems(list, all, (c) => c.tree.supply.delta, Unit.sats, title, "Supply"),
],
},
groupedUtxoCountFolder(list, all, title),
groupedOutputsFolder(list, all, title),
];
}

View File

@@ -496,10 +496,11 @@ export function createGroupedAddressCohortFolder({
/**
* @param {{ name: string, color: Color, pattern: RealizedSupplyPattern }} bucket
* @param {string} [parentName]
* @returns {PartialOptionsGroup}
*/
function singleBucketFolder({ name, color, pattern }) {
const title = formatCohortTitle(name);
function singleBucketFolder({ name, color, pattern }, parentName) {
const title = formatCohortTitle(parentName ? `${parentName} ${name}` : name);
return {
name,
tree: [
@@ -507,7 +508,7 @@ function singleBucketFolder({ name, color, pattern }) {
name: "Supply",
tree: [
{
name: "Value",
name: "Total",
title: title("Supply"),
bottom: [
...satsBtcUsd({ pattern: pattern.supply.all, name: "Total" }),
@@ -519,26 +520,21 @@ function singleBucketFolder({ name, color, pattern }) {
],
},
{
...sumsTreeBaseline({
windows: pattern.supply.all.delta.absolute,
title,
metric: "Supply Change",
unit: Unit.sats,
}),
name: "Change",
tree: [
{
...sumsTreeBaseline({
windows: pattern.supply.all.delta.absolute,
title,
metric: "Supply Change",
unit: Unit.sats,
}),
name: "Change",
},
{
...rollingPercentRatioTree({
windows: pattern.supply.all.delta.rate,
title,
metric: "Supply Growth Rate",
}),
name: "Growth Rate",
},
],
},
{
...rollingPercentRatioTree({
windows: pattern.supply.all.delta.rate,
title,
metric: "Supply Growth Rate",
}),
name: "Growth Rate",
},
],
},
@@ -559,6 +555,23 @@ function singleBucketFolder({ name, color, pattern }) {
}),
],
},
{
name: "Unrealized PnL",
title: title("Unrealized PnL"),
bottom: [
line({
series: pattern.unrealizedPnl.all,
name: "Total",
unit: Unit.usd,
}),
line({
series: pattern.unrealizedPnl.sth,
name: "STH",
color: colors.term.short,
unit: Unit.usd,
}),
],
},
{
name: "NUPL",
title: title("NUPL"),
@@ -599,65 +612,60 @@ function groupedBucketCharts(list, groupTitle) {
name: "Change",
tree: [
{
name: "Change",
tree: [
{
name: "Compare",
title: title("Supply Change"),
bottom: ROLLING_WINDOWS.flatMap((w) =>
list.map(({ name, color, pattern }) =>
baseline({
series: pattern.supply.all.delta.absolute[w.key],
name: `${name} ${w.name}`,
color,
unit: Unit.sats,
}),
),
),
},
...ROLLING_WINDOWS.map((w) => ({
name: w.name,
title: title(`${w.title} Supply Change`),
bottom: list.map(({ name, color, pattern }) =>
baseline({
series: pattern.supply.all.delta.absolute[w.key],
name,
color,
unit: Unit.sats,
}),
),
})),
],
name: "Compare",
title: title("Supply Change"),
bottom: ROLLING_WINDOWS.flatMap((w) =>
list.map(({ name, color, pattern }) =>
baseline({
series: pattern.supply.all.delta.absolute[w.key],
name: `${name} ${w.name}`,
color,
unit: Unit.sats,
}),
),
),
},
...ROLLING_WINDOWS.map((w) => ({
name: w.name,
title: title(`${w.title} Supply Change`),
bottom: list.map(({ name, color, pattern }) =>
baseline({
series: pattern.supply.all.delta.absolute[w.key],
name,
color,
unit: Unit.sats,
}),
),
})),
],
},
{
name: "Growth Rate",
tree: [
{
name: "Growth Rate",
tree: [
{
name: "Compare",
title: title("Supply Growth Rate"),
bottom: ROLLING_WINDOWS.flatMap((w) =>
list.flatMap(({ name, color, pattern }) =>
percentRatio({
pattern: pattern.supply.all.delta.rate[w.key],
name: `${name} ${w.name}`,
color,
}),
),
),
},
...ROLLING_WINDOWS.map((w) => ({
name: w.name,
title: title(`${w.title} Supply Growth Rate`),
bottom: list.flatMap(({ name, color, pattern }) =>
percentRatio({
pattern: pattern.supply.all.delta.rate[w.key],
name,
color,
}),
),
})),
],
name: "Compare",
title: title("Supply Growth Rate"),
bottom: ROLLING_WINDOWS.flatMap((w) =>
list.flatMap(({ name, color, pattern }) =>
percentRatio({
pattern: pattern.supply.all.delta.rate[w.key],
name: `${name} ${w.name}`,
color,
}),
),
),
},
...ROLLING_WINDOWS.map((w) => ({
name: w.name,
title: title(`${w.title} Supply Growth Rate`),
bottom: list.flatMap(({ name, color, pattern }) =>
percentRatio({
pattern: pattern.supply.all.delta.rate[w.key],
name,
color,
}),
),
})),
],
},
],
@@ -691,6 +699,35 @@ function groupedBucketCharts(list, groupTitle) {
},
],
},
{
name: "Unrealized PnL",
tree: [
{
name: "All",
title: title("Unrealized PnL"),
bottom: list.map(({ name, color, pattern }) =>
line({
series: pattern.unrealizedPnl.all,
name,
color,
unit: Unit.usd,
}),
),
},
{
name: "STH",
title: title("STH Unrealized PnL"),
bottom: list.map(({ name, color, pattern }) =>
line({
series: pattern.unrealizedPnl.sth,
name,
color,
unit: Unit.usd,
}),
),
},
],
},
{
name: "NUPL",
title: title("NUPL"),
@@ -716,21 +753,21 @@ export function createUtxoProfitabilitySection({ range, profit, loss }) {
name: "Compare",
tree: groupedBucketCharts(range, "Profitability Range"),
},
...range.map(singleBucketFolder),
...range.map((bucket) => singleBucketFolder(bucket)),
],
},
{
name: "In Profit",
tree: [
{ name: "Compare", tree: groupedBucketCharts(profit, "In Profit") },
...profit.map(singleBucketFolder),
...profit.map((bucket) => singleBucketFolder(bucket, "In Profit")),
],
},
{
name: "In Loss",
tree: [
{ name: "Compare", tree: groupedBucketCharts(loss, "In Loss") },
...loss.map(singleBucketFolder),
...loss.map((bucket) => singleBucketFolder(bucket, "In Loss")),
],
},
],

View File

@@ -40,7 +40,7 @@ export function createPricesSectionFull({ cohort, title }) {
{
name: "Realized",
tree: createPriceRatioCharts({
context: cohort.name,
context: cohort.title,
legend: "Realized",
pricePattern: tree.realized.price,
ratio: tree.realized.price,
@@ -54,6 +54,7 @@ export function createPricesSectionFull({ cohort, title }) {
tree: priceRatioPercentilesTree({
pattern: tree.realized.investor.price,
title: title("Investor Price"),
ratioTitle: title("Investor Price Ratio"),
legend: "Investor",
color,
}),
@@ -82,24 +83,12 @@ export function createPricesSectionBasic({ cohort, title }) {
top: [price({ series: tree.realized.price, name: "Realized", color })],
},
{
name: "MVRV",
title: title("MVRV"),
bottom: [
baseline({
series: tree.realized.mvrv,
name: "MVRV",
unit: Unit.ratio,
base: 1,
}),
],
},
{
name: "Price Ratio",
name: "Ratio",
title: title("Realized Price Ratio"),
bottom: [
baseline({
series: tree.realized.price.ratio,
name: "Price Ratio",
name: "Ratio",
unit: Unit.ratio,
base: 1,
}),
@@ -136,7 +125,7 @@ function groupedRealizedPriceItems(list, all, title) {
},
{
name: "Ratio",
title: title("MVRV"),
title: title("Realized Price Ratio"),
bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) =>
baseline({ series: tree.realized.mvrv, name, color, unit: Unit.ratio, base: 1 }),
),

View File

@@ -61,7 +61,7 @@ function unrealizedOverview(profit, loss, netPnlUsd, title) {
}),
dotted({
series: loss.negative,
name: "Neg. Loss",
name: "Negated Loss",
color: colors.loss,
unit: Unit.usd,
}),
@@ -233,12 +233,19 @@ function unrealizedTreeLongTerm(u, title) {
ownPnlChart(u, title),
{
name: "% of Market Cap",
title: title("Unrealized Loss (% of Market Cap)"),
bottom: percentRatio({
pattern: u.loss.toMcap,
name: "Loss",
color: colors.loss,
}),
title: title("Unrealized P&L (% of Market Cap)"),
bottom: [
...percentRatio({
pattern: u.profit.toMcap,
name: "Profit",
color: colors.profit,
}),
...percentRatio({
pattern: u.loss.toMcap,
name: "Loss",
color: colors.loss,
}),
],
},
relPnlChartWithNet(u.netPnl.toOwnMcap, u.profit.toOwnMcap, u.loss.toOwnMcap, "% of Own Market Cap", title),
];
@@ -448,7 +455,7 @@ function realizedOverviewFolder({
}),
dotted({
series: loss.negative.sum[w.key],
name: "Neg. Loss",
name: "Negated Loss",
color: colors.loss,
unit: Unit.usd,
}),
@@ -518,7 +525,7 @@ function realizedSubfolderFull(r, title) {
title: title("Net Realized P&L Change (% of Market Cap)"),
bottom: percentRatioBaseline({
pattern: r.netPnl.change1m.toMcap,
name: "30d Change",
name: "1m Change",
}),
},
{
@@ -526,7 +533,7 @@ function realizedSubfolderFull(r, title) {
title: title("Net Realized P&L Change (% of Realized Cap)"),
bottom: percentRatioBaseline({
pattern: r.netPnl.change1m.toRcap,
name: "30d Change",
name: "1m Change",
}),
},
],
@@ -740,7 +747,7 @@ export function createProfitabilitySectionWithProfitLoss({ cohort, title }) {
title: title("Unrealized P&L"),
bottom: [
line({ series: u.profit.usd, name: "Profit", color: colors.profit, unit: Unit.usd }),
line({ series: u.loss.negative, name: "Neg. Loss", color: colors.loss, unit: Unit.usd }),
line({ series: u.loss.negative, name: "Negated Loss", color: colors.loss, unit: Unit.usd }),
line({ series: u.loss.usd, name: "Loss", color: colors.loss, unit: Unit.usd, defaultActive: false }),
priceLine({ unit: Unit.usd }),
],
@@ -997,7 +1004,7 @@ function groupedRealizedSubfolderFull(list, all, title) {
list,
all,
title,
metricTitle: "Gross Realized P&L",
metricTitle: "Realized Gross P&L",
getMetric: (c) => c.tree.realized.grossPnl,
}),
},

View File

@@ -89,7 +89,7 @@ export function createValuationSectionFull({ cohort, title }) {
},
{ name: "MVRV", title: title("MVRV"), bottom: ratioBottomSeries(tree.realized.price) },
...singleDeltaItems(tree, title),
{ name: "% of Own Market Cap", title: title("Realized Cap (% of Own Market Cap)"), bottom: percentRatioBaseline({ pattern: tree.realized.cap.toOwnMcap, name: "Rel. to Own Market Cap", color }) },
{ name: "% of Own Market Cap", title: title("Realized Cap (% of Own Market Cap)"), bottom: percentRatioBaseline({ pattern: tree.realized.cap.toOwnMcap, name: "% of Own Market Cap", color }) },
],
};
}

View File

@@ -231,7 +231,7 @@ function createSingleEntryTree(item, returnsBottom) {
* @param {BaseEntryItem & { titlePrefix?: string }} item
*/
function createShortSingleEntry(item) {
return createSingleEntryTree(item, percentRatioBaseline({ pattern: item.returns, name: "Current" }));
return createSingleEntryTree(item, percentRatioBaseline({ pattern: item.returns, name: "Return" }));
}
/**
@@ -249,7 +249,7 @@ function createLongSingleEntry(item) {
name: "Returns",
title: `Returns: ${titlePrefix}`,
top,
bottom: percentRatioBaseline({ pattern: returns, name: "Current" }),
bottom: percentRatioBaseline({ pattern: returns, name: "Return" }),
},
{
name: "CAGR",

View File

@@ -86,7 +86,7 @@ function createMaSubSection(label, averages) {
tree: simplePriceRatioTree({
pattern: a.ratio,
title: `${periodIdToName(a.id, true)} ${label}`,
legend: "average",
legend: "Average",
color: a.color,
}),
});
@@ -204,14 +204,14 @@ function historicalSubSection(name, periods) {
tree: [
{
name: "Compare",
title: `${name} Historical`,
title: `${name} Historical Prices`,
top: periods.map((p) =>
price({ series: p.lookback, name: p.id, color: p.color }),
),
},
...periods.map((p) => ({
name: periodIdToName(p.id, true),
title: `${periodIdToName(p.id, true)} Ago`,
title: `Price ${periodIdToName(p.id)} Ago`,
top: [price({ series: p.lookback, name: "Price" })],
})),
],
@@ -438,23 +438,23 @@ export function createMarketSection() {
bottom: [
line({
series: ath.daysSince,
name: "Since",
name: "Days",
unit: Unit.days,
}),
line({
series: ath.yearsSince,
name: "Since",
name: "Years",
unit: Unit.years,
}),
line({
series: ath.maxDaysBetween,
name: "Max",
name: "Max Days",
color: colors.loss,
unit: Unit.days,
}),
line({
series: ath.maxYearsBetween,
name: "Max",
name: "Max Years",
color: colors.loss,
unit: Unit.years,
}),
@@ -490,7 +490,7 @@ export function createMarketSection() {
tree: [
{
name: "Compare",
title: "Historical Comparison",
title: "Historical Price Comparison",
top: [...shortPeriods, ...longPeriods].map((p) =>
price({
series: p.lookback,
@@ -511,7 +511,7 @@ export function createMarketSection() {
tree: [
{
name: "Compare",
title: "Market vs Realized Capitalization",
title: "Market vs Realized Cap",
bottom: [
line({
series: supply.marketCap.usd,
@@ -553,7 +553,7 @@ export function createMarketSection() {
tree: [
{
name: "Value",
title: "Realized Capitalization",
title: "Realized Cap",
bottom: [
line({
series: cohorts.utxo.all.realized.cap.usd,
@@ -802,11 +802,11 @@ export function createMarketSection() {
tree: [
{
name: "Daily",
title: "True Range (Daily)",
title: "Daily True Range",
bottom: [
line({
series: range.trueRange,
name: "Daily",
name: "True Range",
color: colors.time._24h,
unit: Unit.usd,
}),
@@ -814,7 +814,7 @@ export function createMarketSection() {
},
{
name: "2 Week Sum",
title: "True Range (2 Week Sum)",
title: "2 Week True Range Sum",
bottom: [
line({
series: range.trueRangeSum2w,
@@ -867,7 +867,7 @@ export function createMarketSection() {
],
},
{
name: "MinMax",
name: "Min/Max",
tree: [
{
id: "1w",
@@ -895,7 +895,7 @@ export function createMarketSection() {
},
].map((p) => ({
name: p.id,
title: `${p.name} MinMax`,
title: `${p.name} Min/Max`,
top: [
price({
series: p.max,

View File

@@ -299,7 +299,7 @@ export function createMiningSection() {
tree: [
...ROLLING_WINDOWS.map((w) => ({
name: w.name,
title: `${w.title} Revenue`,
title: `${w.title} Mining Revenue`,
bottom: revenueRollingBtcSatsUsd({
coinbase: mining.rewards.coinbase.average[w.key],
subsidy: mining.rewards.subsidy.average[w.key],
@@ -308,7 +308,7 @@ export function createMiningSection() {
})),
{
name: "Cumulative",
title: "Revenue Comparison (Total)",
title: "Cumulative Mining Revenue",
bottom: revenueBtcSatsUsd({
coinbase: mining.rewards.coinbase,
subsidy: mining.rewards.subsidy,
@@ -338,7 +338,7 @@ export function createMiningSection() {
metric: "Transaction Fee Revenue",
}),
{
name: "Distributions",
name: "Distribution",
tree: ROLLING_WINDOWS.map((w) => ({
name: w.name,
title: `${w.title} Fee Revenue per Block Distribution`,
@@ -352,15 +352,15 @@ export function createMiningSection() {
tree: [
...ROLLING_WINDOWS.map((w) => ({
name: w.name,
title: `${w.title} Revenue Dominance`,
title: `${w.title} Mining Revenue Dominance`,
bottom: [
...percentRatio({ pattern: mining.rewards.subsidy.dominance[w.key], name: "Subsidy", color: colors.mining.subsidy }),
...percentRatio({ pattern: mining.rewards.fees.dominance[w.key], name: "Fees", color: colors.mining.fee }),
],
})),
{
name: "All-time",
title: "Revenue Dominance (All-time)",
name: "All Time",
title: "All Time Mining Revenue Dominance",
bottom: [
...percentRatio({ pattern: mining.rewards.subsidy.dominance, name: "Subsidy", color: colors.mining.subsidy }),
...percentRatio({ pattern: mining.rewards.fees.dominance, name: "Fees", color: colors.mining.fee }),
@@ -369,7 +369,7 @@ export function createMiningSection() {
],
},
{
name: "Fee Multiple",
name: "Fee-to-Subsidy",
tree: ROLLING_WINDOWS.map((w) => ({
name: w.name,
title: `${w.title} Fee-to-Subsidy Ratio`,
@@ -378,11 +378,11 @@ export function createMiningSection() {
},
{
name: "Unclaimed",
title: "Unclaimed Rewards (Total)",
title: "Unclaimed Rewards",
bottom: satsBtcUsdFrom({
source: mining.rewards.unclaimed,
key: "cumulative",
name: "all-time",
name: "All Time",
}),
},
],
@@ -397,8 +397,8 @@ export function createMiningSection() {
bottom: [
line({ series: mining.hashrate.price.ths, name: "TH/s", color: colors.usd, unit: Unit.usdPerThsPerDay }),
line({ series: mining.hashrate.price.phs, name: "PH/s", color: colors.usd, unit: Unit.usdPerPhsPerDay }),
dotted({ series: mining.hashrate.price.thsMin, name: "TH/s Min", color: colors.stat.min, unit: Unit.usdPerThsPerDay }),
dotted({ series: mining.hashrate.price.phsMin, name: "PH/s Min", color: colors.stat.min, unit: Unit.usdPerPhsPerDay }),
dotted({ series: mining.hashrate.price.thsMin, name: "TH/s ATL", color: colors.stat.min, unit: Unit.usdPerThsPerDay }),
dotted({ series: mining.hashrate.price.phsMin, name: "PH/s ATL", color: colors.stat.min, unit: Unit.usdPerPhsPerDay }),
],
},
{
@@ -407,13 +407,13 @@ export function createMiningSection() {
bottom: [
line({ series: mining.hashrate.value.ths, name: "TH/s", color: colors.bitcoin, unit: Unit.satsPerThsPerDay }),
line({ series: mining.hashrate.value.phs, name: "PH/s", color: colors.bitcoin, unit: Unit.satsPerPhsPerDay }),
dotted({ series: mining.hashrate.value.thsMin, name: "TH/s Min", color: colors.stat.min, unit: Unit.satsPerThsPerDay }),
dotted({ series: mining.hashrate.value.phsMin, name: "PH/s Min", color: colors.stat.min, unit: Unit.satsPerPhsPerDay }),
dotted({ series: mining.hashrate.value.thsMin, name: "TH/s ATL", color: colors.stat.min, unit: Unit.satsPerThsPerDay }),
dotted({ series: mining.hashrate.value.phsMin, name: "PH/s ATL", color: colors.stat.min, unit: Unit.satsPerPhsPerDay }),
],
},
{
name: "Recovery",
title: "Recovery",
title: "Mining Recovery",
bottom: [
...percentRatio({ pattern: mining.hashrate.price.rebound, name: "Hash Price", color: colors.usd }),
...percentRatio({ pattern: mining.hashrate.value.rebound, name: "Hash Value", color: colors.bitcoin }),
@@ -429,8 +429,8 @@ export function createMiningSection() {
name: "Countdown",
title: "Next Halving",
bottom: [
line({ series: blocks.halving.blocksToHalving, name: "Remaining", unit: Unit.blocks }),
line({ series: blocks.halving.daysToHalving, name: "Remaining", unit: Unit.days }),
line({ series: blocks.halving.blocksToHalving, name: "Blocks", unit: Unit.blocks }),
line({ series: blocks.halving.daysToHalving, name: "Days", unit: Unit.days }),
],
},
{
@@ -458,8 +458,8 @@ export function createMiningSection() {
name: "Countdown",
title: "Next Difficulty Adjustment",
bottom: [
line({ series: blocks.difficulty.blocksToRetarget, name: "Remaining", unit: Unit.blocks }),
line({ series: blocks.difficulty.daysToRetarget, name: "Remaining", unit: Unit.days }),
line({ series: blocks.difficulty.blocksToRetarget, name: "Blocks", unit: Unit.blocks }),
line({ series: blocks.difficulty.daysToRetarget, name: "Days", unit: Unit.days }),
],
},
{

View File

@@ -7,6 +7,7 @@ import { entries } from "../utils/array.js";
import {
line,
fromSupplyPattern,
chartsFromFull,
chartsFromFullPerBlock,
chartsFromCount,
chartsFromCountEntries,
@@ -80,7 +81,7 @@ export function createNetworkSection() {
const activityTypes = /** @type {const} */ ([
{ key: "sending", name: "Sending" },
{ key: "receiving", name: "Receiving" },
{ key: "both", name: "Both" },
{ key: "both", name: "Sending & Receiving" },
{ key: "reactivated", name: "Reactivated" },
]);
@@ -227,7 +228,7 @@ export function createNetworkSection() {
})),
{
name: "Cumulative",
title: `${groupName} Output Count (Total)`,
title: `Cumulative ${groupName} Output Count`,
bottom: types.map((t) =>
line({
series: scripts.count[t.key].cumulative,
@@ -288,7 +289,7 @@ export function createNetworkSection() {
bottom: satsBtcUsdFrom({
source: supply.burned,
key: "cumulative",
name: "all-time",
name: "All Time",
}),
},
{
@@ -296,7 +297,7 @@ export function createNetworkSection() {
title: "OP_RETURN Burned",
bottom: satsBtcUsd({
pattern: scripts.value.opReturn.cumulative,
name: "all-time",
name: "All Time",
}),
},
],
@@ -420,11 +421,11 @@ export function createNetworkSection() {
})),
{
name: "Cumulative",
title: "Block Count (Total)",
title: "Cumulative Block Count",
bottom: [
{
series: blocks.count.total.cumulative,
title: "all-time",
title: "All Time",
unit: Unit.count,
},
],
@@ -441,7 +442,7 @@ export function createNetworkSection() {
},
{
name: "Size",
tree: chartsFromFullPerBlock({
tree: chartsFromFull({
pattern: blocks.size,
metric: "Block Size",
unit: Unit.bytes,
@@ -449,7 +450,7 @@ export function createNetworkSection() {
},
{
name: "Weight",
tree: chartsFromFullPerBlock({
tree: chartsFromFull({
pattern: blocks.weight,
metric: "Block Weight",
unit: Unit.wu,
@@ -457,7 +458,7 @@ export function createNetworkSection() {
},
{
name: "vBytes",
tree: chartsFromFullPerBlock({
tree: chartsFromFull({
pattern: blocks.vbytes,
metric: "Block vBytes",
unit: Unit.vb,
@@ -612,7 +613,7 @@ export function createNetworkSection() {
})),
{
name: "Cumulative",
title: "Output Count by Script Type (Total)",
title: "Cumulative Output Count by Script Type",
bottom: scriptTypes.map((t) =>
line({
series: scripts.count[t.key].cumulative,

View File

@@ -101,13 +101,13 @@ function percentileSeries({ pattern, unit, title = "" }) {
}),
line({
series: pattern.pct90,
name: `${title} pct90`.trim(),
name: `${title} P90`.trim(),
color: stat.pct90,
unit,
}),
line({
series: pattern.pct75,
name: `${title} pct75`.trim(),
name: `${title} P75`.trim(),
color: stat.pct75,
unit,
}),
@@ -119,13 +119,13 @@ function percentileSeries({ pattern, unit, title = "" }) {
}),
line({
series: pattern.pct25,
name: `${title} pct25`.trim(),
name: `${title} P25`.trim(),
color: stat.pct25,
unit,
}),
line({
series: pattern.pct10,
name: `${title} pct10`.trim(),
name: `${title} P10`.trim(),
color: stat.pct10,
unit,
}),
@@ -533,7 +533,7 @@ export function sumsAndAveragesCumulativeWith({
{
name: "Cumulative",
title: title(`Cumulative ${metric}`),
bottom: series({ pattern: cumulative, name: "all-time", color }),
bottom: series({ pattern: cumulative, name: "All Time", color }),
},
];
}

View File

@@ -276,12 +276,12 @@ export function simplePriceRatioTree({ pattern, title, legend, color }) {
*/
function percentileBands(p, extract) {
return [
{ name: "pct95", prop: extract(p.pct95), color: colors.ratioPct._95 },
{ name: "pct5", prop: extract(p.pct5), color: colors.ratioPct._5 },
{ name: "pct98", prop: extract(p.pct98), color: colors.ratioPct._98 },
{ name: "pct2", prop: extract(p.pct2), color: colors.ratioPct._2 },
{ name: "pct99", prop: extract(p.pct99), color: colors.ratioPct._99 },
{ name: "pct1", prop: extract(p.pct1), color: colors.ratioPct._1 },
{ name: "P95", prop: extract(p.pct95), color: colors.ratioPct._95 },
{ name: "P5", prop: extract(p.pct5), color: colors.ratioPct._5 },
{ name: "P98", prop: extract(p.pct98), color: colors.ratioPct._98 },
{ name: "P2", prop: extract(p.pct2), color: colors.ratioPct._2 },
{ name: "P99", prop: extract(p.pct99), color: colors.ratioPct._99 },
{ name: "P1", prop: extract(p.pct1), color: colors.ratioPct._1 },
];
}
@@ -306,6 +306,7 @@ function ratioBands(bands) {
* @param {string} args.title
* @param {string} args.legend
* @param {Color} [args.color]
* @param {string} [args.ratioTitle]
* @param {FetchedPriceSeriesBlueprint[]} [args.priceReferences]
* @returns {PartialOptionsTree}
*/
@@ -314,6 +315,7 @@ export function priceRatioPercentilesTree({
title,
legend,
color,
ratioTitle,
priceReferences,
}) {
const p = pattern.percentiles;
@@ -331,7 +333,7 @@ export function priceRatioPercentilesTree({
},
{
name: "Ratio",
title: `${title} Ratio`,
title: ratioTitle ?? `${title} Ratio`,
top: [
price({ series: pattern, name: legend, color }),
...priceBands(pctUsd),
@@ -384,12 +386,12 @@ export function revenueRollingBtcSatsUsd({ coinbase, subsidy, fee }) {
export function percentileUsdMap(ratio) {
const p = ratio.percentiles;
return /** @type {const} */ ([
{ name: "pct95", prop: p.pct95.price, color: colors.ratioPct._95 },
{ name: "pct5", prop: p.pct5.price, color: colors.ratioPct._5 },
{ name: "pct98", prop: p.pct98.price, color: colors.ratioPct._98 },
{ name: "pct2", prop: p.pct2.price, color: colors.ratioPct._2 },
{ name: "pct99", prop: p.pct99.price, color: colors.ratioPct._99 },
{ name: "pct1", prop: p.pct1.price, color: colors.ratioPct._1 },
{ name: "P95", prop: p.pct95.price, color: colors.ratioPct._95 },
{ name: "P5", prop: p.pct5.price, color: colors.ratioPct._5 },
{ name: "P98", prop: p.pct98.price, color: colors.ratioPct._98 },
{ name: "P2", prop: p.pct2.price, color: colors.ratioPct._2 },
{ name: "P99", prop: p.pct99.price, color: colors.ratioPct._99 },
{ name: "P1", prop: p.pct1.price, color: colors.ratioPct._1 },
]);
}
@@ -400,12 +402,12 @@ export function percentileUsdMap(ratio) {
export function percentileMap(ratio) {
const p = ratio.percentiles;
return /** @type {const} */ ([
{ name: "pct95", prop: p.pct95.ratio, color: colors.ratioPct._95 },
{ name: "pct5", prop: p.pct5.ratio, color: colors.ratioPct._5 },
{ name: "pct98", prop: p.pct98.ratio, color: colors.ratioPct._98 },
{ name: "pct2", prop: p.pct2.ratio, color: colors.ratioPct._2 },
{ name: "pct99", prop: p.pct99.ratio, color: colors.ratioPct._99 },
{ name: "pct1", prop: p.pct1.ratio, color: colors.ratioPct._1 },
{ name: "P95", prop: p.pct95.ratio, color: colors.ratioPct._95 },
{ name: "P5", prop: p.pct5.ratio, color: colors.ratioPct._5 },
{ name: "P98", prop: p.pct98.ratio, color: colors.ratioPct._98 },
{ name: "P2", prop: p.pct2.ratio, color: colors.ratioPct._2 },
{ name: "P99", prop: p.pct99.ratio, color: colors.ratioPct._99 },
{ name: "P1", prop: p.pct1.ratio, color: colors.ratioPct._1 },
]);
}
@@ -417,7 +419,7 @@ export function sdPatterns(ratio) {
return /** @type {const} */ ([
{
nameAddon: "All Time",
titleAddon: "",
titleAddon: "All Time",
sd: ratio.stdDev.all,
smaRatio: ratio.sma.all.ratio,
},
@@ -498,7 +500,7 @@ export function ratioSmas(ratio) {
{ name: "1y SMA", series: ratio.sma._1y.ratio },
{ name: "2y SMA", series: ratio.sma._2y.ratio },
{ name: "4y SMA", series: ratio.sma._4y.ratio },
{ name: "All SMA", series: ratio.sma.all.ratio, color: colors.time.all },
{ name: "All Time SMA", series: ratio.sma.all.ratio, color: colors.time.all },
].map((s, i, arr) => ({ color: colors.at(i, arr.length), ...s }));
}
@@ -542,7 +544,7 @@ export function ratioBottomSeries(ratio) {
*/
export function createRatioChart({ title, pricePattern, ratio, color, name }) {
return {
name: name ?? "ratio",
name: name ?? "Ratio",
title: title(name ?? "Ratio"),
top: [
price({ series: pricePattern, name: "Price", color }),
@@ -583,7 +585,7 @@ export function createZScoresFolder({
{ name: "1y", sd: ratio.stdDev._1y },
{ name: "2y", sd: ratio.stdDev._2y },
{ name: "4y", sd: ratio.stdDev._4y },
{ name: "all", sd: ratio.stdDev.all, color: colors.time.all },
{ name: "All Time", sd: ratio.stdDev.all, color: colors.time.all },
].map((s, i, arr) => ({ color: colors.at(i, arr.length), ...s }));
return {

View File

@@ -10,15 +10,15 @@ export function periodIdToName(id, compoundAdjective) {
const s = compoundAdjective || num === 1 ? "" : "s";
switch (id.slice(-1)) {
case "h":
return `${num} hour${s}`;
return `${num} Hour${s}`;
case "d":
return `${num} day${s}`;
return `${num} Day${s}`;
case "w":
return `${num} week${s}`;
return `${num} Week${s}`;
case "m":
return `${num} month${s}`;
return `${num} Month${s}`;
case "y":
return `${num} year${s}`;
return `${num} Year${s}`;
default:
return id;
}