computer: renames

This commit is contained in:
nym21
2026-01-10 10:23:29 +01:00
parent 69729842a4
commit 3bc0615000
229 changed files with 3203 additions and 3944 deletions
+10 -25
View File
@@ -18,8 +18,7 @@ export function createChainSection(ctx) {
market,
scripts,
supply,
} = brk.tree.computed;
const { indexed } = brk.tree;
} = brk.tree;
/**
* Create sum/cumulative series from a BlockCountPattern
@@ -674,12 +673,8 @@ export function createChainSection(ctx) {
name: "Size",
title: "Transaction Size",
bottom: [
...fromBlockInterval(
transactions.size.txWeight,
"weight",
Unit.wu,
),
...fromBlockInterval(transactions.size.txVsize, "vsize", Unit.vb),
...fromBlockInterval(transactions.size.weight, "weight", Unit.wu),
...fromBlockInterval(transactions.size.vsize, "vsize", Unit.vb),
],
},
{
@@ -687,21 +682,21 @@ export function createChainSection(ctx) {
title: "Transaction Versions",
bottom: [
...fromBlockCount(
transactions.versions.txV1,
transactions.versions.v1,
"v1",
Unit.count,
colors.orange,
colors.red,
),
...fromBlockCount(
transactions.versions.txV2,
transactions.versions.v2,
"v2",
Unit.count,
colors.cyan,
colors.blue,
),
...fromBlockCount(
transactions.versions.txV3,
transactions.versions.v3,
"v3",
Unit.count,
colors.lime,
@@ -714,18 +709,12 @@ export function createChainSection(ctx) {
title: "Transactions Velocity",
bottom: [
s({
metric: brk.mergeMetricPatterns(
supply.velocity.btc.dateindex,
supply.velocity.btc.rest,
),
metric: supply.velocity.btc,
name: "bitcoin",
unit: Unit.ratio,
}),
s({
metric: brk.mergeMetricPatterns(
supply.velocity.usd.dateindex,
supply.velocity.usd.rest,
),
metric: supply.velocity.usd,
name: "dollars",
color: colors.emerald,
unit: Unit.ratio,
@@ -753,9 +742,7 @@ export function createChainSection(ctx) {
{
name: "Count",
title: "Transaction Input Count",
bottom: [
...fromCountPattern2(inputs.count.count, "Input", Unit.count),
],
bottom: [...fromCountPattern2(inputs.count, "Input", Unit.count)],
},
{
name: "Speed",
@@ -778,9 +765,7 @@ export function createChainSection(ctx) {
{
name: "Count",
title: "Transaction Output Count",
bottom: [
...fromCountPattern2(outputs.count.count, "Output", Unit.count),
],
bottom: [...fromCountPattern2(outputs.count, "Output", Unit.count)],
},
{
name: "Speed",
@@ -206,19 +206,13 @@ function createRealizedPnlSection(ctx, args, title) {
title: `Realized Profit And Loss ${title}`,
bottom: [
s({
metric: mergeMetricPatterns(
realized.realizedProfit.base,
realized.realizedProfit.sum,
),
metric: realized.realizedProfit.sum,
name: "Profit",
color: colors.green,
unit: Unit.usd,
}),
s({
metric: mergeMetricPatterns(
realized.realizedLoss.base,
realized.realizedLoss.sum,
),
metric: realized.realizedLoss.sum,
name: "Loss",
color: colors.red,
unit: Unit.usd,
@@ -17,7 +17,10 @@ import {
* @param {T} obj
* @returns {[keyof T & string, T[keyof T & string]][]}
*/
const entries = (obj) => /** @type {[keyof T & string, T[keyof T & string]][]} */ (Object.entries(obj));
const entries = (obj) =>
/** @type {[keyof T & string, T[keyof T & string]][]} */ (
Object.entries(obj)
);
/**
* Build all cohort data from brk tree
@@ -25,8 +28,8 @@ const entries = (obj) => /** @type {[keyof T & string, T[keyof T & string]][]} *
* @param {BrkClient} brk
*/
export function buildCohortData(colors, brk) {
const utxoCohorts = brk.tree.computed.distribution.utxoCohorts;
const addressCohorts = brk.tree.computed.distribution.addressCohorts;
const utxoCohorts = brk.tree.distribution.utxoCohorts;
const addressCohorts = brk.tree.distribution.addressCohorts;
const {
TERM_NAMES,
EPOCH_NAMES,
@@ -13,30 +13,125 @@ export function createSingleSupplySeries(ctx, cohort) {
const { tree } = cohort;
return [
s({ metric: tree.supply.supply.sats, name: "Supply", color: colors.default, unit: Unit.sats }),
s({ metric: tree.supply.supply.bitcoin, name: "Supply", color: colors.default, unit: Unit.btc }),
s({ metric: tree.supply.supply.dollars, name: "Supply", color: colors.default, unit: Unit.usd }),
s({
metric: tree.supply.supply.sats,
name: "Supply",
color: colors.default,
unit: Unit.sats,
}),
s({
metric: tree.supply.supply.bitcoin,
name: "Supply",
color: colors.default,
unit: Unit.btc,
}),
s({
metric: tree.supply.supply.dollars,
name: "Supply",
color: colors.default,
unit: Unit.usd,
}),
...("supplyRelToCirculatingSupply" in tree.relative
? [s({ metric: tree.relative.supplyRelToCirculatingSupply, name: "Supply", color: colors.default, unit: Unit.pctSupply })]
: []),
s({ metric: tree.unrealized.supplyInProfit.sats, name: "In Profit", color: colors.green, unit: Unit.sats }),
s({ metric: tree.unrealized.supplyInProfit.bitcoin, name: "In Profit", color: colors.green, unit: Unit.btc }),
s({ metric: tree.unrealized.supplyInProfit.dollars, name: "In Profit", color: colors.green, unit: Unit.usd }),
s({ metric: tree.unrealized.supplyInLoss.sats, name: "In Loss", color: colors.red, unit: Unit.sats }),
s({ metric: tree.unrealized.supplyInLoss.bitcoin, name: "In Loss", color: colors.red, unit: Unit.btc }),
s({ metric: tree.unrealized.supplyInLoss.dollars, name: "In Loss", color: colors.red, unit: Unit.usd }),
s({ metric: tree.supply.supplyHalf.sats, name: "half", color: colors.gray, unit: Unit.sats, options: { lineStyle: 4 } }),
s({ metric: tree.supply.supplyHalf.bitcoin, name: "half", color: colors.gray, unit: Unit.btc, options: { lineStyle: 4 } }),
s({ metric: tree.supply.supplyHalf.dollars, name: "half", color: colors.gray, unit: Unit.usd, options: { lineStyle: 4 } }),
...("supplyInProfitRelToCirculatingSupply" in tree.relative
? [
s({ metric: tree.relative.supplyInProfitRelToCirculatingSupply, name: "In Profit", color: colors.green, unit: Unit.pctSupply }),
s({ metric: tree.relative.supplyInLossRelToCirculatingSupply, name: "In Loss", color: colors.red, unit: Unit.pctSupply }),
s({
metric: tree.relative.supplyRelToCirculatingSupply,
name: "Supply",
color: colors.default,
unit: Unit.pctSupply,
}),
]
: []),
s({ metric: tree.relative.supplyInProfitRelToOwnSupply, name: "In Profit", color: colors.green, unit: Unit.pctOwn }),
s({ metric: tree.relative.supplyInLossRelToOwnSupply, name: "In Loss", color: colors.red, unit: Unit.pctOwn }),
createPriceLine({ unit: Unit.pctOwn, number: 100, lineStyle: 0, color: colors.default }),
s({
metric: tree.unrealized.supplyInProfit.sats,
name: "In Profit",
color: colors.green,
unit: Unit.sats,
}),
s({
metric: tree.unrealized.supplyInProfit.bitcoin,
name: "In Profit",
color: colors.green,
unit: Unit.btc,
}),
s({
metric: tree.unrealized.supplyInProfit.dollars,
name: "In Profit",
color: colors.green,
unit: Unit.usd,
}),
s({
metric: tree.unrealized.supplyInLoss.sats,
name: "In Loss",
color: colors.red,
unit: Unit.sats,
}),
s({
metric: tree.unrealized.supplyInLoss.bitcoin,
name: "In Loss",
color: colors.red,
unit: Unit.btc,
}),
s({
metric: tree.unrealized.supplyInLoss.dollars,
name: "In Loss",
color: colors.red,
unit: Unit.usd,
}),
s({
metric: tree.supply.supplyHalf.sats,
name: "half",
color: colors.gray,
unit: Unit.sats,
options: { lineStyle: 4 },
}),
s({
metric: tree.supply.supplyHalf.bitcoin,
name: "half",
color: colors.gray,
unit: Unit.btc,
options: { lineStyle: 4 },
}),
s({
metric: tree.supply.supplyHalf.dollars,
name: "half",
color: colors.gray,
unit: Unit.usd,
options: { lineStyle: 4 },
}),
...("supplyInProfitRelToCirculatingSupply" in tree.relative
? [
s({
metric: tree.relative.supplyInProfitRelToCirculatingSupply,
name: "In Profit",
color: colors.green,
unit: Unit.pctSupply,
}),
s({
metric: tree.relative.supplyInLossRelToCirculatingSupply,
name: "In Loss",
color: colors.red,
unit: Unit.pctSupply,
}),
]
: []),
s({
metric: tree.relative.supplyInProfitRelToOwnSupply,
name: "In Profit",
color: colors.green,
unit: Unit.pctOwn,
}),
s({
metric: tree.relative.supplyInLossRelToOwnSupply,
name: "In Loss",
color: colors.red,
unit: Unit.pctOwn,
}),
createPriceLine({
unit: Unit.pctOwn,
number: 100,
lineStyle: 0,
color: colors.default,
}),
createPriceLine({ unit: Unit.pctOwn, number: 50 }),
];
}
@@ -49,14 +144,19 @@ export function createSingleSupplySeries(ctx, cohort) {
*/
export function createGroupedSupplyTotalSeries(ctx, list) {
const { s, brk } = ctx;
const constant100 = brk.tree.computed.constants.constant100;
const constant100 = brk.tree.constants.constant100;
return list.flatMap(({ color, name, tree }) => [
s({ metric: tree.supply.supply.sats, name, color, unit: Unit.sats }),
s({ metric: tree.supply.supply.bitcoin, name, color, unit: Unit.btc }),
s({ metric: tree.supply.supply.dollars, name, color, unit: Unit.usd }),
"supplyRelToCirculatingSupply" in tree.relative
? s({ metric: tree.relative.supplyRelToCirculatingSupply, name, color, unit: Unit.pctSupply })
? s({
metric: tree.relative.supplyRelToCirculatingSupply,
name,
color,
unit: Unit.pctSupply,
})
: s({ metric: constant100, name, color, unit: Unit.pctSupply }),
]);
}
@@ -71,11 +171,33 @@ export function createGroupedSupplyInProfitSeries(ctx, list) {
const { s } = ctx;
return list.flatMap(({ color, name, tree }) => [
s({ metric: tree.unrealized.supplyInProfit.sats, name, color, unit: Unit.sats }),
s({ metric: tree.unrealized.supplyInProfit.bitcoin, name, color, unit: Unit.btc }),
s({ metric: tree.unrealized.supplyInProfit.dollars, name, color, unit: Unit.usd }),
s({
metric: tree.unrealized.supplyInProfit.sats,
name,
color,
unit: Unit.sats,
}),
s({
metric: tree.unrealized.supplyInProfit.bitcoin,
name,
color,
unit: Unit.btc,
}),
s({
metric: tree.unrealized.supplyInProfit.dollars,
name,
color,
unit: Unit.usd,
}),
...("supplyInProfitRelToCirculatingSupply" in tree.relative
? [s({ metric: tree.relative.supplyInProfitRelToCirculatingSupply, name, color, unit: Unit.pctSupply })]
? [
s({
metric: tree.relative.supplyInProfitRelToCirculatingSupply,
name,
color,
unit: Unit.pctSupply,
}),
]
: []),
]);
}
@@ -90,11 +212,33 @@ export function createGroupedSupplyInLossSeries(ctx, list) {
const { s } = ctx;
return list.flatMap(({ color, name, tree }) => [
s({ metric: tree.unrealized.supplyInLoss.sats, name, color, unit: Unit.sats }),
s({ metric: tree.unrealized.supplyInLoss.bitcoin, name, color, unit: Unit.btc }),
s({ metric: tree.unrealized.supplyInLoss.dollars, name, color, unit: Unit.usd }),
s({
metric: tree.unrealized.supplyInLoss.sats,
name,
color,
unit: Unit.sats,
}),
s({
metric: tree.unrealized.supplyInLoss.bitcoin,
name,
color,
unit: Unit.btc,
}),
s({
metric: tree.unrealized.supplyInLoss.dollars,
name,
color,
unit: Unit.usd,
}),
...("supplyInLossRelToCirculatingSupply" in tree.relative
? [s({ metric: tree.relative.supplyInLossRelToCirculatingSupply, name, color, unit: Unit.pctSupply })]
? [
s({
metric: tree.relative.supplyInLossRelToCirculatingSupply,
name,
color,
unit: Unit.pctSupply,
}),
]
: []),
]);
}
@@ -110,7 +254,12 @@ export function createUtxoCountSeries(ctx, list, useGroupName) {
const { s } = ctx;
return list.flatMap(({ color, name, tree }) => [
s({ metric: tree.supply.utxoCount, name: useGroupName ? name : "Count", color, unit: Unit.count }),
s({
metric: tree.supply.utxoCount,
name: useGroupName ? name : "Count",
color,
unit: Unit.count,
}),
]);
}
@@ -159,7 +308,12 @@ export function createRealizedPriceRatioSeries(ctx, list) {
return [
...list.map(({ color, name, tree }) =>
s({ metric: tree.realized.realizedPriceExtra.ratio, name, color, unit: Unit.ratio }),
s({
metric: tree.realized.realizedPriceExtra.ratio,
name,
color,
unit: Unit.ratio,
}),
),
createPriceLine({ unit: Unit.ratio, number: 1 }),
];
@@ -176,7 +330,12 @@ export function createRealizedCapSeries(ctx, list, useGroupName) {
const { s } = ctx;
return list.flatMap(({ color, name, tree }) => [
s({ metric: tree.realized.realizedCap, name: useGroupName ? name : "Capitalization", color, unit: Unit.usd }),
s({
metric: tree.realized.realizedCap,
name: useGroupName ? name : "Capitalization",
color,
unit: Unit.usd,
}),
]);
}
@@ -191,8 +350,18 @@ export function createCostBasisMinMaxSeries(ctx, list, useGroupName) {
const { s } = ctx;
return list.flatMap(({ color, name, tree }) => [
s({ metric: tree.costBasis.minCostBasis, name: useGroupName ? `${name} min` : "Min", color, unit: Unit.usd }),
s({ metric: tree.costBasis.maxCostBasis, name: useGroupName ? `${name} max` : "Max", color, unit: Unit.usd }),
s({
metric: tree.costBasis.minCostBasis,
name: useGroupName ? `${name} min` : "Min",
color,
unit: Unit.usd,
}),
s({
metric: tree.costBasis.maxCostBasis,
name: useGroupName ? `${name} max` : "Max",
color,
unit: Unit.usd,
}),
]);
}
@@ -209,11 +378,40 @@ export function createCostBasisPercentilesSeries(ctx, list, useGroupName) {
return list.flatMap(({ color, name, tree }) => {
const percentiles = tree.costBasis.percentiles;
return [
s({ metric: percentiles.costBasisPct10, name: useGroupName ? `${name} p10` : "p10", color, unit: Unit.usd, defaultActive: false }),
s({ metric: percentiles.costBasisPct25, name: useGroupName ? `${name} p25` : "p25", color, unit: Unit.usd, defaultActive: false }),
s({ metric: percentiles.costBasisPct50, name: useGroupName ? `${name} p50` : "p50", color, unit: Unit.usd }),
s({ metric: percentiles.costBasisPct75, name: useGroupName ? `${name} p75` : "p75", color, unit: Unit.usd, defaultActive: false }),
s({ metric: percentiles.costBasisPct90, name: useGroupName ? `${name} p90` : "p90", color, unit: Unit.usd, defaultActive: false }),
s({
metric: percentiles.costBasisPct10,
name: useGroupName ? `${name} p10` : "p10",
color,
unit: Unit.usd,
defaultActive: false,
}),
s({
metric: percentiles.costBasisPct25,
name: useGroupName ? `${name} p25` : "p25",
color,
unit: Unit.usd,
defaultActive: false,
}),
s({
metric: percentiles.costBasisPct50,
name: useGroupName ? `${name} p50` : "p50",
color,
unit: Unit.usd,
}),
s({
metric: percentiles.costBasisPct75,
name: useGroupName ? `${name} p75` : "p75",
color,
unit: Unit.usd,
defaultActive: false,
}),
s({
metric: percentiles.costBasisPct90,
name: useGroupName ? `${name} p90` : "p90",
color,
unit: Unit.usd,
defaultActive: false,
}),
];
});
}
+1 -1
View File
@@ -167,7 +167,7 @@ function createCointimePriceWithRatioOptions(
*/
export function createCointimeSection(ctx) {
const { colors, brk, s } = ctx;
const { cointime, distribution, supply } = brk.tree.computed;
const { cointime, distribution, supply } = brk.tree;
const { pricing, cap, activity, supply: cointimeSupply, adjusted } = cointime;
const { all } = distribution.utxoCohorts;
+1 -1
View File
@@ -9,7 +9,7 @@ import { createPriceLine, createPriceLines, line } from "./constants.js";
* @returns {PartialContext}
*/
export function createContext({ colors, brk }) {
const constants = brk.tree.computed.constants;
const constants = brk.tree.constants;
return {
colors,
@@ -13,7 +13,7 @@ import { createInvestingSection } from "./investing.js";
*/
export function createMarketSection(ctx) {
const { colors, brk, s } = ctx;
const { market, supply } = brk.tree.computed;
const { market, supply } = brk.tree;
const {
movingAverage,
ath,