mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-10 10:38:14 -07:00
global: snapshot
This commit is contained in:
@@ -13,6 +13,7 @@ import {
|
||||
percentRatio,
|
||||
percentRatioBaseline,
|
||||
ROLLING_WINDOWS,
|
||||
ROLLING_WINDOWS_TO_1M,
|
||||
} from "./series.js";
|
||||
import { simplePriceRatioTree } from "./shared.js";
|
||||
import { periodIdToName } from "./utils.js";
|
||||
@@ -734,14 +735,14 @@ export function createMarketSection() {
|
||||
name: "Compare",
|
||||
title: "RSI Comparison",
|
||||
bottom: [
|
||||
...ROLLING_WINDOWS.flatMap((w) =>
|
||||
...ROLLING_WINDOWS_TO_1M.flatMap((w) =>
|
||||
indexRatio({ pattern: technical.rsi[w.key].rsi, name: w.name, color: w.color }),
|
||||
),
|
||||
priceLine({ unit: Unit.index, number: 70 }),
|
||||
priceLine({ unit: Unit.index, number: 30 }),
|
||||
],
|
||||
},
|
||||
...ROLLING_WINDOWS.map((w) => {
|
||||
...ROLLING_WINDOWS_TO_1M.map((w) => {
|
||||
const rsi = technical.rsi[w.key];
|
||||
return {
|
||||
name: w.name,
|
||||
@@ -756,7 +757,7 @@ export function createMarketSection() {
|
||||
}),
|
||||
{
|
||||
name: "Stochastic",
|
||||
tree: ROLLING_WINDOWS.map((w) => {
|
||||
tree: ROLLING_WINDOWS_TO_1M.map((w) => {
|
||||
const rsi = technical.rsi[w.key];
|
||||
return {
|
||||
name: w.name,
|
||||
@@ -777,11 +778,11 @@ export function createMarketSection() {
|
||||
{
|
||||
name: "Compare",
|
||||
title: "MACD Comparison",
|
||||
bottom: ROLLING_WINDOWS.map((w) =>
|
||||
bottom: ROLLING_WINDOWS_TO_1M.map((w) =>
|
||||
line({ series: technical.macd[w.key].line, name: w.name, color: w.color, unit: Unit.usd }),
|
||||
),
|
||||
},
|
||||
...ROLLING_WINDOWS.map((w) => ({
|
||||
...ROLLING_WINDOWS_TO_1M.map((w) => ({
|
||||
name: w.name,
|
||||
title: `MACD (${w.name})`,
|
||||
bottom: [
|
||||
|
||||
@@ -15,9 +15,10 @@ import {
|
||||
chartsFromSumPerBlock,
|
||||
rollingWindowsTree,
|
||||
distributionWindowsTree,
|
||||
mapWindows,
|
||||
|
||||
ROLLING_WINDOWS,
|
||||
chartsFromBlockAnd6b,
|
||||
fromStatsPattern,
|
||||
percentRatio,
|
||||
percentRatioDots,
|
||||
rollingPercentRatioTree,
|
||||
@@ -470,35 +471,6 @@ export function createNetworkSection() {
|
||||
name: "Rate",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "Market Cap",
|
||||
tree: [
|
||||
{
|
||||
name: "Base",
|
||||
title: "Market Cap",
|
||||
bottom: [
|
||||
line({
|
||||
series: supply.marketCap.usd,
|
||||
name: "Market Cap",
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
],
|
||||
},
|
||||
rollingWindowsTree({
|
||||
windows: mapWindows(
|
||||
supply.marketCap.delta.absolute,
|
||||
(c) => c.usd,
|
||||
),
|
||||
title: "Market Cap Change",
|
||||
unit: Unit.usd,
|
||||
series: baseline,
|
||||
}),
|
||||
rollingPercentRatioTree({
|
||||
windows: supply.marketCap.delta.rate,
|
||||
title: "Market Cap Growth Rate",
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Hodled or Lost",
|
||||
title: "Hodled or Lost Supply",
|
||||
@@ -507,104 +479,23 @@ export function createNetworkSection() {
|
||||
name: "Supply",
|
||||
}),
|
||||
},
|
||||
rollingWindowsTree({
|
||||
windows: supply.marketMinusRealizedCapGrowthRate,
|
||||
title: "Market - Realized Cap Growth Rate",
|
||||
unit: Unit.ratio,
|
||||
}),
|
||||
|
||||
{
|
||||
name: "Unspendable",
|
||||
tree: [
|
||||
{
|
||||
name: "Base",
|
||||
title: "Unspendable Supply",
|
||||
bottom: satsBtcUsdFrom({
|
||||
source: supply.burned,
|
||||
key: "base",
|
||||
name: "sum",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "Rolling",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "Unspendable Supply Rolling",
|
||||
bottom: ROLLING_WINDOWS.flatMap((w) =>
|
||||
satsBtcUsd({
|
||||
pattern: supply.burned.sum[w.key],
|
||||
name: w.name,
|
||||
color: w.color,
|
||||
}),
|
||||
),
|
||||
},
|
||||
...ROLLING_WINDOWS.map((w) => ({
|
||||
name: w.name,
|
||||
title: `Unspendable Supply ${w.name}`,
|
||||
bottom: satsBtcUsd({
|
||||
pattern: supply.burned.sum[w.key],
|
||||
name: w.name,
|
||||
color: w.color,
|
||||
}),
|
||||
})),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Cumulative",
|
||||
title: "Unspendable Supply (Total)",
|
||||
bottom: satsBtcUsdFrom({
|
||||
source: supply.burned,
|
||||
key: "cumulative",
|
||||
name: "all-time",
|
||||
}),
|
||||
},
|
||||
],
|
||||
title: "Unspendable Supply",
|
||||
bottom: satsBtcUsdFrom({
|
||||
source: supply.burned,
|
||||
key: "cumulative",
|
||||
name: "all-time",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "OP_RETURN",
|
||||
tree: [
|
||||
{
|
||||
name: "Base",
|
||||
title: "OP_RETURN Burned",
|
||||
bottom: satsBtcUsd({
|
||||
pattern: scripts.value.opReturn.base,
|
||||
name: "sum",
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "Rolling",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
title: "OP_RETURN Burned Rolling",
|
||||
bottom: ROLLING_WINDOWS.flatMap((w) =>
|
||||
satsBtcUsd({
|
||||
pattern: scripts.value.opReturn.sum[w.key],
|
||||
name: w.name,
|
||||
color: w.color,
|
||||
}),
|
||||
),
|
||||
},
|
||||
...ROLLING_WINDOWS.map((w) => ({
|
||||
name: w.name,
|
||||
title: `OP_RETURN Burned ${w.name}`,
|
||||
bottom: satsBtcUsd({
|
||||
pattern: scripts.value.opReturn.sum[w.key],
|
||||
name: w.name,
|
||||
color: w.color,
|
||||
}),
|
||||
})),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Cumulative",
|
||||
title: "OP_RETURN Burned (Total)",
|
||||
bottom: satsBtcUsd({
|
||||
pattern: scripts.value.opReturn.cumulative,
|
||||
name: "all-time",
|
||||
}),
|
||||
},
|
||||
],
|
||||
title: "OP_RETURN Burned",
|
||||
bottom: satsBtcUsd({
|
||||
pattern: scripts.value.opReturn.cumulative,
|
||||
name: "all-time",
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -622,25 +513,14 @@ export function createNetworkSection() {
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "Fees",
|
||||
tree: [
|
||||
{
|
||||
name: "Fee Rate",
|
||||
tree: chartsFromBlockAnd6b({
|
||||
pattern: transactions.fees.feeRate,
|
||||
title: "Transaction Fee Rate",
|
||||
unit: Unit.feeRate,
|
||||
}),
|
||||
},
|
||||
{
|
||||
name: "Fee",
|
||||
tree: chartsFromBlockAnd6b({
|
||||
pattern: transactions.fees.fee,
|
||||
title: "Transaction Fee",
|
||||
unit: Unit.sats,
|
||||
}),
|
||||
},
|
||||
],
|
||||
name: "Fee Rate",
|
||||
title: "Fee Rate Distribution (6 Blocks)",
|
||||
bottom: fromStatsPattern({ pattern: transactions.fees.feeRate._6b, unit: Unit.feeRate }),
|
||||
},
|
||||
{
|
||||
name: "Fee",
|
||||
title: "Fee Distribution (6 Blocks)",
|
||||
bottom: fromStatsPattern({ pattern: transactions.fees.fee._6b, unit: Unit.sats }),
|
||||
},
|
||||
{
|
||||
name: "Volume",
|
||||
|
||||
@@ -17,6 +17,13 @@ export const ROLLING_WINDOWS = [
|
||||
{ key: "_1y", name: "1y", color: colors.time._1y },
|
||||
];
|
||||
|
||||
/** @type {ReadonlyArray<{key: '_24h' | '_1w' | '_1m', name: string, color: Color}>} */
|
||||
export const ROLLING_WINDOWS_TO_1M = [
|
||||
{ key: "_24h", name: "24h", color: colors.time._24h },
|
||||
{ key: "_1w", name: "1w", color: colors.time._1w },
|
||||
{ key: "_1m", name: "1m", color: colors.time._1m },
|
||||
];
|
||||
|
||||
/**
|
||||
* Extract a series from each rolling window via a mapping function
|
||||
* @template T
|
||||
@@ -474,7 +481,7 @@ export function statsAtWindow(pattern, window) {
|
||||
*/
|
||||
export function rollingWindowsTree({ windows, title, unit, series = line }) {
|
||||
return {
|
||||
name: "Rolling",
|
||||
name: "Sums",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
@@ -515,7 +522,7 @@ export function rollingWindowsTree({ windows, title, unit, series = line }) {
|
||||
*/
|
||||
export function distributionWindowsTree({ pattern, base, title, unit }) {
|
||||
return {
|
||||
name: "Distribution",
|
||||
name: "Distributions",
|
||||
tree: ROLLING_WINDOWS.map((w) => ({
|
||||
name: w.name,
|
||||
title: `${title} Distribution (${w.name})`,
|
||||
@@ -661,7 +668,7 @@ export function percentRatioBaseline({ pattern, name, color, defaultActive }) {
|
||||
*/
|
||||
export function rollingPercentRatioTree({ windows, title, series = percentRatio }) {
|
||||
return {
|
||||
name: "Rolling",
|
||||
name: "Sums",
|
||||
tree: [
|
||||
{
|
||||
name: "Compare",
|
||||
@@ -802,7 +809,7 @@ export function chartsFromFull({
|
||||
: title;
|
||||
return [
|
||||
{
|
||||
name: "Sum",
|
||||
name: "Per Block",
|
||||
title,
|
||||
bottom: [{ series: pattern.base, title: "base", unit }],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user