mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 15:19:58 -07:00
global: snapshot
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
import { Unit } from "../../utils/units.js";
|
||||
import { line, baseline, dotsBaseline, percentRatio, chartsFromCount, ROLLING_WINDOWS } from "../series.js";
|
||||
import { line, baseline, dotsBaseline, percentRatio, chartsFromCount, averagesTree, ROLLING_WINDOWS } from "../series.js";
|
||||
import {
|
||||
satsBtcUsdFullTree,
|
||||
mapCohortsWithAll,
|
||||
@@ -90,11 +90,7 @@ function fullVolumeTree(activity, color, title) {
|
||||
return [
|
||||
...volumeAndCoinsTree(activity, color, title),
|
||||
...sentProfitLossTree(activity.transferVolume, title),
|
||||
{
|
||||
name: "Dormancy",
|
||||
title: title("Dormancy"),
|
||||
bottom: [line({ series: activity.dormancy, name: "Dormancy", color, unit: Unit.days })],
|
||||
},
|
||||
averagesTree({ windows: activity.dormancy, title: title("Dormancy"), unit: Unit.days, name: "Dormancy" }),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -239,10 +235,10 @@ export function createActivitySectionWithActivity({ cohort, title }) {
|
||||
export function createActivitySectionMinimal({ cohort, title }) {
|
||||
return {
|
||||
name: "Activity",
|
||||
tree: chartsFromCount({
|
||||
pattern: cohort.tree.realized.sopr.valueCreated,
|
||||
tree: satsBtcUsdFullTree({
|
||||
pattern: cohort.tree.activity.transferVolume,
|
||||
name: "Volume",
|
||||
title: title("Volume"),
|
||||
unit: Unit.usd,
|
||||
}),
|
||||
};
|
||||
}
|
||||
@@ -259,7 +255,7 @@ export function createGroupedActivitySectionMinimal({ list, all, title }) {
|
||||
name: w.name,
|
||||
title: title(`Volume (${w.title})`),
|
||||
bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) =>
|
||||
line({ series: tree.realized.sopr.valueCreated.sum[w.key], name, color, unit: Unit.usd }),
|
||||
line({ series: tree.activity.transferVolume.sum[w.key].sats, name, color, unit: Unit.sats }),
|
||||
),
|
||||
})),
|
||||
};
|
||||
|
||||
@@ -887,41 +887,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
|
||||
* @param {{ btc: AnySeriesPattern, sats: AnySeriesPattern, usd: AnySeriesPattern }} args.patterns
|
||||
* @param {string} args.name
|
||||
* @param {Color} [args.color]
|
||||
* @param {boolean} [args.defaultActive]
|
||||
* @returns {AnyFetchedSeriesBlueprint[]}
|
||||
*/
|
||||
function btcSatsUsdSeries({ patterns, name, color, defaultActive }) {
|
||||
return [
|
||||
{
|
||||
series: patterns.btc,
|
||||
title: name,
|
||||
color,
|
||||
unit: Unit.btc,
|
||||
defaultActive,
|
||||
},
|
||||
{
|
||||
series: patterns.sats,
|
||||
title: name,
|
||||
color,
|
||||
unit: Unit.sats,
|
||||
defaultActive,
|
||||
},
|
||||
{
|
||||
series: patterns.usd,
|
||||
title: name,
|
||||
color,
|
||||
unit: Unit.usd,
|
||||
defaultActive,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Split flat per-block pattern into charts (Sum/Rolling/Distribution/Cumulative)
|
||||
* Pattern has: .height, .cumulative, .sum (windowed), .average/.pct10/... (windowed, flat)
|
||||
@@ -1137,34 +1102,3 @@ export function multiSeriesTree({ entries, title, unit }) {
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Split BaseCumulativeRollingPattern into 3 charts (Sum/Distribution/Cumulative)
|
||||
* @param {Object} args
|
||||
* @param {CoinbasePattern} args.pattern
|
||||
* @param {string} args.title
|
||||
* @returns {PartialOptionsTree}
|
||||
*/
|
||||
export function chartsFromValueFull({ pattern, title }) {
|
||||
return [
|
||||
{
|
||||
name: "Sum",
|
||||
title,
|
||||
bottom: [
|
||||
...btcSatsUsdSeries({ patterns: pattern.base, name: "sum" }),
|
||||
...btcSatsUsdSeries({
|
||||
patterns: pattern.sum._24h,
|
||||
name: "24h sum",
|
||||
defaultActive: false,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Cumulative",
|
||||
title: `${title} (Total)`,
|
||||
bottom: btcSatsUsdSeries({
|
||||
patterns: pattern.cumulative,
|
||||
name: "all-time",
|
||||
}),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -45,23 +45,21 @@
|
||||
* Brk pattern types (using new pattern names)
|
||||
* @typedef {Brk.ActivityOutputsRealizedSupplyUnrealizedPattern} MaxAgePattern
|
||||
* @typedef {Brk.ActivityOutputsRealizedSupplyUnrealizedPattern} AgeRangePattern
|
||||
* @typedef {Brk.OutputsRealizedSupplyUnrealizedPattern} UtxoAmountPattern
|
||||
* @typedef {Brk.AddrOutputsRealizedSupplyUnrealizedPattern} AddrAmountPattern
|
||||
* @typedef {Brk.ActivityOutputsRealizedSupplyUnrealizedPattern2} UtxoAmountPattern
|
||||
* @typedef {Brk.ActivityAddrOutputsRealizedSupplyUnrealizedPattern} AddrAmountPattern
|
||||
* @typedef {Brk.ActivityOutputsRealizedSupplyUnrealizedPattern} BasicUtxoPattern
|
||||
* @typedef {Brk.ActivityOutputsRealizedSupplyUnrealizedPattern} EpochPattern
|
||||
* @typedef {Brk.OutputsRealizedSupplyUnrealizedPattern2} EmptyPattern
|
||||
* @typedef {Brk.ActivityOutputsRealizedSupplyUnrealizedPattern3} EmptyPattern
|
||||
* @typedef {Brk._0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern} Ratio1ySdPattern
|
||||
* @typedef {Brk.Dollars} Dollars
|
||||
* CoinbasePattern: base + cumulative + rolling windows (flattened)
|
||||
* @typedef {Brk.BaseCumulativeSumPattern4} CoinbasePattern
|
||||
* ActivePriceRatioPattern: ratio pattern with price (extended)
|
||||
* @typedef {Brk.BpsPriceRatioPattern} ActivePriceRatioPattern
|
||||
* PriceRatioPercentilesPattern: price pattern with ratio + percentiles (no SMAs/stdDev)
|
||||
* @typedef {Brk.BpsCentsPercentilesRatioSatsUsdPattern} PriceRatioPercentilesPattern
|
||||
* AnyRatioPattern: full ratio pattern with percentiles, SMAs, and std dev bands
|
||||
* @typedef {Brk.BpsCentsPercentilesRatioSatsSmaStdUsdPattern} AnyRatioPattern
|
||||
* FullValuePattern: base + cumulative + rolling windows (flattened)
|
||||
* @typedef {Brk.BaseCumulativeSumPattern4} FullValuePattern
|
||||
* FullValuePattern: base + cumulative + rolling windows (sats/btc/cents/usd)
|
||||
* @typedef {Brk.BaseCumulativeSumPattern3} FullValuePattern
|
||||
* RollingWindowSlot: a single rolling window with stats (average, pct10, pct25, median, pct75, pct90, max, min) per unit
|
||||
* @typedef {Brk.AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern<number>} RollingWindowSlot
|
||||
* @typedef {Brk.AnySeriesPattern} AnySeriesPattern
|
||||
@@ -91,8 +89,8 @@
|
||||
* Transfer volume pattern (base + cumulative + inProfit/inLoss + sum windows)
|
||||
* @typedef {Brk.BaseCumulativeInSumPattern} TransferVolumePattern
|
||||
*
|
||||
* Realized profit/loss pattern (base + cumulative + sum windows)
|
||||
* @typedef {Brk.BaseCumulativeSumPattern3} RealizedProfitLossPattern
|
||||
* Realized profit/loss pattern (base + cumulative + sum windows, cents/usd)
|
||||
* @typedef {Brk.BaseCumulativeSumPattern4} RealizedProfitLossPattern
|
||||
*
|
||||
* Full activity pattern (coindays, coinyears, dormancy, transfer volume)
|
||||
* @typedef {Brk.CoindaysCoinyearsDormancyTransferPattern} FullActivityPattern
|
||||
@@ -113,8 +111,8 @@
|
||||
* Mid realized pattern (cap + loss + MVRV + net + price + profit + SOPR)
|
||||
* @typedef {Brk.CapLossMvrvNetPriceProfitSoprPattern} MidRealizedPattern
|
||||
*
|
||||
* Basic realized pattern (cap + loss + MVRV + price + profit + SOPR, no net)
|
||||
* @typedef {Brk.CapLossMvrvPriceProfitSoprPattern} BasicRealizedPattern
|
||||
* Basic realized pattern (cap + loss + MVRV + price + profit, no net/sopr)
|
||||
* @typedef {Brk.CapLossMvrvPriceProfitPattern} BasicRealizedPattern
|
||||
*
|
||||
* Moving average price ratio pattern (bps + cents + ratio + sats + usd)
|
||||
* @typedef {Brk.BpsCentsRatioSatsUsdPattern} MaPriceRatioPattern
|
||||
|
||||
Reference in New Issue
Block a user