global: snapshot

This commit is contained in:
nym21
2026-03-02 19:44:45 +01:00
parent 4e7cd9ab6f
commit ccb2db2309
37 changed files with 337 additions and 1412 deletions

View File

@@ -308,7 +308,7 @@ function createSingleAddrCount30dChangeSeries(cohort) {
/**
* Create supply series with % of Circulating (for cohorts with relative data)
* @param {CohortFull | CohortWithAdjusted | CohortBasicWithMarketCap | CohortMinAge} cohort
* @param {CohortFull | CohortWithAdjusted | CohortBasicWithMarketCap} cohort
* @returns {AnyFetchedSeriesBlueprint[]}
*/
function createSingleSupplySeriesWithRelative(cohort) {
@@ -406,7 +406,7 @@ export function createHoldingsSectionWithOwnSupply({ cohort, title }) {
}
/**
* @param {{ cohort: CohortFull | CohortWithAdjusted | CohortBasicWithMarketCap | CohortMinAge, title: (metric: string) => string }} args
* @param {{ cohort: CohortFull | CohortWithAdjusted | CohortBasicWithMarketCap, title: (metric: string) => string }} args
* @returns {PartialOptionsGroup}
*/
export function createHoldingsSectionWithRelative({ cohort, title }) {
@@ -869,7 +869,7 @@ export function createGroupedHoldingsSectionWithOwnSupply({
}
/**
* @param {{ list: readonly (CohortFull | CohortWithAdjusted | CohortBasicWithMarketCap | CohortMinAge)[], all: CohortAll, title: (metric: string) => string }} args
* @param {{ list: readonly (CohortFull | CohortWithAdjusted | CohortBasicWithMarketCap)[], all: CohortAll, title: (metric: string) => string }} args
* @returns {PartialOptionsGroup}
*/
export function createGroupedHoldingsSectionWithRelative({ list, all, title }) {

View File

@@ -48,13 +48,11 @@ import {
createProfitabilitySectionAll,
createProfitabilitySectionFull,
createProfitabilitySectionWithNupl,
createProfitabilitySectionWithPeakRegret,
createProfitabilitySectionWithInvestedCapitalPct,
createProfitabilitySectionBasicWithInvestedCapitalPct,
createProfitabilitySectionLongTerm,
createGroupedProfitabilitySection,
createGroupedProfitabilitySectionWithNupl,
createGroupedProfitabilitySectionWithPeakRegret,
createGroupedProfitabilitySectionWithInvestedCapitalPct,
createGroupedProfitabilitySectionBasicWithInvestedCapitalPct,
createGroupedProfitabilitySectionLongTerm,
@@ -127,7 +125,7 @@ export function createCohortFolderWithAdjusted(cohort) {
createValuationSection({ cohort, title }),
createPricesSectionBasic({ cohort, title }),
createCostBasisSection({ cohort, title }),
createProfitabilitySectionWithPeakRegret({ cohort, title }),
createProfitabilitySectionWithNupl({ cohort, title }),
createActivitySectionWithAdjusted({ cohort, title }),
],
};
@@ -193,26 +191,6 @@ export function createCohortFolderAgeRange(cohort) {
};
}
/**
* MinAge folder: has peakRegret in unrealized
* @param {CohortMinAge} cohort
* @returns {PartialOptionsGroup}
*/
export function createCohortFolderMinAge(cohort) {
const title = formatCohortTitle(cohort.name);
return {
name: cohort.name || "all",
tree: [
createHoldingsSectionWithRelative({ cohort, title }),
createValuationSection({ cohort, title }),
createPricesSectionBasic({ cohort, title }),
createCostBasisSection({ cohort, title }),
createProfitabilitySectionWithPeakRegret({ cohort, title }),
createActivitySection({ cohort, title }),
],
};
}
/**
* Basic folder WITH RelToMarketCap
* @param {CohortBasicWithMarketCap} cohort
@@ -359,7 +337,7 @@ export function createGroupedCohortFolderWithAdjusted({
createGroupedValuationSection({ list, all, title }),
createGroupedPricesSection({ list, all, title }),
createGroupedCostBasisSection({ list, all, title }),
createGroupedProfitabilitySectionWithPeakRegret({ list, all, title }),
createGroupedProfitabilitySectionWithNupl({ list, all, title }),
createGroupedActivitySectionWithAdjusted({ list, all, title }),
],
};
@@ -441,30 +419,6 @@ export function createGroupedCohortFolderAgeRange({
};
}
/**
* @param {CohortGroupMinAge} args
* @returns {PartialOptionsGroup}
*/
export function createGroupedCohortFolderMinAge({
name,
title: groupTitle,
list,
all,
}) {
const title = formatCohortTitle(groupTitle);
return {
name: name || "all",
tree: [
createGroupedHoldingsSectionWithRelative({ list, all, title }),
createGroupedValuationSection({ list, all, title }),
createGroupedPricesSection({ list, all, title }),
createGroupedCostBasisSection({ list, all, title }),
createGroupedProfitabilitySectionWithPeakRegret({ list, all, title }),
createGroupedActivitySection({ list, all, title }),
],
};
}
/**
* @param {CohortGroupBasicWithMarketCap} args
* @returns {PartialOptionsGroup}

View File

@@ -401,46 +401,6 @@ function nuplSeries(rel) {
return [baseline({ metric: rel.nupl, name: "NUPL", unit: Unit.ratio })];
}
/**
* Peak regret (USD only)
* @param {{ unrealized: UnrealizedFullPattern }} tree
* @param {Color} color
* @returns {AnyFetchedSeriesBlueprint[]}
*/
function peakRegretAbsolute(tree, color) {
return [
line({
metric: tree.unrealized.peakRegret,
name: "Peak Regret",
color,
unit: Unit.usd,
}),
];
}
/**
* Peak regret with % of Market Cap
* @param {{ unrealized: UnrealizedFullPattern, relative: RelativeWithPeakRegret }} tree
* @param {Color} color
* @returns {AnyFetchedSeriesBlueprint[]}
*/
function peakRegretWithMarketCap(tree, color) {
return [
line({
metric: tree.unrealized.peakRegret,
name: "Peak Regret",
color,
unit: Unit.usd,
}),
baseline({
metric: tree.relative.unrealizedPeakRegretRelToMarketCap,
name: "Rel. to Market Cap",
color,
unit: Unit.pctMcap,
}),
];
}
/**
* Sentiment series
* @param {{ unrealized: UnrealizedPattern }} tree
@@ -1103,7 +1063,7 @@ export function createProfitabilitySectionBasicWithInvestedCapitalPct({
}
/**
* Section for ageRange cohorts (Own M.Cap + Own P&L + peak regret)
* Section for ageRange cohorts (Own M.Cap + Own P&L)
* @param {{ cohort: CohortAgeRange, title: (metric: string) => string }} args
* @returns {PartialOptionsGroup}
*/
@@ -1111,7 +1071,7 @@ export function createProfitabilitySectionWithInvestedCapitalPct({
cohort,
title,
}) {
const { tree, color } = cohort;
const { tree } = cohort;
const m = getUnrealizedMetrics(tree);
return {
name: "Profitability",
@@ -1129,11 +1089,6 @@ export function createProfitabilitySectionWithInvestedCapitalPct({
title: title("Net Unrealized P&L"),
bottom: netUnrealizedWithOwnMarketCap(m.net, tree.relative),
},
{
name: "Peak Regret",
title: title("Unrealized Peak Regret"),
bottom: peakRegretAbsolute(tree, color),
},
],
},
realizedSubfolderWithExtras(tree, title),
@@ -1197,7 +1152,7 @@ export function createProfitabilitySectionWithNupl({ cohort, title }) {
* @returns {PartialOptionsGroup}
*/
export function createProfitabilitySectionLongTerm({ cohort, title }) {
const { tree, color } = cohort;
const { tree } = cohort;
const m = getUnrealizedMetrics(tree);
return {
name: "Profitability",
@@ -1220,11 +1175,6 @@ export function createProfitabilitySectionLongTerm({ cohort, title }) {
title: title("NUPL"),
bottom: nuplSeries(tree.relative),
},
{
name: "Peak Regret",
title: title("Unrealized Peak Regret"),
bottom: peakRegretWithMarketCap(tree, color),
},
],
},
realizedSubfolderWithExtras(tree, title),
@@ -1245,7 +1195,7 @@ export function createProfitabilitySectionLongTerm({ cohort, title }) {
* @returns {PartialOptionsGroup}
*/
export function createProfitabilitySectionFull({ cohort, title }) {
const { tree, color } = cohort;
const { tree } = cohort;
const m = getUnrealizedMetrics(tree);
return {
name: "Profitability",
@@ -1268,11 +1218,6 @@ export function createProfitabilitySectionFull({ cohort, title }) {
title: title("NUPL"),
bottom: nuplSeries(tree.relative),
},
{
name: "Peak Regret",
title: title("Unrealized Peak Regret"),
bottom: peakRegretWithMarketCap(tree, color),
},
],
},
realizedSubfolderWithExtras(tree, title),
@@ -1293,7 +1238,7 @@ export function createProfitabilitySectionFull({ cohort, title }) {
* @returns {PartialOptionsGroup}
*/
export function createProfitabilitySectionAll({ cohort, title }) {
const { tree, color } = cohort;
const { tree } = cohort;
const m = getUnrealizedMetrics(tree);
return {
name: "Profitability",
@@ -1316,11 +1261,6 @@ export function createProfitabilitySectionAll({ cohort, title }) {
title: title("NUPL"),
bottom: nuplSeries(tree.relative),
},
{
name: "Peak Regret",
title: title("Unrealized Peak Regret"),
bottom: peakRegretWithMarketCap(tree, color),
},
],
},
realizedSubfolderWithExtras(tree, title),
@@ -1335,54 +1275,6 @@ export function createProfitabilitySectionAll({ cohort, title }) {
};
}
/**
* Section with Peak Regret + NUPL (minAge cohorts)
* @param {{ cohort: CohortMinAge, title: (metric: string) => string }} args
* @returns {PartialOptionsGroup}
*/
export function createProfitabilitySectionWithPeakRegret({ cohort, title }) {
const { tree, color } = cohort;
const m = getUnrealizedMetrics(tree);
return {
name: "Profitability",
tree: [
{
name: "Unrealized",
tree: [
{
name: "P&L",
title: title("Unrealized P&L"),
bottom: unrealizedWithMarketCap(m, tree.relative),
},
{
name: "Net P&L",
title: title("Net Unrealized P&L"),
bottom: netUnrealizedWithMarketCap(m.net, tree.relative),
},
{
name: "NUPL",
title: title("NUPL"),
bottom: nuplSeries(tree.relative),
},
{
name: "Peak Regret",
title: title("Unrealized Peak Regret"),
bottom: peakRegretWithMarketCap(tree, color),
},
],
},
realizedSubfolder(tree, title),
volumeSubfolder(tree, title),
{
name: "Invested Capital",
title: title("Invested Capital In Profit & Loss"),
bottom: investedCapitalWithPct(tree),
},
sentimentChart(tree, title),
],
};
}
// ============================================================================
// Grouped Cohort Helpers
// ============================================================================
@@ -1437,7 +1329,7 @@ function groupedPnlCharts(list, all, title) {
/**
* Grouped P&L with % of Market Cap
* @param {readonly (CohortFull | CohortBasicWithMarketCap | CohortMinAge | CohortLongTerm)[]} list
* @param {readonly (CohortFull | CohortBasicWithMarketCap | CohortLongTerm)[]} list
* @param {CohortAll} all
* @param {(metric: string) => string} title
* @returns {PartialOptionsTree}
@@ -1769,7 +1661,7 @@ function groupedInvestedCapitalAbsolute(list, all, title) {
/**
* Grouped invested capital with %
* @param {readonly (CohortBasicWithoutMarketCap | CohortAgeRange | CohortFull | CohortBasicWithMarketCap | CohortLongTerm | CohortMinAge)[]} list
* @param {readonly (CohortBasicWithoutMarketCap | CohortAgeRange | CohortFull | CohortBasicWithMarketCap | CohortLongTerm)[]} list
* @param {CohortAll} all
* @param {(metric: string) => string} title
* @returns {PartialOptionsTree}
@@ -2278,18 +2170,6 @@ export function createGroupedProfitabilitySectionWithInvestedCapitalPct({
name: "Unrealized",
tree: [
...groupedPnlChartsWithOwnMarketCap(list, all, title),
{
name: "Peak Regret",
title: title("Unrealized Peak Regret"),
bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) =>
line({
metric: tree.unrealized.peakRegret,
name,
color,
unit: Unit.usd,
}),
),
},
],
},
groupedRealizedSubfolderWithExtras(list, all, title),
@@ -2374,28 +2254,6 @@ export function createGroupedProfitabilitySectionLongTerm({
}),
),
},
{
name: "Peak Regret",
title: title("Unrealized Peak Regret"),
bottom: [
...mapCohortsWithAll(list, all, ({ name, color, tree }) =>
line({
metric: tree.unrealized.peakRegret,
name,
color,
unit: Unit.usd,
}),
),
...mapCohortsWithAll(list, all, ({ name, color, tree }) =>
baseline({
metric: tree.relative.unrealizedPeakRegretRelToMarketCap,
name,
color,
unit: Unit.pctMcap,
}),
),
],
},
],
},
groupedRealizedSubfolderWithExtras(list, all, title),
@@ -2409,66 +2267,3 @@ export function createGroupedProfitabilitySectionLongTerm({
};
}
/**
* Grouped section with Peak Regret + NUPL (minAge cohorts)
* @param {{ list: readonly CohortMinAge[], all: CohortAll, title: (metric: string) => string }} args
* @returns {PartialOptionsGroup}
*/
export function createGroupedProfitabilitySectionWithPeakRegret({
list,
all,
title,
}) {
return {
name: "Profitability",
tree: [
{
name: "Unrealized",
tree: [
...groupedPnlChartsWithMarketCap(list, all, title),
{
name: "NUPL",
title: title("NUPL"),
bottom: mapCohortsWithAll(list, all, ({ name, color, tree }) =>
baseline({
metric: tree.relative.nupl,
name,
color,
unit: Unit.ratio,
}),
),
},
{
name: "Peak Regret",
title: title("Unrealized Peak Regret"),
bottom: [
...mapCohortsWithAll(list, all, ({ name, color, tree }) =>
line({
metric: tree.unrealized.peakRegret,
name,
color,
unit: Unit.usd,
}),
),
...mapCohortsWithAll(list, all, ({ name, color, tree }) =>
baseline({
metric: tree.relative.unrealizedPeakRegretRelToMarketCap,
name,
color,
unit: Unit.pctMcap,
}),
),
],
},
],
},
groupedRealizedSubfolder(list, all, title),
{ name: "Volume", tree: groupedSentInPnl(list, all, title) },
{
name: "Invested Capital",
tree: groupedInvestedCapital(list, all, title),
},
groupedSentiment(list, all, title),
],
};
}

View File

@@ -7,7 +7,6 @@ import {
createCohortFolderWithAdjusted,
createCohortFolderLongTerm,
createCohortFolderAgeRange,
createCohortFolderMinAge,
createCohortFolderBasicWithMarketCap,
createCohortFolderBasicWithoutMarketCap,
createCohortFolderWithoutRelative,
@@ -16,7 +15,6 @@ import {
createGroupedCohortFolderWithAdjusted,
createGroupedCohortFolderWithNupl,
createGroupedCohortFolderAgeRange,
createGroupedCohortFolderMinAge,
createGroupedCohortFolderBasicWithMarketCap,
createGroupedCohortFolderBasicWithoutMarketCap,
createGroupedCohortFolderAddress,
@@ -112,13 +110,13 @@ export function createPartialOptions() {
{
name: "Older Than",
tree: [
createGroupedCohortFolderMinAge({
createGroupedCohortFolderBasicWithMarketCap({
name: "Compare",
title: "Min Age",
list: fromDate,
all: cohortAll,
}),
...fromDate.map(createCohortFolderMinAge),
...fromDate.map(createCohortFolderBasicWithMarketCap),
],
},
// Range

View File

@@ -238,13 +238,6 @@
* @property {Color} color
* @property {PatternBasicWithMarketCap} tree
*
* MinAge cohort - has peakRegret in unrealized (minAge.*)
* @typedef {Object} CohortMinAge
* @property {string} name
* @property {string} title
* @property {Color} color
* @property {MinAgePattern} tree
*
* Basic cohort WITHOUT RelToMarketCap (epoch.*, amountRange.*, year.*, type.*)
* @typedef {Object} CohortBasicWithoutMarketCap
* @property {string} name
@@ -309,12 +302,6 @@
* @property {readonly CohortBasicWithMarketCap[]} list
* @property {CohortAll} all
*
* @typedef {Object} CohortGroupMinAge
* @property {string} name
* @property {string} title
* @property {readonly CohortMinAge[]} list
* @property {CohortAll} all
*
* @typedef {Object} CohortGroupBasicWithoutMarketCap
* @property {string} name
* @property {string} title

View File

@@ -12,7 +12,7 @@
*
* @import { Color } from "./utils/colors.js"
*
* @import { Option, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, SimulationOption, AnySeriesBlueprint, SeriesType, AnyFetchedSeriesBlueprint, TableOption, ExplorerOption, UrlOption, PartialOptionsGroup, OptionsGroup, PartialOptionsTree, UtxoCohortObject, AddressCohortObject, CohortObject, CohortGroupObject, FetchedLineSeriesBlueprint, FetchedBaselineSeriesBlueprint, FetchedHistogramSeriesBlueprint, FetchedDotsBaselineSeriesBlueprint, PatternAll, PatternFull, PatternWithAdjusted, PatternWithPercentiles, PatternBasic, PatternBasicWithMarketCap, PatternBasicWithoutMarketCap, PatternWithoutRelative, CohortAll, CohortFull, CohortWithAdjusted, CohortWithPercentiles, CohortBasic, CohortBasicWithMarketCap, CohortBasicWithoutMarketCap, CohortWithoutRelative, CohortAddress, CohortLongTerm, CohortAgeRange, CohortMinAge, CohortGroupFull, CohortGroupWithAdjusted, CohortGroupWithPercentiles, CohortGroupLongTerm, CohortGroupAgeRange, CohortGroupBasic, CohortGroupBasicWithMarketCap, CohortGroupBasicWithoutMarketCap, CohortGroupWithoutRelative, CohortGroupMinAge, CohortGroupAddress, UtxoCohortGroupObject, AddressCohortGroupObject, FetchedDotsSeriesBlueprint, FetchedCandlestickSeriesBlueprint, FetchedPriceSeriesBlueprint, AnyPricePattern, AnyValuePattern } from "./options/partial.js"
* @import { Option, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, SimulationOption, AnySeriesBlueprint, SeriesType, AnyFetchedSeriesBlueprint, TableOption, ExplorerOption, UrlOption, PartialOptionsGroup, OptionsGroup, PartialOptionsTree, UtxoCohortObject, AddressCohortObject, CohortObject, CohortGroupObject, FetchedLineSeriesBlueprint, FetchedBaselineSeriesBlueprint, FetchedHistogramSeriesBlueprint, FetchedDotsBaselineSeriesBlueprint, PatternAll, PatternFull, PatternWithAdjusted, PatternWithPercentiles, PatternBasic, PatternBasicWithMarketCap, PatternBasicWithoutMarketCap, PatternWithoutRelative, CohortAll, CohortFull, CohortWithAdjusted, CohortWithPercentiles, CohortBasic, CohortBasicWithMarketCap, CohortBasicWithoutMarketCap, CohortWithoutRelative, CohortAddress, CohortLongTerm, CohortAgeRange, CohortGroupFull, CohortGroupWithAdjusted, CohortGroupWithPercentiles, CohortGroupLongTerm, CohortGroupAgeRange, CohortGroupBasic, CohortGroupBasicWithMarketCap, CohortGroupBasicWithoutMarketCap, CohortGroupWithoutRelative, CohortGroupAddress, UtxoCohortGroupObject, AddressCohortGroupObject, FetchedDotsSeriesBlueprint, FetchedCandlestickSeriesBlueprint, FetchedPriceSeriesBlueprint, AnyPricePattern, AnyValuePattern } from "./options/partial.js"
*
*
* @import { UnitObject as Unit } from "./utils/units.js"
@@ -48,8 +48,6 @@
* @typedef {Brk.ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} UtxoAmountPattern
* @typedef {Brk.ActivityAddrCostOutputsRealizedRelativeSupplyUnrealizedPattern} AddressAmountPattern
* @typedef {Brk.ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} BasicUtxoPattern
* MinAgePattern: minAge cohorts have peakRegret in unrealized
* @typedef {Brk.ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern5} MinAgePattern
* @typedef {Brk.ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} EpochPattern
* @typedef {Brk.ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern3} EmptyPattern
* @typedef {Brk._0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdSmaZscorePattern} Ratio1ySdPattern
@@ -76,16 +74,13 @@
* Relative patterns by capability:
* - BasicRelativePattern: minimal relative (investedCapitalIn*Pct, supplyIn*RelToOwnSupply only)
* - GlobalRelativePattern: has RelToMarketCap metrics (netUnrealizedPnlRelToMarketCap, etc)
* - GlobalPeakRelativePattern: GlobalRelativePattern + unrealizedPeakRegretRelToMarketCap
* - OwnRelativePattern: has RelToOwnMarketCap metrics (netUnrealizedPnlRelToOwnMarketCap, etc)
* - FullRelativePattern: has BOTH RelToMarketCap AND RelToOwnMarketCap + unrealizedPeakRegretRelToMarketCap
* - FullRelativePattern: has BOTH RelToMarketCap AND RelToOwnMarketCap
* @typedef {Brk.InvestedNegNetNuplSupplyUnrealizedPattern} BasicRelativePattern
* @typedef {Brk.InvestedNegNetNuplSupplyUnrealizedPattern} GlobalRelativePattern
* @typedef {Brk.InvestedNegNetNuplSupplyUnrealizedPattern4} GlobalPeakRelativePattern
* @typedef {Brk.InvestedNegNetNuplSupplyUnrealizedPattern2} OwnRelativePattern
* @typedef {Brk.InvestedNegNetNuplSupplyUnrealizedPattern2} FullRelativePattern
* @typedef {Brk.GreedInvestedInvestorNegNetPainSupplyTotalUnrealizedPattern} UnrealizedPattern
* @typedef {Brk.GreedInvestedInvestorNegNetPainPeakSupplyTotalUnrealizedPattern} UnrealizedFullPattern
*
* Realized patterns
* @typedef {Brk.CapCapitulationInvestorLossLowerMvrvNegNetPeakProfitRealizedSellSentSoprTotalUpperValuePattern} RealizedPattern
@@ -164,12 +159,11 @@
* @typedef {UtxoCohortPattern | AddressCohortPattern} CohortPattern
*
* Relative pattern capability types
* @typedef {GlobalRelativePattern | GlobalPeakRelativePattern | FullRelativePattern | AllRelativePattern} RelativeWithMarketCap
* @typedef {GlobalRelativePattern | FullRelativePattern | AllRelativePattern} RelativeWithMarketCap
* @typedef {OwnRelativePattern | FullRelativePattern} RelativeWithOwnMarketCap
* @typedef {OwnRelativePattern | FullRelativePattern | AllRelativePattern} RelativeWithOwnPnl
* @typedef {GlobalRelativePattern | GlobalPeakRelativePattern | FullRelativePattern | AllRelativePattern} RelativeWithNupl
* @typedef {GlobalPeakRelativePattern | FullRelativePattern | AllRelativePattern} RelativeWithPeakRegret
* @typedef {BasicRelativePattern | GlobalRelativePattern | GlobalPeakRelativePattern | OwnRelativePattern | FullRelativePattern | AllRelativePattern} RelativeWithInvestedCapitalPct
* @typedef {GlobalRelativePattern | FullRelativePattern | AllRelativePattern} RelativeWithNupl
* @typedef {BasicRelativePattern | GlobalRelativePattern | OwnRelativePattern | FullRelativePattern | AllRelativePattern} RelativeWithInvestedCapitalPct
*
* Realized pattern capability types
* RealizedWithExtras: patterns with realizedCapRelToOwnMarketCap + realizedProfitToLossRatio