mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-29 22:19:28 -07:00
computer: renames
This commit is contained in:
@@ -1558,12 +1558,12 @@
|
||||
</script>
|
||||
|
||||
<!-- IMPORTMAP -->
|
||||
<link rel="modulepreload" href="/scripts/chart/index.aa4df929.js">
|
||||
<link rel="modulepreload" href="/scripts/chart/index.02f627a6.js">
|
||||
<link rel="modulepreload" href="/scripts/chart/oklch.21450255.js">
|
||||
<link rel="modulepreload" href="/scripts/entry.15f91516.js">
|
||||
<link rel="modulepreload" href="/scripts/lazy.cdb73318.js">
|
||||
<link rel="modulepreload" href="/scripts/main.60f735cb.js">
|
||||
<link rel="modulepreload" href="/scripts/modules/brk-client/index.ab5c0c96.js">
|
||||
<link rel="modulepreload" href="/scripts/main.22a5bd79.js">
|
||||
<link rel="modulepreload" href="/scripts/modules/brk-client/index.84ec1604.js">
|
||||
<link rel="modulepreload" href="/scripts/modules/lean-qr/2.6.1/index.09195c13.mjs">
|
||||
<link rel="modulepreload" href="/scripts/modules/leeoniya-ufuzzy/1.0.19/dist/uFuzzy.803b7fb0.mjs">
|
||||
<link rel="modulepreload" href="/scripts/modules/lightweight-charts/5.0.9/dist/lightweight-charts.standalone.production.1e264451.mjs">
|
||||
@@ -1575,22 +1575,22 @@
|
||||
<link rel="modulepreload" href="/scripts/modules/solidjs-signals/0.6.3/dist/prod.2f80e335.js">
|
||||
<link rel="modulepreload" href="/scripts/modules/solidjs-signals/0.8.5/dist/prod.8ae56250.js">
|
||||
<link rel="modulepreload" href="/scripts/options/_partial_old.62bf3faa.js">
|
||||
<link rel="modulepreload" href="/scripts/options/chain.6d38c01e.js">
|
||||
<link rel="modulepreload" href="/scripts/options/chain.c1c621f8.js">
|
||||
<link rel="modulepreload" href="/scripts/options/cohorts/address.225a99f5.js">
|
||||
<link rel="modulepreload" href="/scripts/options/cohorts/data.9860384e.js">
|
||||
<link rel="modulepreload" href="/scripts/options/cohorts/data.92c2a350.js">
|
||||
<link rel="modulepreload" href="/scripts/options/cohorts/index.47f11280.js">
|
||||
<link rel="modulepreload" href="/scripts/options/cohorts/shared.ae420ee3.js">
|
||||
<link rel="modulepreload" href="/scripts/options/cohorts/shared.d6cac56c.js">
|
||||
<link rel="modulepreload" href="/scripts/options/cohorts/types.1e23c94d.js">
|
||||
<link rel="modulepreload" href="/scripts/options/cohorts/utxo.531a3d0f.js">
|
||||
<link rel="modulepreload" href="/scripts/options/cointime.59c74043.js">
|
||||
<link rel="modulepreload" href="/scripts/options/cointime.520e3634.js">
|
||||
<link rel="modulepreload" href="/scripts/options/colors/cohorts.262d4551.js">
|
||||
<link rel="modulepreload" href="/scripts/options/colors/index.a54dc83f.js">
|
||||
<link rel="modulepreload" href="/scripts/options/colors/misc.bee7dbee.js">
|
||||
<link rel="modulepreload" href="/scripts/options/constants.988e7f83.js">
|
||||
<link rel="modulepreload" href="/scripts/options/context.8a1faf4c.js">
|
||||
<link rel="modulepreload" href="/scripts/options/context.bd3985fb.js">
|
||||
<link rel="modulepreload" href="/scripts/options/full.cbb89ca5.js">
|
||||
<link rel="modulepreload" href="/scripts/options/market/averages.52ae3c62.js">
|
||||
<link rel="modulepreload" href="/scripts/options/market/index.b5f62388.js">
|
||||
<link rel="modulepreload" href="/scripts/options/market/index.d5972147.js">
|
||||
<link rel="modulepreload" href="/scripts/options/market/indicators/bands.eb583383.js">
|
||||
<link rel="modulepreload" href="/scripts/options/market/indicators/index.70e9b3e4.js">
|
||||
<link rel="modulepreload" href="/scripts/options/market/indicators/momentum.8f20362c.js">
|
||||
@@ -1603,7 +1603,7 @@
|
||||
<link rel="modulepreload" href="/scripts/options/series.d82ddec3.js">
|
||||
<link rel="modulepreload" href="/scripts/options/types.19186083.js">
|
||||
<link rel="modulepreload" href="/scripts/options/unused.24a71427.js">
|
||||
<link rel="modulepreload" href="/scripts/panes/chart/index.8a9decf6.js">
|
||||
<link rel="modulepreload" href="/scripts/panes/chart/index.11dc206b.js">
|
||||
<link rel="modulepreload" href="/scripts/panes/chart/screenshot.adc8da89.js">
|
||||
<link rel="modulepreload" href="/scripts/panes/explorer.91a5a9ae.js">
|
||||
<link rel="modulepreload" href="/scripts/panes/nav.0338dc4b.js">
|
||||
@@ -1628,12 +1628,12 @@
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"/scripts/chart/index.js": "/scripts/chart/index.aa4df929.js",
|
||||
"/scripts/chart/index.js": "/scripts/chart/index.02f627a6.js",
|
||||
"/scripts/chart/oklch.js": "/scripts/chart/oklch.21450255.js",
|
||||
"/scripts/entry.js": "/scripts/entry.15f91516.js",
|
||||
"/scripts/lazy.js": "/scripts/lazy.cdb73318.js",
|
||||
"/scripts/main.js": "/scripts/main.60f735cb.js",
|
||||
"/scripts/modules/brk-client/index.js": "/scripts/modules/brk-client/index.ab5c0c96.js",
|
||||
"/scripts/main.js": "/scripts/main.22a5bd79.js",
|
||||
"/scripts/modules/brk-client/index.js": "/scripts/modules/brk-client/index.84ec1604.js",
|
||||
"/scripts/modules/lean-qr/2.6.1/index.mjs": "/scripts/modules/lean-qr/2.6.1/index.09195c13.mjs",
|
||||
"/scripts/modules/leeoniya-ufuzzy/1.0.19/dist/uFuzzy.mjs": "/scripts/modules/leeoniya-ufuzzy/1.0.19/dist/uFuzzy.803b7fb0.mjs",
|
||||
"/scripts/modules/lightweight-charts/5.0.9/dist/lightweight-charts.standalone.production.mjs": "/scripts/modules/lightweight-charts/5.0.9/dist/lightweight-charts.standalone.production.1e264451.mjs",
|
||||
@@ -1645,22 +1645,22 @@
|
||||
"/scripts/modules/solidjs-signals/0.6.3/dist/prod.js": "/scripts/modules/solidjs-signals/0.6.3/dist/prod.2f80e335.js",
|
||||
"/scripts/modules/solidjs-signals/0.8.5/dist/prod.js": "/scripts/modules/solidjs-signals/0.8.5/dist/prod.8ae56250.js",
|
||||
"/scripts/options/_partial_old.js": "/scripts/options/_partial_old.62bf3faa.js",
|
||||
"/scripts/options/chain.js": "/scripts/options/chain.6d38c01e.js",
|
||||
"/scripts/options/chain.js": "/scripts/options/chain.c1c621f8.js",
|
||||
"/scripts/options/cohorts/address.js": "/scripts/options/cohorts/address.225a99f5.js",
|
||||
"/scripts/options/cohorts/data.js": "/scripts/options/cohorts/data.9860384e.js",
|
||||
"/scripts/options/cohorts/data.js": "/scripts/options/cohorts/data.92c2a350.js",
|
||||
"/scripts/options/cohorts/index.js": "/scripts/options/cohorts/index.47f11280.js",
|
||||
"/scripts/options/cohorts/shared.js": "/scripts/options/cohorts/shared.ae420ee3.js",
|
||||
"/scripts/options/cohorts/shared.js": "/scripts/options/cohorts/shared.d6cac56c.js",
|
||||
"/scripts/options/cohorts/types.js": "/scripts/options/cohorts/types.1e23c94d.js",
|
||||
"/scripts/options/cohorts/utxo.js": "/scripts/options/cohorts/utxo.531a3d0f.js",
|
||||
"/scripts/options/cointime.js": "/scripts/options/cointime.59c74043.js",
|
||||
"/scripts/options/cointime.js": "/scripts/options/cointime.520e3634.js",
|
||||
"/scripts/options/colors/cohorts.js": "/scripts/options/colors/cohorts.262d4551.js",
|
||||
"/scripts/options/colors/index.js": "/scripts/options/colors/index.a54dc83f.js",
|
||||
"/scripts/options/colors/misc.js": "/scripts/options/colors/misc.bee7dbee.js",
|
||||
"/scripts/options/constants.js": "/scripts/options/constants.988e7f83.js",
|
||||
"/scripts/options/context.js": "/scripts/options/context.8a1faf4c.js",
|
||||
"/scripts/options/context.js": "/scripts/options/context.bd3985fb.js",
|
||||
"/scripts/options/full.js": "/scripts/options/full.cbb89ca5.js",
|
||||
"/scripts/options/market/averages.js": "/scripts/options/market/averages.52ae3c62.js",
|
||||
"/scripts/options/market/index.js": "/scripts/options/market/index.b5f62388.js",
|
||||
"/scripts/options/market/index.js": "/scripts/options/market/index.d5972147.js",
|
||||
"/scripts/options/market/indicators/bands.js": "/scripts/options/market/indicators/bands.eb583383.js",
|
||||
"/scripts/options/market/indicators/index.js": "/scripts/options/market/indicators/index.70e9b3e4.js",
|
||||
"/scripts/options/market/indicators/momentum.js": "/scripts/options/market/indicators/momentum.8f20362c.js",
|
||||
@@ -1673,7 +1673,7 @@
|
||||
"/scripts/options/series.js": "/scripts/options/series.d82ddec3.js",
|
||||
"/scripts/options/types.js": "/scripts/options/types.19186083.js",
|
||||
"/scripts/options/unused.js": "/scripts/options/unused.24a71427.js",
|
||||
"/scripts/panes/chart/index.js": "/scripts/panes/chart/index.8a9decf6.js",
|
||||
"/scripts/panes/chart/index.js": "/scripts/panes/chart/index.11dc206b.js",
|
||||
"/scripts/panes/chart/screenshot.js": "/scripts/panes/chart/screenshot.adc8da89.js",
|
||||
"/scripts/panes/explorer.js": "/scripts/panes/explorer.91a5a9ae.js",
|
||||
"/scripts/panes/nav.js": "/scripts/panes/nav.0338dc4b.js",
|
||||
|
||||
@@ -384,8 +384,8 @@ function createChartElement({
|
||||
/** @type {AnyMetricPattern} */
|
||||
const timeMetric =
|
||||
index === "height"
|
||||
? brk.tree.computed.blocks.time.timestampFixed
|
||||
: brk.tree.computed.blocks.time.timestamp;
|
||||
? brk.tree.blocks.time.timestampFixed
|
||||
: brk.tree.blocks.time.timestamp;
|
||||
/** @type {AnyMetricPattern} */
|
||||
const valuesMetric = metric;
|
||||
const timeNode = timeMetric.by[index];
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
simulationElement,
|
||||
style,
|
||||
tableElement,
|
||||
} from "./utils/elements";
|
||||
} from "./utils/elements.js";
|
||||
|
||||
function initFrameSelectors() {
|
||||
const children = Array.from(frameSelectorsElement.children);
|
||||
|
||||
@@ -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,
|
||||
}),
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -331,7 +331,7 @@ export function init({
|
||||
case null:
|
||||
case CANDLE: {
|
||||
series = chart.addCandlestickSeries({
|
||||
metric: brk.tree.computed.price.usd.priceOhlc,
|
||||
metric: brk.tree.price.usd.priceOhlc,
|
||||
name: "Price",
|
||||
unit: topUnit,
|
||||
setDataCallback: printLatest,
|
||||
@@ -341,7 +341,7 @@ export function init({
|
||||
}
|
||||
case LINE: {
|
||||
series = chart.addLineSeries({
|
||||
metric: brk.tree.computed.price.usd.priceClose,
|
||||
metric: brk.tree.price.usd.priceClose,
|
||||
name: "Price",
|
||||
unit: topUnit,
|
||||
color: colors.default,
|
||||
@@ -361,7 +361,7 @@ export function init({
|
||||
case null:
|
||||
case CANDLE: {
|
||||
series = chart.addCandlestickSeries({
|
||||
metric: brk.tree.computed.price.sats.priceOhlcInSats,
|
||||
metric: brk.tree.price.sats.priceOhlcInSats,
|
||||
name: "Price",
|
||||
unit: topUnit,
|
||||
inverse: true,
|
||||
@@ -372,7 +372,7 @@ export function init({
|
||||
}
|
||||
case LINE: {
|
||||
series = chart.addLineSeries({
|
||||
metric: brk.tree.computed.price.sats.priceCloseInSats,
|
||||
metric: brk.tree.price.sats.priceCloseInSats,
|
||||
name: "Price",
|
||||
unit: topUnit,
|
||||
color: colors.default,
|
||||
|
||||
Reference in New Issue
Block a user