mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-24 06:39:58 -07:00
global: snapshot
This commit is contained in:
@@ -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 }) {
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user