diff --git a/websites/kibo.money/index.html b/websites/kibo.money/index.html index 0b449133e..0481e368e 100644 --- a/websites/kibo.money/index.html +++ b/websites/kibo.money/index.html @@ -924,14 +924,13 @@ &[data-size="xs"] { font-size: var(--font-size-xs); line-height: var(--line-height-xs); + font-weight: 500; } > div.field { text-transform: lowercase; display: flex; align-items: center; - /* font-size: var(--font-size-xs); - line-height: var(--line-height-xs); */ gap: 1rem; > legend, @@ -942,7 +941,7 @@ > hr { min-width: 2rem; - fieldset[data-size="xs"] > div > & { + fieldset[data-size="xs"] & { min-width: 1rem; } } @@ -956,7 +955,7 @@ display: flex; gap: 1.5rem; - fieldset[data-size="xs"] > div > & { + fieldset[data-size="xs"] & { gap: 1rem; } } diff --git a/websites/kibo.money/scripts/main.js b/websites/kibo.money/scripts/main.js index 47b6be97e..fd5f03711 100644 --- a/websites/kibo.money/scripts/main.js +++ b/websites/kibo.money/scripts/main.js @@ -1,7 +1,7 @@ // @ts-check /** - * @import { Option, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, SimulationOption, Unit } from "./types/self" + * @import { Option, PartialChartOption, ChartOption, AnyPartialOption, ProcessedOptionAddons, OptionsTree, SimulationOption, Unit } from "./options" * @import {Valued, SingleValueData, CandlestickData, ChartData, OHLCTuple} from "../packages/lightweight-charts/wrapper" * @import * as _ from "../packages/ufuzzy/v1.0.14/types" * @import { createChart as CreateClassicChart, LineStyleOptions, DeepPartial, ChartOptions, IChartApi, IHorzScaleBehavior, WhitespaceData, ISeriesApi, Time, LineData, LogicalRange, SeriesType, BaselineStyleOptions, SeriesOptionsCommon } from "../packages/lightweight-charts/v5.0.5-treeshaked/types" diff --git a/websites/kibo.money/scripts/options.js b/websites/kibo.money/scripts/options.js index 81aae29b5..7b969bcae 100644 --- a/websites/kibo.money/scripts/options.js +++ b/websites/kibo.money/scripts/options.js @@ -1,10 +1,145 @@ // @ts-check +/** @import { + DeepPartial, + BaselineStyleOptions, + CandlestickStyleOptions, + LineStyleOptions, + SeriesOptionsCommon, + Time, + SingleValueData as _SingleValueData, + CandlestickData as _CandlestickData, + BaselineData, +} from "../packages/lightweight-charts/v5.0.5-treeshaked/types"} */ + /** - * @import { CohortOption, CohortOptions, Color, DefaultCohortOption, DefaultCohortOptions, OptionsGroup, PartialChartOption, PartialOptionsGroup, PartialOptionsTree, RatioOption, RatioOptions, Unit } from "./types/self" - * @import { AnySeriesBlueprint} from '../packages/lightweight-charts/wrapper'; + * @typedef {"" | + * "Bitcoin" | + * "Coinblocks" | + * "Count" | + * "Date" | + * "Dollars / (PetaHash / Second)" | + * "ExaHash / Second" | + * "Height" | + * "Gigabytes" | + * "Megabytes" | + * "Percentage" | + * "Ratio" | + * "Satoshis" | + * "Seconds" | + * "Transactions" | + * "US Dollars" | + * "Virtual Bytes" | + * "Weight" + * } Unit + * + * @typedef {Object} BaseSeriesBlueprint + * @property {string} title + * @property {VecId} key + * @property {boolean} [defaultActive] + * + * @typedef {Object} BaselineSeriesBlueprintSpecific + * @property {"Baseline"} type + * @property {Color} [color] + * @property {DeepPartial} [options] + * @property {Accessor} [data] + * @typedef {BaseSeriesBlueprint & BaselineSeriesBlueprintSpecific} BaselineSeriesBlueprint + * + * @typedef {Object} CandlestickSeriesBlueprintSpecific + * @property {"Candlestick"} type + * @property {Color} [color] + * @property {DeepPartial} [options] + * @property {Accessor} [data] + * @typedef {BaseSeriesBlueprint & CandlestickSeriesBlueprintSpecific} CandlestickSeriesBlueprint + * + * @typedef {Object} LineSeriesBlueprintSpecific + * @property {"Line"} [type] + * @property {Color} color + * @property {DeepPartial} [options] + * @property {Accessor} [data] + * @typedef {BaseSeriesBlueprint & LineSeriesBlueprintSpecific} LineSeriesBlueprint + * + * @typedef {BaselineSeriesBlueprint | CandlestickSeriesBlueprint | LineSeriesBlueprint} AnySeriesBlueprint + * + * @typedef {Object} PartialOption + * @property {string} name + * + * @typedef {Object} ProcessedOptionAddons + * @property {string} id + * @property {string} title + * @property {string[]} path + * + * @typedef {Object} PartialChartOptionSpecific + * @property {"chart"} [kind] + * @property {Unit} [unit] + * @property {string} [title] + * @property {AnySeriesBlueprint[]} [top] + * @property {AnySeriesBlueprint[]} [bottom] + * @typedef {PartialOption & PartialChartOptionSpecific} PartialChartOption + * @typedef {Required & ProcessedOptionAddons} ChartOption + * + * @typedef {Object} PartialSimulationOptionSpecific + * @property {"simulation"} kind + * @property {string} title + * @typedef {PartialOption & PartialSimulationOptionSpecific} PartialSimulationOption + * @typedef {Required & ProcessedOptionAddons} SimulationOption + * + * @typedef {Object} PartialUrlOptionSpecific + * @property {"url"} [kind] + * @property {() => string} url + * @property {boolean} [qrcode] + * @typedef {PartialOption & PartialUrlOptionSpecific} PartialUrlOption + * @typedef {Required & ProcessedOptionAddons} UrlOption + * + * @typedef {PartialChartOption | PartialSimulationOption | PartialUrlOption} AnyPartialOption + * @typedef {ChartOption | SimulationOption | UrlOption} Option + * + * @typedef {Object} PartialOptionsGroup + * @property {string} name + * @property {PartialOptionsTree} tree + * + * @typedef {Object} OptionsGroup + * @property {string} id + * @property {string} name + * @property {OptionsTree} tree + * + * @typedef {(AnyPartialOption | PartialOptionsGroup)[]} PartialOptionsTree + * @typedef {(Option | OptionsGroup)[]} OptionsTree + * */ +/** + type DefaultCohortOption = CohortOption; + + interface CohortOption { + name: string; + title: string; + datasetId: Id; + color: Color; + filenameAddon?: string; + } + + type DefaultCohortOptions = CohortOptions; + + interface CohortOptions { + name: string; + title: string; + list: CohortOption[]; + } + + interface RatioOption { + color: Color; + // valueDatasetPath: AnyDatasetPath; + // ratioDatasetPath: AnyDatasetPath; + title: string; + } + + interface RatioOptions { + title: string; + list: RatioOption[]; + } +*/ + function initGroups() { const xTermHolders = /** @type {const} */ ([ { @@ -520,4415 +655,26 @@ function initGroups() { * @returns {PartialOptionsTree} */ function createPartialOptions(colors) { - // const groups = initGroups(); - - // const bases = { - // /** - // * @param {TimeScale} scale - // * @param {string} [title] - // */ - // 0(scale, title) { - // return /** @type {const} */ ({ - // title: title || `Base`, - // color: colors.off, - // datasetPath: `${scale}-to-0`, - // options: { - // lineStyle: 3, - // lastValueVisible: false, - // }, - // }); - // }, - // /** - // * @param {TimeScale} scale - // * @param {string} [title] - // */ - // 1(scale, title) { - // return /** @type {const} */ ({ - // title: title || `Base`, - // color: colors.off, - // datasetPath: `${scale}-to-1`, - // options: { - // lineStyle: 3, - // lastValueVisible: false, - // }, - // }); - // }, - // /** - // * @param {TimeScale} scale - // * @param {string} [title] - // */ - // 100(scale, title) { - // return /** @type {const} */ ({ - // title: title || `Base`, - // color: colors.off, - // datasetPath: `${scale}-to-100`, - // options: { - // lineStyle: 3, - // lastValueVisible: false, - // }, - // }); - // }, - // }; - - // /** - // * @param {AnyPossibleCohortId} datasetId - // * @returns {AnyDatasetPrefix} - // */ - // function datasetIdToPrefix(datasetId) { - // return datasetId - // ? /** @type {const} */ (`${datasetId}-`) - // : /** @type {const} */ (""); - // } - - // /** - // * - // * @param {Object} args - // * @param {TimeScale} args.scale - // * @param {string} args.title - // * @param {Color} args.color - // * @param {Unit} args.unit - // * @param {AnyDatasetPath} [args.keySum] - // * @param {AnyDatasetPath} [args.keyAverage] - // * @param {AnyDatasetPath} [args.keyMax] - // * @param {AnyDatasetPath} [args.key90p] - // * @param {AnyDatasetPath} [args.key75p] - // * @param {AnyDatasetPath} [args.keyMedian] - // * @param {AnyDatasetPath} [args.key25p] - // * @param {AnyDatasetPath} [args.key10p] - // * @param {AnyDatasetPath} [args.keyMin] - // * @returns {PartialOptionsTree} - // */ - // function createRecapOptions({ - // scale, - // unit, - // title, - // keyAverage, - // color, - // keySum, - // keyMax, - // key90p, - // key75p, - // keyMedian, - // key25p, - // key10p, - // keyMin, - // }) { - // return [ - // ...(keySum - // ? [ - // { - // scale, - // name: "Daily Sum", - // title: `${title} Daily Sum`, - // description: "", - // unit, - // bottom: [ - // { - // title: "Sum", - // color, - // datasetPath: keySum, - // }, - // ], - // }, - // ] - // : []), - // ...(keyAverage - // ? [ - // { - // scale, - // name: "Daily Average", - // title: `${title} Daily Average`, - // description: "", - // unit, - // bottom: [ - // { - // title: "Average", - // color, - // datasetPath: keyAverage, - // }, - // ], - // }, - // ] - // : []), - // ...(keyMax || key90p || key75p || keyMedian || key25p || key10p || keyMin - // ? [ - // { - // scale, - // name: "Daily Percentiles", - // title: `${title} Daily Percentiles`, - // description: "", - // unit, - // bottom: [ - // ...(keyMax - // ? [ - // { - // title: "Max", - // color, - // datasetPath: keyMax, - // }, - // ] - // : []), - // ...(key90p - // ? [ - // { - // title: "90%", - // color, - // datasetPath: key90p, - // }, - // ] - // : []), - // ...(key75p - // ? [ - // { - // title: "75%", - // color, - // datasetPath: key75p, - // }, - // ] - // : []), - // ...(keyMedian - // ? [ - // { - // title: "Median", - // color, - // datasetPath: keyMedian, - // }, - // ] - // : []), - // ...(key25p - // ? [ - // { - // title: "25%", - // color, - // datasetPath: key25p, - // }, - // ] - // : []), - // ...(key10p - // ? [ - // { - // title: "10%", - // color, - // datasetPath: key10p, - // }, - // ] - // : []), - // ...(keyMin - // ? [ - // { - // title: "Min", - // color, - // datasetPath: keyMin, - // }, - // ] - // : []), - // ], - // }, - // ] - // : []), - // ...(keyMax - // ? [ - // { - // scale, - // name: "Daily Max", - // title: `${title} Daily Max`, - // description: "", - // unit, - // bottom: [ - // { - // title: "Max", - // color, - // datasetPath: keyMax, - // }, - // ], - // }, - // ] - // : []), - // ...(key90p - // ? [ - // { - // scale, - // name: "Daily 90th Percentile", - // title: `${title} Daily 90th Percentile`, - // description: "", - // unit, - // bottom: [ - // { - // title: "90%", - // color, - // datasetPath: key90p, - // }, - // ], - // }, - // ] - // : []), - // ...(key75p - // ? [ - // { - // scale, - // name: "Daily 75th Percentile", - // title: `${title} Size 75th Percentile`, - // description: "", - // unit, - // bottom: [ - // { - // title: "75%", - // color, - // datasetPath: key75p, - // }, - // ], - // }, - // ] - // : []), - // ...(keyMedian - // ? [ - // { - // scale, - // name: "Daily Median", - // title: `${title} Daily Median`, - // description: "", - // unit, - // bottom: [ - // { - // title: "Median", - // color, - // datasetPath: keyMedian, - // }, - // ], - // }, - // ] - // : []), - // ...(key25p - // ? [ - // { - // scale, - // name: "Daily 25th Percentile", - // title: `${title} Daily 25th Percentile`, - // description: "", - // unit, - // bottom: [ - // { - // title: "25%", - // color, - // datasetPath: key25p, - // }, - // ], - // }, - // ] - // : []), - // ...(key10p - // ? [ - // { - // scale, - // name: "Daily 10th Percentile", - // title: `${title} Daily 10th Percentile`, - // description: "", - // unit, - // bottom: [ - // { - // title: "10%", - // color, - // datasetPath: key10p, - // }, - // ], - // }, - // ] - // : []), - // ...(keyMin - // ? [ - // { - // scale, - // name: "Daily Min", - // title: `${title} Daily Min`, - // description: "", - // unit, - // bottom: [ - // { - // title: "Min", - // color, - // datasetPath: keyMin, - // }, - // ], - // }, - // ] - // : []), - // ]; - // } - - // /** - // * @param {RatioOption | RatioOptions} arg - // * @returns {PartialOptionsGroup} - // */ - // function createRatioOptions(arg) { - // const { scale, title } = arg; - - // const isSingle = !("list" in arg); - - // /** - // * @param {RatioOption | RatioOptions} arg - // */ - // function toList(arg) { - // return "list" in arg ? arg.list : [arg]; - // } - - // /** - // * @param {RatioOption | RatioOptions} arg - // * @param {string} cohortName - // * @param {string} legendName - // */ - // function toLegendName(arg, cohortName, legendName) { - // return "list" in arg ? `${cohortName} ${legendName}` : legendName; - // } - - // return { - // name: "Ratio", - // tree: [ - // { - // scale, - // name: "Basic", - // title: `Market Price To ${title} Ratio`, - // unit: "Ratio", - // description: "", - // top: toList(arg).map( - // ({ title, color, valueDatasetPath: datasetPath }) => ({ - // title, - // color, - // datasetPath, - // }), - // ), - // bottom: [ - // ...toList(arg).map( - // ({ title, color, ratioDatasetPath: datasetPath }) => ({ - // title: toLegendName(arg, title, "Ratio"), - // color: isSingle ? undefined : color, - // type: /** @type {const} */ ("Baseline"), - // datasetPath, - // options: { - // baseValue: { - // price: 1, - // }, - // }, - // }), - // ), - // bases[1](scale), - // ], - // }, - // ...(isSingle - // ? /** @satisfies {PartialChartOption[]} */ ([ - // { - // scale, - // name: "Averages", - // description: "", - // unit: "Ratio", - // title: `Market Price To ${title} Ratio Averages`, - // top: [ - // { - // title, - // color: arg.color, - // datasetPath: arg.valueDatasetPath, - // }, - // ], - // bottom: [ - // { - // title: `1Y SMA`, - // color: colors.red, - // datasetPath: /** @type {any} */ ( - // `${arg.ratioDatasetPath}-1y-sma` - // ), - // }, - // { - // title: `1M SMA`, - // color: colors.orange, - // datasetPath: `${arg.ratioDatasetPath}-1m-sma`, - // }, - // { - // title: `1W SMA`, - // color: colors.yellow, - // datasetPath: `${arg.ratioDatasetPath}-1w-sma`, - // }, - // { - // title: `Raw`, - // color: colors.default, - // datasetPath: arg.ratioDatasetPath, - // }, - // { - // title: `Even`, - // color: colors.off, - // datasetPath: `${scale}-to-1`, - // options: { - // lineStyle: 3, - // lastValueVisible: false, - // }, - // }, - // ], - // }, - // ]) - // : []), - // { - // scale, - // name: "Momentum Oscillator", - // title: `Market Price To ${title} Ratio 1Y SMA Momentum Oscillator`, - // description: "", - // unit: "Ratio", - // top: toList(arg).map( - // ({ title, color, valueDatasetPath: datasetPath }) => ({ - // title: toLegendName(arg, title, ""), - // color, - // datasetPath, - // }), - // ), - // bottom: [ - // ...toList(arg).map( - // ({ title, color, ratioDatasetPath: datasetPath }) => ({ - // title: toLegendName(arg, title, "Momentum"), - // color: isSingle ? undefined : color, - // type: /** @type {const} */ ("Baseline"), - // datasetPath: /** @type {any} */ ( - // `${datasetPath}-1y-sma-momentum-oscillator` - // ), - // }), - // ), - // bases[0](scale), - // ], - // }, - // { - // name: "Top", - // tree: [ - // ...(isSingle - // ? /** @satisfies {PartialChartOption[]} */ ([ - // { - // scale, - // name: "Percentiles", - // title: `Market Price To ${title} Ratio Top Percentiles`, - // description: "", - // unit: "Ratio", - // top: [ - // { - // title, - // color: arg.color, - // datasetPath: arg.valueDatasetPath, - // }, - // ], - // bottom: [ - // { - // title: `99.9%`, - // color: colors.probability0_1p, - // datasetPath: /** @type {any} */ ( - // `${arg.ratioDatasetPath}-99-9p` - // ), - // }, - // { - // title: `99.5%`, - // color: colors.probability0_5p, - // datasetPath: `${arg.ratioDatasetPath}-99-5p`, - // }, - // { - // title: `99%`, - // color: colors.probability1p, - // datasetPath: `${arg.ratioDatasetPath}-99p`, - // }, - // { - // title: `Raw`, - // color: colors.default, - // datasetPath: arg.ratioDatasetPath, - // }, - // ], - // }, - // ]) - // : []), - // { - // name: "Prices", - // tree: [ - // ...(isSingle - // ? /** @satisfies {PartialChartOption[]} */ ([ - // { - // scale, - // name: "All", - // title: `${title} Top Prices`, - // description: "", - // unit: "US Dollars", - // top: [ - // { - // title: `99.9%`, - // color: colors.probability0_1p, - // datasetPath: /** @type {any} */ ( - // `${arg.valueDatasetPath}-99-9p` - // ), - // }, - // { - // title: `99.5%`, - // color: colors.probability0_5p, - // datasetPath: `${arg.valueDatasetPath}-99-5p`, - // }, - // { - // title: `99%`, - // color: colors.probability1p, - // datasetPath: `${arg.valueDatasetPath}-99p`, - // }, - // ], - // }, - // ]) - // : []), - // { - // scale, - // name: "99%", - // title: `${title} Top 99% Price`, - // description: "", - // unit: "US Dollars", - // top: toList(arg).map((cohort) => ({ - // title: toLegendName(arg, cohort.title, `99%`), - // color: isSingle ? colors.probability1p : cohort.color, - // datasetPath: /** @type {any} */ ( - // `${cohort.valueDatasetPath}-99p` - // ), - // })), - // }, - // { - // scale, - // name: "99.5%", - // title: `${title} Top 99.5% Price`, - // description: "", - // unit: "US Dollars", - // top: toList(arg).map((cohort) => ({ - // title: toLegendName(arg, cohort.title, `99.5%`), - // color: isSingle ? colors.probability0_5p : cohort.color, - // datasetPath: /** @type {any} */ ( - // `${cohort.valueDatasetPath}-99-5p` - // ), - // })), - // }, - // { - // scale, - // name: "99.9%", - // title: `${title} Top 99.9% Price`, - // description: "", - // unit: "US Dollars", - // top: toList(arg).map((cohort) => ({ - // title: toLegendName(arg, cohort.title, `99.9%`), - // color: isSingle ? colors.probability0_1p : cohort.color, - // datasetPath: /** @type {any} */ ( - // `${cohort.valueDatasetPath}-99-9p` - // ), - // })), - // }, - // ], - // }, - // ], - // }, - // { - // name: "Bottom", - // tree: [ - // ...(isSingle - // ? /** @satisfies {PartialChartOption[]} */ ([ - // { - // scale, - // name: "Percentiles", - // title: `Market Price To ${title} Ratio Bottom Percentiles`, - // description: "", - // unit: "Ratio", - // top: [ - // { - // title, - // color: arg.color, - // datasetPath: arg.valueDatasetPath, - // }, - // ], - // bottom: [ - // { - // title: `0.1%`, - // color: colors.probability0_1p, - // datasetPath: `${arg.ratioDatasetPath}-0-1p`, - // }, - // { - // title: `0.5%`, - // color: colors.probability0_5p, - // datasetPath: `${arg.ratioDatasetPath}-0-5p`, - // }, - // { - // title: `1%`, - // color: colors.probability1p, - // datasetPath: /** @type {any} */ ( - // `${arg.ratioDatasetPath}-1p` - // ), - // }, - // { - // title: `Raw`, - // color: colors.default, - // datasetPath: arg.ratioDatasetPath, - // }, - // ], - // }, - // ]) - // : []), - // { - // name: "Prices", - // tree: [ - // ...(isSingle - // ? /** @satisfies {PartialChartOption[]} */ ([ - // { - // scale, - // name: "All", - // title: `${title} Bottom Prices`, - // description: "", - // unit: "US Dollars", - // top: [ - // { - // title: `0.1%`, - // color: colors.probability0_1p, - // datasetPath: /** @type {any} */ ( - // `${arg.valueDatasetPath}-0-1p` - // ), - // }, - // { - // title: `0.5%`, - // color: colors.probability0_5p, - // datasetPath: `${arg.valueDatasetPath}-0-5p`, - // }, - // { - // title: `1%`, - // color: colors.probability1p, - // datasetPath: `${arg.valueDatasetPath}-1p`, - // }, - // ], - // }, - // ]) - // : []), - // { - // scale, - // name: "1%", - // title: `${title} Bottom 1% Price`, - // description: "", - // unit: "US Dollars", - // top: toList(arg).map((cohort) => ({ - // title: toLegendName(arg, cohort.title, `1%`), - // color: isSingle ? colors.probability1p : cohort.color, - // datasetPath: /** @type {any} */ ( - // `${cohort.valueDatasetPath}-1p` - // ), - // })), - // }, - // { - // scale, - // name: "0.5%", - // title: `${title} Bottom 0.5% Price`, - // description: "", - // unit: "US Dollars", - // top: toList(arg).map((cohort) => ({ - // title: toLegendName(arg, cohort.title, `0.5%`), - // color: isSingle ? colors.probability0_5p : cohort.color, - // datasetPath: /** @type {any} */ ( - // `${cohort.valueDatasetPath}-0-5p` - // ), - // })), - // }, - // { - // scale, - // name: "0.1%", - // title: `${title} Bottom 0.1% Price`, - // description: "", - // unit: "US Dollars", - // top: toList(arg).map((cohort) => ({ - // title: toLegendName(arg, cohort.title, `0.1%`), - // color: isSingle ? colors.probability0_1p : cohort.color, - // datasetPath: /** @type {any} */ ( - // `${cohort.valueDatasetPath}-0-1p` - // ), - // })), - // }, - // ], - // }, - // ], - // }, - // ], - // }; - // } - - // /** - // * @param {TimeScale} scale - // * @returns {PartialOptionsGroup} - // */ - // function createMarketOptions(scale) { - // // /** - // // * @param {TimeScale} scale - // // * @returns {PartialOptionsGroup} - // // */ - // // function createAllTimeHighOptions(scale) { - // // return { - // // name: "All Time High", - // // tree: [ - // // { - // // scale, - // // name: "Value", - // // title: "All Time High", - // // description: "", - // // unit: "US Dollars", - // // top: [ - // // { - // // title: `ATH`, - // // color: colors.dollars, - // // datasetPath: `${scale}-to-all-time-high`, - // // }, - // // ], - // // }, - // // { - // // scale, - // // name: "Drawdown", - // // title: "All Time High Drawdown", - // // description: "", - // // unit: "Percentage", - // // top: [ - // // { - // // title: `ATH`, - // // color: colors.dollars, - // // datasetPath: `${scale}-to-all-time-high`, - // // }, - // // ], - // // bottom: [ - // // { - // // title: `Drawdown`, - // // color: colors.loss, - // // datasetPath: `${scale}-to-drawdown`, - // // }, - // // ], - // // }, - // // ...(scale === "date" - // // ? /** @type {PartialChartOption[]} */ ([ - // // { - // // scale, - // // name: "Days Since", - // // title: "Days Since All Time High", - // // description: "", - // // unit: "Count", - // // bottom: [ - // // { - // // title: `Days`, - // // color: colors.red, - // // datasetPath: `date-to-days-since-all-time-high`, - // // }, - // // ], - // // }, - // // { - // // name: "Max Between", - // // tree: [ - // // { - // // scale, - // // name: "Days", - // // title: "Max Number Of Days Between All Time Highs", - // // description: "", - // // unit: "Count", - // // bottom: [ - // // { - // // title: `Max`, - // // color: colors.red, - // // datasetPath: - // // "date-to-max-days-between-all-time-highs", - // // }, - // // ], - // // }, - // // { - // // scale, - // // name: "Years", - // // title: "Max Number Of Years Between All Time Highs", - // // description: "", - // // bottom: [ - // // { - // // title: `Max`, - // // color: colors.red, - // // datasetPath: - // // "date-to-max-years-between-all-time-highs", - // // }, - // // ], - // // }, - // // ], - // // }, - // // ]) - // // : []), - // // ], - // // }; - // // } - - // // /** - // // * @param {TimeScale} scale - // // * @returns {PartialOptionsGroup} - // // */ - // // function createAveragesOptions(scale) { - // // return { - // // name: "Averages", - // // tree: [ - // // { - // // scale, - // // name: "All", - // // title: "All Moving Averages", - // // description: "", - // // unit: "US Dollars", - // // top: groups.averages.map((average) => ({ - // // title: average.key.toUpperCase(), - // // color: colors[`_${average.key}`], - // // datasetPath: `${scale}-to-price-${average.key}-sma`, - // // })), - // // }, - // // ...groups.averages.map(({ name, key }) => - // // createAverageOptions({ - // // scale, - // // color: colors[`_${key}`], - // // name, - // // title: `${name} Market Price Moving Average`, - // // key, - // // }), - // // ), - // // ], - // // }; - // // } - - // // /** - // // * - // // * @param {Object} args - // // * @param {TimeScale} args.scale - // // * @param {Color} args.color - // // * @param {string} args.name - // // * @param {string} args.title - // // * @param {AverageName} args.key - // // * @returns {PartialOptionsGroup} - // // */ - // // function createAverageOptions({ scale, color, name, title, key }) { - // // return { - // // name, - // // tree: [ - // // { - // // scale, - // // name: "Average", - // // title, - // // description: "", - // // unit: "US Dollars", - // // top: [ - // // { - // // title: `SMA`, - // // color, - // // datasetPath: `${scale}-to-price-${key}-sma`, - // // }, - // // ], - // // }, - // // createRatioOptions({ - // // scale, - // // color, - // // ratioDatasetPath: `${scale}-to-market-price-to-price-${key}-sma-ratio`, - // // valueDatasetPath: `${scale}-to-price-${key}-sma`, - // // title, - // // }), - // // ], - // // }; - // // } - - // // /** - // // * @returns {PartialOptionsGroup} - // // */ - // // function createReturnsOptions() { - // // return { - // // name: "Returns", - // // tree: [ - // // { - // // name: "Total", - // // tree: [ - // // ...groups.totalReturns.map(({ name, key }) => - // // createReturnsOption({ - // // scale: "date", - // // name, - // // title: `${name} Total`, - // // key: `${key}-total`, - // // }), - // // ), - // // ], - // // }, - // // { - // // name: "Compound", - // // tree: [ - // // ...groups.compoundReturns.map(({ name, key }) => - // // createReturnsOption({ - // // scale: "date", - // // name, - // // title: `${name} Compound`, - // // key: `${key}-compound`, - // // }), - // // ), - // // ], - // // }, - // // ], - // // }; - // // } - - // // /** - // // * @param {Object} args - // // * @param {TimeScale} args.scale - // // * @param {string} args.name - // // * @param {string} args.title - // // * @param {`${TotalReturnKey}-total` | `${CompoundReturnKey}-compound`} args.key - // // * @returns {PartialChartOption} - // // */ - // // function createReturnsOption({ scale, name, title, key }) { - // // return { - // // scale, - // // name, - // // description: "", - // // title: `${title} Return`, - // // unit: "Percentage", - // // bottom: [ - // // { - // // title: `Return`, - // // type: "Baseline", - // // datasetPath: `date-to-price-${key}-return`, - // // }, - // // bases[0](scale), - // // ], - // // }; - // // } - - // // /** - // // * @returns {PartialOptionsGroup} - // // */ - // // function createIndicatorsOptions() { - // // return { - // // name: "Indicators", - // // tree: [], - // // }; - // // } - - // return { - // name: "Market", - // tree: [ - // { - // scale, - // name: "Dollars Per Bitcoin", - // title: "Dollars Per Bitcoin", - // description: "", - // unit: "US Dollars", - // }, - // { - // scale, - // name: "Satoshis Per Dollar", - // title: "Satoshis Per Dollar", - // description: "", - // unit: "Satoshis", - // bottom: [ - // { - // title: "Satoshis", - // datasetPath: `${scale}-to-sats-per-dollar`, - // color: colors.bitcoin, - // }, - // ], - // }, - // // { - // // scale, - // // name: "Capitalization", - // // title: "Market Capitalization", - // // description: "", - // // unit: "US Dollars", - // // bottom: [ - // // { - // // title: "Capitalization", - // // datasetPath: `${scale}-to-market-cap`, - // // color: colors.bitcoin, - // // }, - // // ], - // // }, - // // createAllTimeHighOptions(scale), - // // createAveragesOptions(scale), - // // ...(scale === "date" - // // ? [createReturnsOptions(), createIndicatorsOptions()] - // // : []), - // ], - // }; - // } - - // /** - // * @param {TimeScale} scale - // * @returns {PartialOptionsGroup} - // */ - // function createBlocksOptions(scale) { - // return { - // name: "Blocks", - // tree: [ - // ...(scale === "date" - // ? /** @type {PartialOptionsTree} */ ([ - // { - // scale, - // name: "Height", - // title: "Block Height", - // description: "", - // unit: "Height", - // bottom: [ - // { - // title: "Height", - // color: colors.bitcoin, - // datasetPath: `date-to-last-height`, - // }, - // ], - // }, - // { - // scale, - // name: "Mined", - // tree: [ - // { - // scale, - // name: "Daily Sum", - // title: "Daily Sum Of Blocks Mined", - // description: "", - // unit: "Count", - // bottom: [ - // { - // title: "Target", - // color: colors.off, - // datasetPath: `date-to-blocks-mined-1d-target`, - // options: { - // lineStyle: 3, - // }, - // }, - // { - // title: "1W Avg.", - // color: colors.momentumYellow, - // datasetPath: `date-to-blocks-mined-1w-sma`, - // defaultActive: false, - // }, - // { - // title: "1M Avg.", - // color: colors.bitcoin, - // datasetPath: `date-to-blocks-mined-1m-sma`, - // }, - // { - // title: "Mined", - // color: colors.offBitcoin, - // datasetPath: `date-to-blocks-mined`, - // main: true, - // }, - // ], - // }, - // { - // scale, - // name: "Weekly Sum", - // title: "Weekly Sum Of Blocks Mined", - // description: "", - // unit: "Count", - // bottom: [ - // { - // title: "Target", - // color: colors.off, - // datasetPath: `date-to-blocks-mined-1w-target`, - // options: { - // lineStyle: 3, - // }, - // }, - // { - // title: "Sum Mined", - // color: colors.bitcoin, - // datasetPath: `date-to-blocks-mined-1w-sum`, - // }, - // ], - // }, - // { - // scale, - // name: "Monthly Sum", - // title: "Monthly Sum Of Blocks Mined", - // description: "", - // unit: "Count", - // bottom: [ - // { - // title: "Target", - // color: colors.off, - // datasetPath: `date-to-blocks-mined-1m-target`, - // options: { - // lineStyle: 3, - // }, - // }, - // { - // title: "Sum Mined", - // color: colors.bitcoin, - // datasetPath: `date-to-blocks-mined-1m-sum`, - // }, - // ], - // }, - // { - // scale, - // name: "Yearly Sum", - // title: "Yearly Sum Of Blocks Mined", - // description: "", - // unit: "Count", - // bottom: [ - // { - // title: "Target", - // color: colors.off, - // datasetPath: `date-to-blocks-mined-1y-target`, - // options: { - // lineStyle: 3, - // }, - // }, - // { - // title: "Sum Mined", - // color: colors.bitcoin, - // datasetPath: `date-to-blocks-mined-1y-sum`, - // }, - // ], - // }, - // { - // scale, - // name: "Total", - // title: "Total Blocks Mined", - // description: "", - // unit: "Count", - // bottom: [ - // { - // title: "Mined", - // color: colors.bitcoin, - // datasetPath: `date-to-total-blocks-mined`, - // }, - // ], - // }, - // ], - // }, - // { - // scale, - // name: "Size", - // tree: [ - // { - // scale, - // name: "Cumulative", - // title: "Cumulative Block Size", - // description: "", - // unit: "Gigabytes", - // bottom: [ - // { - // title: "Size", - // color: colors.off, - // datasetPath: `${scale}-to-cumulative-block-size-gigabytes`, - // }, - // ], - // }, - // ...createRecapOptions({ - // scale, - // title: "Block Size", - // color: colors.off, - // unit: "Megabytes", - // keySum: "date-to-block-size-1d-sum", - // keyAverage: "date-to-block-size-1d-average", - // keyMax: "date-to-block-size-1d-max", - // key90p: "date-to-block-size-1d-90p", - // key75p: "date-to-block-size-1d-75p", - // keyMedian: "date-to-block-size-1d-median", - // key25p: "date-to-block-size-1d-25p", - // key10p: "date-to-block-size-1d-10p", - // keyMin: "date-to-block-size-1d-min", - // }), - // ], - // }, - // { - // scale, - // name: "Weight", - // tree: createRecapOptions({ - // scale, - // title: "Block Weight", - // color: colors.off, - // unit: "Weight", - // keyAverage: "date-to-block-weight-1d-average", - // keyMax: "date-to-block-weight-1d-max", - // key90p: "date-to-block-weight-1d-90p", - // key75p: "date-to-block-weight-1d-75p", - // keyMedian: "date-to-block-weight-1d-median", - // key25p: "date-to-block-weight-1d-25p", - // key10p: "date-to-block-weight-1d-10p", - // keyMin: "date-to-block-weight-1d-min", - // }), - // }, - // { - // scale, - // name: "VBytes", - // tree: createRecapOptions({ - // scale, - // title: "Block VBytes", - // color: colors.off, - // unit: "Virtual Bytes", - // keyAverage: "date-to-block-vbytes-1d-average", - // keyMax: "date-to-block-vbytes-1d-max", - // key90p: "date-to-block-vbytes-1d-90p", - // key75p: "date-to-block-vbytes-1d-75p", - // keyMedian: "date-to-block-vbytes-1d-median", - // key25p: "date-to-block-vbytes-1d-25p", - // key10p: "date-to-block-vbytes-1d-10p", - // keyMin: "date-to-block-vbytes-1d-min", - // }), - // }, - // { - // scale, - // name: "Interval", - // tree: createRecapOptions({ - // scale, - // title: "Block Interval", - // color: colors.off, - // unit: "Seconds", - // keyAverage: "date-to-block-interval-1d-average", - // keyMax: "date-to-block-interval-1d-max", - // key90p: "date-to-block-interval-1d-90p", - // key75p: "date-to-block-interval-1d-75p", - // keyMedian: "date-to-block-interval-1d-median", - // key25p: "date-to-block-interval-1d-25p", - // key10p: "date-to-block-interval-1d-10p", - // keyMin: "date-to-block-interval-1d-min", - // }), - // }, - // ]) - // : /** @type {PartialOptionsTree} */ ([ - // { - // scale, - // name: "Size", - // title: "Block Size", - // description: "", - // unit: "Megabytes", - // bottom: [ - // { - // title: "Size", - // color: colors.off, - // datasetPath: `height-to-block-size`, - // }, - // ], - // }, - // { - // scale, - // name: "Weight", - // title: "Block Weight", - // description: "", - // unit: "Weight", - // bottom: [ - // { - // title: "Weight", - // color: colors.off, - // datasetPath: `height-to-block-weight`, - // }, - // ], - // }, - // { - // scale, - // name: "VBytes", - // title: "Block VBytes", - // description: "", - // unit: "Virtual Bytes", - // bottom: [ - // { - // title: "VBytes", - // color: colors.off, - // datasetPath: `height-to-block-vbytes`, - // }, - // ], - // }, - // { - // scale, - // name: "Interval", - // title: "Block Interval", - // description: "", - // unit: "Seconds", - // bottom: [ - // { - // title: "Interval", - // color: colors.off, - // datasetPath: `height-to-block-interval`, - // }, - // ], - // }, - // ])), - // ], - // }; - // } - - // /** - // * @param {TimeScale} scale - // * @returns {PartialOptionsGroup} - // */ - // function createMinersOptions(scale) { - // return { - // name: "Miners", - // tree: [ - // { - // name: "Coinbases", - // tree: [ - // .../** @satisfies {PartialOptionsTree} */ ( - // scale === "date" - // ? [ - // { - // scale, - // name: "Daily Sum", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Daily Sum Of Coinbases In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Sum", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-coinbase-1d-sum`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Daily Sum Of Coinbases In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Sum", - // color: colors.dollars, - // datasetPath: `${scale}-to-coinbase-in-dollars-1d-sum`, - // }, - // ], - // }, - // ], - // }, - // { - // scale, - // name: "Yearly Sum", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Yearly Sum Of Coinbases In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Sum", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-coinbase-1y-sum`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Yearly Sum Of Coinbases In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Sum", - // color: colors.dollars, - // datasetPath: `${scale}-to-coinbase-in-dollars-1y-sum`, - // }, - // ], - // }, - // ], - // }, - // { - // scale, - // name: "Cumulative", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Cumulative Coinbases In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Coinbases", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-cumulative-coinbase`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Cumulative Coinbases In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Coinbases", - // color: colors.dollars, - // datasetPath: `${scale}-to-cumulative-coinbase-in-dollars`, - // }, - // ], - // }, - // ], - // }, - // { - // name: "Last Block", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Last Coinbase In Bitcoin", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Last", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-last-coinbase`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Last Coinbase In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Last", - // color: colors.dollars, - // datasetPath: `${scale}-to-last-coinbase-in-dollars`, - // }, - // ], - // }, - // ], - // }, - // ] - // : [ - // { - // scale, - // name: "In Bitcoin", - // title: "Coinbases In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Coinbase", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-coinbase`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Coinbases In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Coinbase", - // color: colors.dollars, - // datasetPath: `${scale}-to-coinbase-in-dollars`, - // }, - // ], - // }, - // ] - // ), - // ], - // }, - - // { - // name: "Subsidies", - // tree: [ - // .../** @satisfies {PartialOptionsTree} */ ( - // scale === "date" - // ? [ - // { - // scale, - // name: "Daily Sum", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Daily Sum Of Subsidies In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Sum", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-subsidy-1d-sum`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Daily Sum Of Subsidies In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Sum", - // color: colors.dollars, - // datasetPath: `${scale}-to-subsidy-in-dollars-1d-sum`, - // }, - // ], - // }, - // ], - // }, - // { - // scale, - // name: "Yearly Sum", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Yearly Sum Of Subsidies In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Sum", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-subsidy-1y-sum`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Yearly Sum Of Subsidies In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Sum", - // color: colors.dollars, - // datasetPath: `${scale}-to-subsidy-in-dollars-1y-sum`, - // }, - // ], - // }, - // ], - // }, - // { - // scale, - // name: "Cumulative", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Cumulative Subsidies In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Subsidies", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-cumulative-subsidy`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Cumulative Subsidies In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Subsidies", - // color: colors.dollars, - // datasetPath: `${scale}-to-cumulative-subsidy-in-dollars`, - // }, - // ], - // }, - // ], - // }, - // { - // name: "Last Block", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Last Subsidy In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Last", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-last-subsidy`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Last Subsidy In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Last", - // color: colors.dollars, - // datasetPath: `${scale}-to-last-subsidy-in-dollars`, - // }, - // ], - // }, - // ], - // }, - // ] - // : [ - // { - // scale, - // name: "In Bitcoin", - // title: "Subsidies In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Sum", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-subsidy`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Subsidies In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Sum", - // color: colors.dollars, - // datasetPath: `${scale}-to-subsidy-in-dollars`, - // }, - // ], - // }, - // ] - // ), - // ], - // }, - - // { - // name: "Fees", - // tree: [ - // .../** @satisfies {PartialOptionsTree} */ ( - // scale === "date" - // ? [ - // { - // scale, - // name: "Daily Sum", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Daily Sum Of Fees In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Sum", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-fees-1d-sum`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Daily Sum Of Fees In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Sum", - // color: colors.dollars, - // datasetPath: `${scale}-to-fees-in-dollars-1d-sum`, - // }, - // ], - // }, - // ], - // }, - // { - // scale, - // name: "Yearly Sum", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Yearly Sum Of Fees In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Sum", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-fees-1y-sum`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Yearly Sum Of Fees In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Sum", - // color: colors.dollars, - // datasetPath: `${scale}-to-fees-in-dollars-1y-sum`, - // }, - // ], - // }, - // ], - // }, - // { - // scale, - // name: "Cumulative", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Cumulative Fees In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Fees", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-cumulative-fees`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Cumulative Fees In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Fees", - // color: colors.dollars, - // datasetPath: `${scale}-to-cumulative-fees-in-dollars`, - // }, - // ], - // }, - // ], - // }, - // { - // name: "Last Block", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Last Fees In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Last", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-last-fees`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Last Fees In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Last", - // color: colors.dollars, - // datasetPath: `${scale}-to-last-fees-in-dollars`, - // }, - // ], - // }, - // ], - // }, - // ] - // : [ - // { - // scale, - // name: "In Bitcoin", - // title: "Fees In Bitcoin", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Sum", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-fees`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Fees In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Sum", - // color: colors.dollars, - // datasetPath: `${scale}-to-fees-in-dollars`, - // }, - // ], - // }, - // ] - // ), - // ], - // }, - - // { - // scale, - // name: "Subsidy V. Fees", - // title: "Subsidy V. Fees", - // description: "", - // unit: "Percentage", - // bottom: [ - // { - // title: "Subsidy", - // color: colors.bitcoin, - // datasetPath: - // scale === "date" - // ? `${scale}-to-subsidy-to-coinbase-1d-ratio` - // : `${scale}-to-subsidy-to-coinbase-ratio`, - // }, - // { - // title: "Fees", - // color: colors.offBitcoin, - // datasetPath: - // scale === "date" - // ? `${scale}-to-fees-to-coinbase-1d-ratio` - // : `${scale}-to-fees-to-coinbase-ratio`, - // }, - // ], - // }, - - // ...(scale === "date" - // ? /** @type {PartialOptionsTree} */ ([ - // { - // scale, - // name: "Puell Multiple", - // title: "Puell Multiple", - // description: "", - // unit: "", - // bottom: [ - // { - // title: "Multiple", - // color: colors.bitcoin, - // datasetPath: `date-to-puell-multiple`, - // }, - // ], - // }, - - // { - // name: "Hash", - // tree: [ - // { - // scale, - // name: "Rate", - // title: "Hash Rate", - // description: "", - // unit: "ExaHash / Second", - // bottom: [ - // { - // title: "1M SMA", - // color: colors.momentumYellow, - // datasetPath: `date-to-hash-rate-1m-sma`, - // }, - // { - // title: "1W SMA", - // color: colors.bitcoin, - // datasetPath: `date-to-hash-rate-1w-sma`, - // }, - // { - // title: "Rate", - // color: colors.offBitcoin, - // datasetPath: `date-to-hash-rate`, - // }, - // ], - // }, - // { - // scale, - // name: "Ribbon", - // title: "Hash Ribbon", - // description: "", - // unit: "ExaHash / Second", - // bottom: [ - // { - // title: "1M SMA", - // color: colors.profit, - // datasetPath: `date-to-hash-rate-1m-sma`, - // }, - // { - // title: "2M SMA", - // color: colors.loss, - // datasetPath: `date-to-hash-rate-2m-sma`, - // }, - // ], - // }, - // { - // name: "Price", - // tree: [ - // { - // scale, - // name: "Price", - // title: "Hash Price", - // description: "", - // unit: "Dollars / (PetaHash / Second)", - // bottom: [ - // { - // title: "Hash Price", - // color: colors.dollars, - // datasetPath: `date-to-hash-price`, - // }, - // ], - // }, - // { - // scale, - // name: "Min", - // title: "Min Hash Price", - // description: "", - // unit: "Dollars / (PetaHash / Second)", - // bottom: [ - // { - // title: "Min Hash Price", - // color: colors.dollars, - // datasetPath: `date-to-hash-price-min`, - // }, - // ], - // }, - // { - // scale, - // name: "Rebound", - // title: "Hash Price Rebound", - // description: "", - // unit: "Percentage", - // bottom: [ - // { - // title: "Rebound", - // color: colors.yellow, - // datasetPath: `date-to-hash-price-rebound`, - // }, - // ], - // }, - // ], - // }, - // ], - // }, - // ]) - // : []), - - // { - // scale, - // name: "Difficulty", - // title: "Difficulty", - // description: "", - // unit: "", - // bottom: [ - // { - // title: "Difficulty", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-difficulty`, - // }, - // ], - // }, - - // ...(scale === "date" - // ? /** @type {PartialOptionsTree} */ ([ - // { - // scale, - // name: "Difficulty Adjustment", - // title: "Difficulty Adjustment", - // description: "", - // unit: "Percentage", - // bottom: [ - // { - // title: "Adjustment", - // type: "Baseline", - // datasetPath: `${scale}-to-difficulty-adjustment`, - // }, - // bases[0](scale), - // ], - // }, - // { - // scale, - // name: "Annualized Issuance", - // title: "Annualized Issuance", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Issuance", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-annualized-issuance`, - // }, - // ], - // }, - // { - // name: "Inflation Rate", - // tree: [ - // { - // scale, - // name: "Today", - // title: "Inflation Rate", - // description: "", - // unit: "Percentage", - // bottom: [ - // { - // title: "Rate", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-inflation-rate`, - // }, - // ], - // }, - // { - // scale, - // name: "Yearly", - // title: "Yearly Inflation Rate", - // description: "", - // unit: "Percentage", - // bottom: [ - // { - // title: "Rate", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-yearly-inflation-rate`, - // }, - // ], - // }, - // ], - // }, - // ]) - // : []), - // ], - // }; - // } - - // /** - // * @param {TimeScale} scale - // * @returns {PartialOptionsGroup} - // */ - // function createTransactionsOptions(scale) { - // return { - // name: "Transactions", - // tree: [ - // { - // scale, - // name: "Count", - // title: "Transaction Count", - // description: "", - // unit: "Count", - // bottom: [ - // { - // title: "1M SMA", - // color: colors.momentumYellow, - // datasetPath: - // scale === "date" - // ? `${scale}-to-transaction-count-1d-sum-1m-sma` - // : `${scale}-to-transaction-count-1m-sma`, - // }, - // { - // title: "1W SMA", - // color: colors.bitcoin, - // datasetPath: - // scale === "date" - // ? `${scale}-to-transaction-count-1d-sum-1w-sma` - // : `${scale}-to-transaction-count-1w-sma`, - // }, - // { - // title: "Raw", - // color: colors.offBitcoin, - // datasetPath: - // scale === "date" - // ? `${scale}-to-transaction-count-1d-sum` - // : `${scale}-to-transaction-count`, - // main: true, - // }, - // ], - // }, - - // { - // name: "Volume", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Transaction Volume", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "1M SMA", - // color: colors.momentumYellow, - // datasetPath: - // scale === "date" - // ? `${scale}-to-transaction-volume-1d-sum-1m-sma` - // : `${scale}-to-transaction-volume-1m-sma`, - // }, - // { - // title: "1W SMA", - // color: colors.bitcoin, - // datasetPath: - // scale === "date" - // ? `${scale}-to-transaction-volume-1d-sum-1w-sma` - // : `${scale}-to-transaction-volume-1w-sma`, - // }, - // { - // title: "Raw", - // color: colors.offBitcoin, - // datasetPath: - // scale === "date" - // ? `${scale}-to-transaction-volume-1d-sum` - // : `${scale}-to-transaction-volume`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Transaction Volume In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "1M SMA", - // color: colors.lightDollars, - // datasetPath: - // scale === "date" - // ? `${scale}-to-transaction-volume-in-dollars-1d-sum-1m-sma` - // : `${scale}-to-transaction-volume-in-dollars-1m-sma`, - // }, - // { - // title: "1W SMA", - // color: colors.dollars, - // datasetPath: - // scale === "date" - // ? `${scale}-to-transaction-volume-in-dollars-1d-sum-1w-sma` - // : `${scale}-to-transaction-volume-in-dollars-1w-sma`, - // }, - // { - // title: "Raw", - // color: colors.offDollars, - // datasetPath: - // scale === "date" - // ? `${scale}-to-transaction-volume-in-dollars-1d-sum` - // : `${scale}-to-transaction-volume-in-dollars`, - // }, - // ], - // }, - // ], - // }, - - // ...(scale === "date" - // ? /** @type {PartialOptionsTree} */ ([ - // { - // name: "Annualized Volume", - // tree: [ - // { - // scale, - // name: "In Bitcoin", - // title: "Annualized Transaction Volume", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Volume", - // color: colors.bitcoin, - // datasetPath: `date-to-annualized-transaction-volume`, - // }, - // ], - // }, - // { - // scale, - // name: "In Dollars", - // title: "Annualized Transaction Volume In Dollars", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Volume", - // color: colors.dollars, - // datasetPath: `date-to-annualized-transaction-volume-in-dollars`, - // }, - // ], - // }, - // ], - // }, - // { - // scale, - // name: "Velocity", - // title: "Transactions Velocity", - // description: "", - // unit: "", - // bottom: [ - // { - // title: "Transactions Velocity", - // color: colors.bitcoin, - // datasetPath: `date-to-transaction-velocity`, - // }, - // ], - // }, - // ]) - // : []), - // { - // scale, - // name: "Per Second", - // title: "Transactions Per Second", - // description: "", - // unit: "Transactions", - // bottom: [ - // { - // title: "1M SMA", - // color: colors.lightBitcoin, - // datasetPath: `${scale}-to-transactions-per-second-1m-sma`, - // }, - // { - // title: "1W SMA", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-transactions-per-second-1w-sma`, - // }, - // { - // title: "Raw", - // color: colors.offBitcoin, - // datasetPath: `${scale}-to-transactions-per-second`, - // main: true, - // }, - // ], - // }, - // ], - // }; - // } - - // const cohortOptionOrOptions = { - // /** - // * @param {DefaultCohortOption | DefaultCohortOptions} arg - // */ - // toList(arg) { - // return "list" in arg ? arg.list : [arg]; - // }, - // /** - // * @param {DefaultCohortOption | DefaultCohortOptions} arg - // * @param {string} cohortName - // * @param {string} legendName - // */ - // toLegendName(arg, cohortName, legendName) { - // return "list" in arg ? `${cohortName} ${legendName}` : legendName; - // }, - // /** - // * @template {AnyPossibleCohortId} T - // * @param {CohortOption | CohortOptions} arg - // * @param {{ title: string; singleColor?: Color; genPath: (id: T, scale: TimeScale) => AnyDatasetPath} & Omit} blueprint - // */ - // generateSeriesBlueprints(arg, blueprint) { - // return this.toList(arg).map( - // ({ scale, datasetId, color, name }) => - // /** @satisfies {AnySeriesBlueprint} */ ({ - // title: cohortOptionOrOptions.toLegendName( - // arg, - // name, - // blueprint.title, - // ), - // color: "list" in arg ? color : blueprint.singleColor || color, - // type: blueprint.type || "Line", - // // Don't get why TS is annoying here - // // @ts-ignore - // datasetPath: blueprint.genPath(datasetId, scale), - // options: blueprint.options, - // }), - // ); - // }, - // /** - // * @param {DefaultCohortOption | DefaultCohortOptions} arg - // */ - // shouldShowAll(arg) { - // return "list" in arg || arg.datasetId; - // }, - // /** - // * @param {DefaultCohortOption | DefaultCohortOptions} arg - // * @param {(prefix: AnyDatasetPrefix, arg: DefaultCohortOption) => PartialChartOption[]} genOption - // */ - // genOptionsIfSingle(arg, genOption) { - // if (!("list" in arg)) { - // const prefix = datasetIdToPrefix(arg.datasetId); - // return genOption(prefix, arg); - // } else { - // return []; - // } - // }, - // /** - // * @param {DefaultCohortOption | DefaultCohortOptions} arg - // * @param {(scale: 'date') => PartialChartOption[]} genOption - // */ - // genOptionsIfDate(arg, genOption) { - // if (arg.scale === "date") { - // return genOption("date"); - // } else { - // return []; - // } - // }, - // }; - - // /** - // * @param {DefaultCohortOption | DefaultCohortOptions} arg - // * @returns {PartialOptionsGroup} - // */ - // function createCohortUTXOOptions(arg) { - // const { scale, title } = arg; - - // return { - // name: "UTXOs", - // tree: [ - // { - // scale, - // name: `Count`, - // title: `Number Of ${title} Unspent Transaction Outputs`, - // description: "", - // unit: "Count", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Count", - // genPath: (id, scale) => - // /** @type {const} */ ( - // `${scale}-to-${datasetIdToPrefix(id)}utxo-count` - // ), - // }), - // }, - // ], - // }; - // } - - /** - * @param {DefaultCohortOption | DefaultCohortOptions} arg - * @returns {PartialOptionsGroup} - // */ - // function createCohortRealizedOptions(arg) { - // const { scale, title } = arg; - - // /** - // * @param {DefaultCohortOption} arg - // * @returns {RatioOption} - // */ - // function argToRatioArg(arg) { - // return { - // scale, - // color: arg.color, - // ratioDatasetPath: `${scale}-to-market-price-to-${datasetIdToPrefix( - // arg.datasetId, - // )}realized-price-ratio`, - // valueDatasetPath: `${scale}-to-${datasetIdToPrefix( - // arg.datasetId, - // )}realized-price`, - // title: `${arg.title} Realized Price`, - // }; - // } - - // return { - // name: "Realized", - // tree: [ - // { - // scale, - // name: `Price`, - // title: `${title} Realized Price`, - // description: "", - // unit: "US Dollars", - // top: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Realized Price", - // genPath: (id, scale) => - // /** @type {const} */ ( - // `${scale}-to-${datasetIdToPrefix(id)}realized-price` - // ), - // }), - // }, - // createRatioOptions( - // "list" in arg - // ? { - // ...arg, - // list: arg.list.map(argToRatioArg), - // } - // : argToRatioArg(arg), - // ), - // { - // scale, - // name: `Capitalization`, - // title: `${title} Realized Capitalization`, - // description: "", - // unit: "US Dollars", - // bottom: [ - // ...cohortOptionOrOptions.generateSeriesBlueprints( - // arg, - - // { - // title: "Realized Cap.", - // genPath: (id, scale) => - // /** @type {const} */ ( - // `${scale}-to-${datasetIdToPrefix(id)}realized-cap` - // ), - // }, - // ), - // ...(cohortOptionOrOptions.shouldShowAll(arg) - // ? /** @type {const} */ ([ - // { - // title: "Realized Cap.", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-realized-cap`, - // defaultActive: false, - // }, - // ]) - // : []), - // ], - // }, - // { - // scale, - // name: `Capitalization 1M Net Change`, - // title: `${title} Realized Capitalization 1 Month Net Change`, - // description: "", - // unit: "US Dollars", - // bottom: [ - // ...cohortOptionOrOptions.generateSeriesBlueprints( - // arg, - - // { - // title: "Net Change", - // type: "Baseline", - // genPath: (id, scale) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}realized-cap-1m-net-change`, - // }, - // ), - // bases[0](scale), - // ], - // }, - // { - // scale, - // name: `Profit`, - // title: `${title} Realized Profit`, - // description: "", - // unit: "US Dollars", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Realized Profit", - // singleColor: colors.profit, - // genPath: (id, scale) => { - // const prefix = datasetIdToPrefix(id); - // return scale === "date" - // ? `date-to-${prefix}realized-profit-1d-sum` - // : `height-to-${prefix}realized-profit`; - // }, - // }), - // }, - // { - // scale, - // name: "Loss", - // title: `${title} Realized Loss`, - // description: "", - // unit: "US Dollars", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Realized Loss", - // singleColor: colors.loss, - // genPath: (id, scale) => { - // const prefix = datasetIdToPrefix(id); - // return scale === "date" - // ? `date-to-${prefix}realized-loss-1d-sum` - // : `height-to-${prefix}realized-loss`; - // }, - // }), - // }, - // ...cohortOptionOrOptions.genOptionsIfSingle(arg, (prefix) => [ - // { - // scale, - // name: `PNL - Profit And Loss`, - // title: `${title} Realized Profit And Loss`, - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Profit", - // color: colors.profit, - // datasetPath: - // scale === "date" - // ? `date-to-${prefix}realized-profit-1d-sum` - // : `height-to-${prefix}realized-profit`, - // type: "Baseline", - // }, - // { - // title: "Loss", - // color: colors.loss, - // datasetPath: - // scale === "date" - // ? `date-to-${prefix}negative-realized-loss-1d-sum` - // : `height-to-${prefix}negative-realized-loss`, - // type: "Baseline", - // }, - // bases[0](scale), - // ], - // }, - // ]), - // { - // scale, - // name: `Net PNL - Net Profit And Loss`, - // title: `${title} Net Realized Profit And Loss`, - // description: "", - // unit: "US Dollars", - // bottom: [ - // ...cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Net PNL", - // type: "Baseline", - // genPath: (id, scale) => { - // const prefix = datasetIdToPrefix(id); - // return scale === "date" - // ? `date-to-${prefix}net-realized-profit-and-loss-1d-sum` - // : `height-to-${prefix}net-realized-profit-and-loss`; - // }, - // }), - // bases[0](scale), - // ], - // }, - // ...cohortOptionOrOptions.genOptionsIfDate(arg, (scale) => [ - // { - // scale, - // name: `Net PNL Relative To Market Cap`, - // title: `${title} Net Realized Profit And Loss Relative To Market Capitalization`, - // description: "", - // unit: "Percentage", - // bottom: [ - // ...cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Net", - // type: "Baseline", - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}net-realized-profit-and-loss-to-market-cap-ratio`, - // }), - // bases[0](scale), - // ], - // }, - // ]), - // { - // name: "Cumulative", - // tree: [ - // { - // scale, - // name: `Profit`, - // title: `${title} Cumulative Realized Profit`, - // description: "", - // unit: "US Dollars", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Cumulative Realized Profit", - // singleColor: colors.profit, - // genPath: (id, scale) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}cumulative-realized-profit`, - // }), - // }, - // { - // scale, - // name: "Loss", - // title: `${title} Cumulative Realized Loss`, - // description: "", - // unit: "US Dollars", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Cumulative Realized Loss", - // singleColor: colors.loss, - // genPath: (id, scale) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}cumulative-realized-loss`, - // }), - // }, - // { - // scale, - // name: `Net PNL`, - // title: `${title} Cumulative Net Realized Profit And Loss`, - // description: "", - // unit: "US Dollars", - // bottom: [ - // ...cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Cumulative Net Realized PNL", - // type: "Baseline", - // genPath: (id, scale) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}cumulative-net-realized-profit-and-loss`, - // }), - // bases[0](scale), - // ], - // }, - // { - // scale, - // name: `Net PNL 30 Day Change`, - // title: `${title} Cumulative Net Realized Profit And Loss 30 Day Change`, - // description: "", - // unit: "US Dollars", - // bottom: [ - // ...cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Cumulative Net Realized PNL 30d Change", - // type: "Baseline", - // genPath: (id, scale) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}cumulative-net-realized-profit-and-loss-1m-net-change`, - // }), - // bases[0](scale), - // ], - // }, - // ], - // }, - // { - // scale, - // name: "Profit To Loss Ratio", - // title: `${title} Profit To Loss Ratio`, - // description: "", - // unit: "Ratio", - // bottom: [ - // ...cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Ratio", - // type: "Baseline", - // options: { - // baseValue: { - // price: 1, - // }, - // }, - // genPath: (id, scale) => { - // const prefix = datasetIdToPrefix(id); - // return scale === "date" - // ? `date-to-${prefix}realized-profit-to-loss-1d-sum-ratio` - // : `height-to-${prefix}realized-profit-to-loss-ratio`; - // }, - // }), - // bases[1](scale, "Even"), - // ], - // }, - // { - // name: `Spent Output Profit Ratio`, - // tree: [ - // { - // scale, - // name: `Normal - SOPR`, - // title: `${title} Spent Output Profit Ratio`, - // description: "", - // unit: "Percentage", - // bottom: [ - // ...cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "SOPR", - // type: "Baseline", - // options: { - // baseValue: { - // price: 1, - // }, - // }, - // genPath: (id, scale) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}spent-output-profit-ratio`, - // }), - // bases[1](scale), - // ], - // }, - // { - // scale, - // name: `Adjusted - aSOPR`, - // title: `${title} Adjusted Spent Output Profit Ratio`, - // description: "", - // unit: "Percentage", - // bottom: [ - // ...cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "aSOPR", - // type: "Baseline", - // options: { - // baseValue: { - // price: 1, - // }, - // }, - // genPath: (id, scale) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}adjusted-spent-output-profit-ratio`, - // }), - // bases[1](scale), - // ], - // }, - // ], - // }, - // { - // name: "Value", - // tree: [ - // { - // name: "Created", - // tree: [ - // { - // scale, - // name: `Normal`, - // title: `${title} Value Created`, - // description: "", - // unit: "US Dollars", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Value", - // singleColor: colors.profit, - // genPath: (id, scale) => { - // const prefix = datasetIdToPrefix(id); - // return scale === "date" - // ? `date-to-${prefix}value-created-1d-sum` - // : `height-to-${prefix}value-created`; - // }, - // }), - // }, - // { - // scale, - // name: `Adjusted`, - // title: `${title} Adjusted Value Created`, - // description: "", - // unit: "US Dollars", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Adjusted Value", - // singleColor: colors.profit, - // genPath: (id, scale) => { - // const prefix = datasetIdToPrefix(id); - // return scale === "date" - // ? `date-to-${prefix}adjusted-value-created-1d-sum` - // : `height-to-${prefix}adjusted-value-created`; - // }, - // }), - // }, - // ], - // }, - // { - // name: "Destroyed", - // tree: [ - // { - // scale, - // name: `Normal`, - // title: `${title} Value Destroyed`, - // description: "", - // unit: "US Dollars", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Value", - // singleColor: colors.loss, - // genPath: (id, scale) => { - // const prefix = datasetIdToPrefix(id); - // return scale === "date" - // ? `date-to-${prefix}value-destroyed-1d-sum` - // : `height-to-${prefix}value-destroyed`; - // }, - // }), - // }, - // { - // scale, - // name: `Adjusted`, - // title: `${title} Adjusted Value Destroyed`, - // description: "", - // unit: "US Dollars", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Adjusted Value", - // singleColor: colors.loss, - // genPath: (id, scale) => { - // const prefix = datasetIdToPrefix(id); - // return scale === "date" - // ? `date-to-${prefix}adjusted-value-destroyed-1d-sum` - // : `height-to-${prefix}adjusted-value-destroyed`; - // }, - // }), - // }, - // ], - // }, - // ], - // }, - // ...cohortOptionOrOptions.genOptionsIfDate(arg, (scale) => [ - // /** @satisfies {PartialChartOption} */ ({ - // scale, - // name: `Sell Side Risk Ratio`, - // title: `${title} Sell Side Risk Ratio`, - // description: "", - // unit: "Percentage", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Ratio", - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix(id)}sell-side-risk-ratio`, - // }), - // }), - // ]), - // ], - // }; - // } - - // /** - // * @param {DefaultCohortOption | DefaultCohortOptions} arg - // * @returns {PartialOptionsGroup} - // */ - // function createCohortUnrealizedOptions(arg) { - // const { scale, title } = arg; - - // return { - // name: "Unrealized", - // tree: [ - // { - // scale, - // name: `Profit`, - // title: `${title} Unrealized Profit`, - // description: "", - // unit: "US Dollars", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Profit", - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix(id)}unrealized-profit`, - // singleColor: colors.profit, - // }), - // }, - // { - // scale, - // name: "Loss", - // title: `${title} Unrealized Loss`, - // description: "", - // unit: "US Dollars", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Loss", - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix(id)}unrealized-loss`, - // singleColor: colors.loss, - // }), - // }, - // ...cohortOptionOrOptions.genOptionsIfSingle(arg, (prefix) => [ - // { - // scale, - // name: `PNL - Profit And Loss`, - // title: `${title} Unrealized Profit And Loss`, - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Profit", - // color: colors.profit, - // datasetPath: `${scale}-to-${prefix}unrealized-profit`, - // type: "Baseline", - // }, - // { - // title: "Loss", - // color: colors.loss, - // datasetPath: `${scale}-to-${prefix}negative-unrealized-loss`, - // type: "Baseline", - // }, - // bases[0](scale), - // ], - // }, - // ]), - // { - // scale, - // name: `Net PNL - Net Profit And Loss`, - // title: `${title} Net Unrealized Profit And Loss`, - // description: "", - // unit: "US Dollars", - // bottom: [ - // ...cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Net Unrealized PNL", - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}net-unrealized-profit-and-loss`, - // type: "Baseline", - // }), - // bases[0](scale), - // ], - // }, - // { - // scale, - // name: `Net PNL Relative To Market Cap - NUPL`, - // title: `${title} Net Unrealized Profit And Loss Relative To Total Market Capitalization - NUPL`, - // description: "", - // unit: "Percentage", - // bottom: [ - // ...cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Relative Net Unrealized PNL", - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}net-unrealized-profit-and-loss-to-market-cap-ratio`, - // type: "Baseline", - // }), - // bases[0](scale), - // ], - // }, - // ], - // }; - // } - - // /** - // * @param {DefaultCohortOption | DefaultCohortOptions} arg - // * @returns {PartialOptionsGroup} - // */ - // function createCohortSupplyOptions(arg) { - // const { scale, title } = arg; - - // return { - // name: "Supply", - // tree: [ - // { - // name: "Absolute", - // tree: [ - // ...cohortOptionOrOptions.genOptionsIfSingle(arg, (prefix) => [ - // { - // scale, - // name: "All", - // title: `${title} Profit And Loss`, - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "In Profit", - // color: colors.profit, - // datasetPath: `${scale}-to-${prefix}supply-in-profit`, - // }, - // { - // title: "In Loss", - // color: colors.loss, - // datasetPath: `${scale}-to-${prefix}supply-in-loss`, - // }, - // { - // title: "Total", - // color: colors.default, - // datasetPath: `${scale}-to-${prefix}supply`, - // }, - // { - // title: "Halved Total", - // color: colors.off, - // datasetPath: `${scale}-to-${prefix}halved-supply`, - // options: { - // lineStyle: 4, - // }, - // }, - // ], - // }, - // ]), - // { - // scale, - // name: `Total`, - // title: `${title} Total supply`, - // description: "", - // unit: "Bitcoin", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Supply", - // genPath: (id) => `${scale}-to-${datasetIdToPrefix(id)}supply`, - // }), - // }, - // { - // scale, - // name: "In Profit", - // title: `${title} Supply In Profit`, - // description: "", - // unit: "Bitcoin", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Supply", - // singleColor: colors.profit, - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix(id)}supply-in-profit`, - // }), - // }, - // { - // scale, - // name: "In Loss", - // title: `${title} Supply In Loss`, - // description: "", - // unit: "Bitcoin", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Supply", - // singleColor: colors.loss, - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix(id)}supply-in-loss`, - // }), - // }, - // ], - // }, - // { - // name: "Relative To Circulating", - // tree: [ - // ...cohortOptionOrOptions.genOptionsIfSingle(arg, (prefix) => [ - // { - // scale, - // name: "All", - // title: `${title} Profit And Loss Relative To Circulating Supply`, - // description: "", - // unit: "Percentage", - // bottom: [ - // { - // title: "In Profit", - // color: colors.profit, - // datasetPath: `${scale}-to-${prefix}supply-in-profit-to-circulating-supply-ratio`, - // }, - // { - // title: "In Loss", - // color: colors.loss, - // datasetPath: `${scale}-to-${prefix}supply-in-loss-to-circulating-supply-ratio`, - // }, - // { - // title: "100%", - // color: colors.default, - // datasetPath: `${scale}-to-${prefix}supply-to-circulating-supply-ratio`, - // }, - // { - // title: "50%", - // color: colors.off, - // datasetPath: `${scale}-to-${prefix}halved-supply-to-circulating-supply-ratio`, - // options: { - // lineStyle: 4, - // }, - // }, - // ], - // }, - // ]), - // { - // scale, - // name: `Total`, - // title: `${title} Total supply Relative To Circulating Supply`, - // description: "", - // unit: "Percentage", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Supply", - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}supply-to-circulating-supply-ratio`, - // }), - // }, - // { - // scale, - // name: "In Profit", - // title: `${title} Supply In Profit Relative To Circulating Supply`, - // description: "", - // unit: "Percentage", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Supply", - // singleColor: colors.profit, - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}supply-in-profit-to-circulating-supply-ratio`, - // }), - // }, - // { - // scale, - // name: "In Loss", - // title: `${title} Supply In Loss Relative To Circulating Supply`, - // description: "", - // unit: "Percentage", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Supply", - // singleColor: colors.loss, - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}supply-in-loss-to-circulating-supply-ratio`, - // }), - // }, - // ], - // }, - // { - // name: "Relative To Own", - // tree: [ - // ...cohortOptionOrOptions.genOptionsIfSingle(arg, (prefix) => [ - // { - // scale, - // name: "All", - // title: `${title} Supply In Profit And Loss Relative To Own Supply`, - // description: "", - // unit: "Percentage", - // bottom: [ - // { - // title: "In Profit", - // color: colors.profit, - // datasetPath: `${scale}-to-${prefix}supply-in-profit-to-own-supply-ratio`, - // }, - // { - // title: "In Loss", - // color: colors.loss, - // datasetPath: `${scale}-to-${prefix}supply-in-loss-to-own-supply-ratio`, - // }, - // { - // title: "100%", - // color: colors.default, - // datasetPath: `${scale}-to-100`, - // options: { - // lastValueVisible: false, - // }, - // }, - // { - // title: "50%", - // color: colors.off, - // datasetPath: `${scale}-to-50`, - // options: { - // lineStyle: 4, - // lastValueVisible: false, - // }, - // }, - // ], - // }, - // ]), - // { - // scale, - // name: "In Profit", - // title: `${title} Supply In Profit Relative To Own Supply`, - // description: "", - // unit: "Percentage", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Supply", - // singleColor: colors.profit, - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}supply-in-profit-to-own-supply-ratio`, - // }), - // }, - // { - // scale, - // name: "In Loss", - // title: `${title} Supply In Loss Relative To Own Supply`, - // description: "", - // unit: "Percentage", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Supply", - // singleColor: colors.loss, - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix( - // id, - // )}supply-in-loss-to-own-supply-ratio`, - // }), - // }, - // ], - // }, - // // createMomentumPresetFolder({ - // // datasets: datasets[scale], - // // scale, - // // id: `${scale}-${id}-supply-in-profit-and-loss-percentage-self`, - // // title: `${title} Supply In Profit And Loss (% Self)`, - // // datasetId: `${datasetId}SupplyPNL%Self`, - // // }), - // ], - // }; - // } - - // /** - // * @param {DefaultCohortOption | DefaultCohortOptions} arg - // * @returns {PartialOptionsGroup} - // */ - // function createCohortPricesPaidOptions(arg) { - // const { scale, title } = arg; - - // /** - // * @param {Object} args - // * @param {TimeScale} args.scale - // * @param {AnyDatasetPrefix} args.prefix - // * @param {PercentileId} args.id - // * @returns {AnyDatasetPath} - // */ - // function generatePath({ scale, prefix, id }) { - // return /** @type {const} */ (`${scale}-to-${prefix}${id}`); - // } - - // return { - // name: "Prices Paid", - // tree: [ - // { - // scale, - // name: `Average`, - // title: `${title} Average Price Paid - Realized Price`, - // description: "", - // unit: "US Dollars", - // top: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Average", - // genPath: (id) => - // `${scale}-to-${datasetIdToPrefix(id)}realized-price`, - // }), - // }, - // ...cohortOptionOrOptions.genOptionsIfSingle(arg, (prefix, arg) => [ - // { - // scale, - // name: `Deciles`, - // title: `${title} deciles`, - // description: "", - // unit: "US Dollars", - // top: groups.percentiles - // .filter(({ value }) => Number(value) % 10 === 0) - // .map(({ name, id }) => { - // const datasetPath = generatePath({ - // scale, - // prefix, - // id, - // }); - - // return { - // datasetPath, - // color: arg.color, - // title: name, - // }; - // }), - // }, - // ]), - // ...groups.percentiles.map((percentile) => ({ - // scale, - // name: percentile.name, - // title: `${title} ${percentile.title}`, - // description: "", - // unit: /** @type {const} */ ("US Dollars"), - // top: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Relative Net Unrealized PNL", - // genPath: (id) => - // generatePath({ - // scale, - // prefix: datasetIdToPrefix(id), - // id: percentile.id, - // }), - // }), - // })), - // ], - // }; - // } - - // /** - // * @param {DefaultCohortOption | DefaultCohortOptions} arg - // * @returns {PartialOptionsTree} - // */ - // function createCohortOptions(arg) { - // return [ - // createCohortUTXOOptions(arg), - // createCohortRealizedOptions(arg), - // createCohortUnrealizedOptions(arg), - // createCohortSupplyOptions(arg), - // createCohortPricesPaidOptions(arg), - // ]; - // } - - // /** - // * @param {TimeScale} scale - // * @returns {PartialOptionsGroup} - // */ - // function createAddressLiquidityOptions(scale) { - // return createAddressCohortOptionGroups({ - // scale, - // name: `By Liquidity`, - // list: groups.liquidities.map(({ name, id, key }) => ({ - // name, - // title: name, - // scale, - // color: colors[key], - // datasetId: id, - // })), - // }); - // } - - /** - * - * @param {DefaultCohortOption | DefaultCohortOptions} arg - * @returns {PartialOptionsGroup} - // */ - // function createCohortOptionsGroup(arg) { - // return { - // name: "list" in arg ? "Compare" : arg.name, - // tree: createCohortOptions(arg), - // }; - // } - - // /** - // * @param {TimeScale} scale - // * @returns {PartialOptionsGroup} - // */ - // function createHodlersOptions(scale) { - // /** - // * @param {Object} arg - // * @param {string} arg.name - // * @param {string} [arg.title] - // * @param {DefaultCohortOption[]} arg.list - // */ - // function createFolder({ name, title, list }) { - // return { - // name, - // tree: [ - // createCohortOptionsGroup({ - // scale, - // name, - // title: title || name, - // list, - // }), - // ...list.map((cohort) => createCohortOptionsGroup(cohort)), - // ], - // }; - // } - - // return { - // name: "Hodlers", - // tree: [ - // createFolder({ - // name: "X Term Holders", - // list: groups.xTermHolders.map(({ key, id, name, legend }) => ({ - // scale, - // color: colors[key], - // name: legend, - // datasetId: id, - // title: name, - // })), - // }), - // createFolder({ - // name: "Up To X", - // list: groups.upTo.map(({ key, id, name }) => ({ - // scale, - // color: colors[key], - // name, - // datasetId: id, - // title: name, - // })), - // }), - // createFolder({ - // name: "From X To Y", - // list: groups.fromXToY.map(({ key, id, name }) => ({ - // scale, - // color: colors[key], - // name, - // datasetId: id, - // title: name, - // })), - // }), - // createFolder({ - // name: "From X", - // list: groups.fromX.map(({ key, id, name }) => ({ - // scale, - // color: colors[key], - // name, - // datasetId: id, - // title: name, - // })), - // }), - // createFolder({ - // name: "Epoch X", - // title: "Epochs", - // list: groups.epochs.map(({ key, id, name }) => ({ - // scale, - // color: colors[key], - // name, - // datasetId: id, - // title: name, - // })), - // }), - // ], - // }; - // } - - // /** - // * @param {CohortOption | CohortOptions} arg - // * @returns {PartialChartOption} - // */ - // function createAddressCountOption(arg) { - // const { scale, title } = arg; - - // return { - // scale, - // name: `Address Count`, - // title: `${title} Address Count`, - // description: "", - // unit: "Count", - // bottom: cohortOptionOrOptions.generateSeriesBlueprints(arg, { - // title: "Address Count", - // genPath: (id) => `${scale}-to-${id}-address-count`, - // }), - // }; - // } - - // /** - // * @param {CohortOption | CohortOptions} arg - // * @returns {PartialOptionsGroup} - // */ - // function createAddressCohortOptionGroup(arg) { - // return { - // name: - // "list" in arg - // ? "Compare" - // : arg.filenameAddon - // ? `${arg.name} - ${arg.filenameAddon}` - // : arg.name, - // tree: [ - // { - // name: "Addresses", - // tree: [createAddressCountOption(arg)], - // }, - // ...createCohortOptions(arg), - // ], - // }; - // } - - // /** - // * @param {Object} arg - // * @param {TimeScale} arg.scale - // * @param {string} arg.name - // * @param {string} [arg.title] - // * @param {CohortOption[]} arg.list - // */ - // function createAddressCohortOptionGroups({ scale, name, title, list }) { - // return { - // name, - // tree: [ - // createAddressCohortOptionGroup({ - // scale, - // name, - // title: title || name, - // list, - // }), - // ...list.map((cohort) => createAddressCohortOptionGroup(cohort)), - // ], - // }; - // } - - // /** - // * @param {TimeScale} scale - // * @returns {PartialOptionsGroup} - // */ - // function createAddressesOptions(scale) { - // return { - // name: "Addresses", - // tree: [ - // { - // scale, - // name: `Total Non Empty Addresses`, - // title: `Total Non Empty Address`, - // description: "", - // unit: "Count", - // bottom: [ - // { - // title: `Total Non Empty Address`, - // color: colors.bitcoin, - // datasetPath: `${scale}-to-address-count`, - // }, - // ], - // }, - // { - // scale, - // name: `New Addresses`, - // title: `New Addresses`, - // description: "", - // unit: "Count", - // bottom: [ - // { - // title: `New Addresses`, - // color: colors.bitcoin, - // datasetPath: `${scale}-to-new-addresses`, - // }, - // ], - // }, - // { - // scale, - // name: `Total Addresses Created`, - // title: `Total Addresses Created`, - // description: "", - // unit: "Count", - // bottom: [ - // { - // title: `Total Addresses Created`, - // color: colors.bitcoin, - // datasetPath: `${scale}-to-created-addresses`, - // }, - // ], - // }, - // { - // scale, - // name: `Total Empty Addresses`, - // title: `Total Empty Addresses`, - // description: "", - // unit: "Count", - // bottom: [ - // { - // title: `Total Empty Addresses`, - // color: colors.off, - // datasetPath: `${scale}-to-empty-addresses`, - // }, - // ], - // }, - // createAddressCohortOptionGroups({ - // scale, - // name: "By Size", - // title: "Address Sizes", - // list: groups.size.map(({ key, name, size }) => ({ - // scale, - // color: colors[key], - // name, - // title: name, - // filenameAddon: size, - // datasetId: key, - // })), - // }), - // createAddressCohortOptionGroups({ - // scale, - // name: "By Type", - // title: "Address Types", - // list: groups.type.map(({ key, name }) => ({ - // scale, - // color: colors[key], - // name, - // title: name, - // datasetId: key, - // })), - // }), - // createAddressLiquidityOptions(scale), - // ], - // }; - // } - - // /** - // * @param {TimeScale} scale - // * @returns {PartialOptionsGroup} - // */ - // function createCointimeOptions(scale) { - // return { - // name: "Cointime Economics", - // tree: [ - // { - // name: "Prices", - // tree: [ - // { - // scale, - // name: "All", - // title: "All Cointime Prices", - // description: "", - // unit: "US Dollars", - // top: [ - // { - // title: "Vaulted Price", - // color: colors.vaultedness, - // datasetPath: `${scale}-to-vaulted-price`, - // }, - // { - // title: "Active Price", - // color: colors.liveliness, - // datasetPath: `${scale}-to-active-price`, - // }, - // { - // title: "True Market Mean", - // color: colors.trueMarketMeanPrice, - // datasetPath: `${scale}-to-true-market-mean`, - // }, - // { - // title: "Realized Price", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-realized-price`, - // }, - // { - // title: "Cointime", - // color: colors.cointimePrice, - // datasetPath: `${scale}-to-cointime-price`, - // }, - // ], - // }, - // { - // name: "Active", - // tree: [ - // { - // scale, - // name: "Price", - // title: "Active Price", - // description: "", - // unit: "US Dollars", - // top: [ - // { - // title: "Active Price", - // color: colors.liveliness, - // datasetPath: `${scale}-to-active-price`, - // }, - // ], - // }, - // createRatioOptions({ - // color: colors.liveliness, - // ratioDatasetPath: `${scale}-to-market-price-to-active-price-ratio`, - // scale, - // title: "Active Price", - // valueDatasetPath: `${scale}-to-active-price`, - // }), - // ], - // }, - // { - // name: "Vaulted", - // tree: [ - // { - // scale, - // name: "Price", - // title: "Vaulted Price", - // description: "", - // unit: "US Dollars", - // top: [ - // { - // title: "Vaulted Price", - // color: colors.vaultedness, - // datasetPath: `${scale}-to-vaulted-price`, - // }, - // ], - // }, - // createRatioOptions({ - // color: colors.vaultedness, - // ratioDatasetPath: `${scale}-to-market-price-to-vaulted-price-ratio`, - // scale, - // title: "Vaulted Price", - // valueDatasetPath: `${scale}-to-vaulted-price`, - // }), - // ], - // }, - // { - // name: "True Market Mean", - // tree: [ - // { - // scale, - // name: "Price", - // title: "True Market Mean", - // description: "", - // unit: "US Dollars", - // top: [ - // { - // title: "True Market Mean", - // color: colors.trueMarketMeanPrice, - // datasetPath: `${scale}-to-true-market-mean`, - // }, - // ], - // }, - // createRatioOptions({ - // color: colors.liveliness, - // ratioDatasetPath: `${scale}-to-market-price-to-true-market-mean-ratio`, - // scale, - // title: "True Market Mean", - // valueDatasetPath: `${scale}-to-true-market-mean`, - // }), - // ], - // }, - // { - // name: "Cointime Price", - // tree: [ - // { - // scale, - // name: "Price", - // title: "Cointime Price", - // description: "", - // unit: "US Dollars", - // top: [ - // { - // title: "Cointime", - // color: colors.cointimePrice, - // datasetPath: `${scale}-to-cointime-price`, - // }, - // ], - // }, - // createRatioOptions({ - // color: colors.cointimePrice, - // ratioDatasetPath: `${scale}-to-market-price-to-cointime-price-ratio`, - // scale, - // title: "Cointime", - // valueDatasetPath: `${scale}-to-cointime-price`, - // }), - // ], - // }, - // ], - // }, - // { - // name: "Capitalizations", - // tree: [ - // { - // scale, - // name: "All", - // title: "Cointime Capitalizations", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Market Cap", - // color: colors.default, - // datasetPath: `${scale}-to-market-cap`, - // }, - // { - // title: "Realized Cap", - // color: colors.realizedCap, - // datasetPath: `${scale}-to-realized-cap`, - // }, - // { - // title: "Investor Cap", - // color: colors.investorCap, - // datasetPath: `${scale}-to-investor-cap`, - // }, - // { - // title: "Thermo Cap", - // color: colors.thermoCap, - // datasetPath: `${scale}-to-thermo-cap`, - // }, - // ], - // }, - // { - // scale, - // name: "Thermo Cap", - // title: "Thermo Cap", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Thermo Cap", - // color: colors.thermoCap, - // datasetPath: `${scale}-to-thermo-cap`, - // }, - // ], - // }, - // { - // scale, - // name: "Investor Cap", - // title: "Investor Cap", - // description: "", - // unit: "US Dollars", - // bottom: [ - // { - // title: "Investor Cap", - // color: colors.investorCap, - // datasetPath: `${scale}-to-investor-cap`, - // }, - // ], - // }, - // { - // scale, - // name: "Thermo Cap To Investor Cap Ratio", - // title: "Thermo Cap To Investor Cap Ratio", - // description: "", - // unit: "Percentage", - // bottom: [ - // { - // title: "Ratio", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-thermo-cap-to-investor-cap-ratio`, - // }, - // ], - // }, - // ], - // }, - // { - // name: "Coinblocks", - // tree: [ - // { - // scale, - // name: "All", - // title: "All Coinblocks", - // description: "", - // unit: "Coinblocks", - // bottom: [ - // { - // title: "Coinblocks Created", - // color: colors.coinblocksCreated, - // datasetPath: - // scale === "date" - // ? `date-to-coinblocks-created-1d-sum` - // : `height-to-coinblocks-created`, - // }, - // { - // title: "Coinblocks Destroyed", - // color: colors.coinblocksDestroyed, - // datasetPath: - // scale === "date" - // ? `date-to-coinblocks-destroyed-1d-sum` - // : `height-to-coinblocks-destroyed`, - // }, - // { - // title: "Coinblocks Stored", - // color: colors.coinblocksStored, - // datasetPath: - // scale === "date" - // ? `date-to-coinblocks-stored-1d-sum` - // : `height-to-coinblocks-stored`, - // }, - // ], - // }, - // { - // scale, - // name: "Created", - // title: "Coinblocks Created", - // description: "", - // unit: "Coinblocks", - // bottom: [ - // { - // title: "Coinblocks Created", - // color: colors.coinblocksCreated, - // datasetPath: - // scale === "date" - // ? `date-to-coinblocks-created-1d-sum` - // : `height-to-coinblocks-created`, - // }, - // ], - // }, - // { - // scale, - // name: "Destroyed", - // title: "Coinblocks Destroyed", - // description: "", - // unit: "Coinblocks", - // bottom: [ - // { - // title: "Coinblocks Destroyed", - // color: colors.coinblocksDestroyed, - // datasetPath: - // scale === "date" - // ? `date-to-coinblocks-destroyed-1d-sum` - // : `height-to-coinblocks-destroyed`, - // }, - // ], - // }, - // { - // scale, - // name: "Stored", - // title: "Coinblocks Stored", - // description: "", - // unit: "Coinblocks", - // bottom: [ - // { - // title: "Coinblocks Stored", - // color: colors.coinblocksStored, - // datasetPath: - // scale === "date" - // ? `date-to-coinblocks-stored-1d-sum` - // : `height-to-coinblocks-stored`, - // }, - // ], - // }, - // ], - // }, - // { - // name: "Cumulative Coinblocks", - // tree: [ - // { - // scale, - // name: "All", - // title: "All Cumulative Coinblocks", - // description: "", - // unit: "Coinblocks", - // bottom: [ - // { - // title: "Cumulative Coinblocks Created", - // color: colors.coinblocksCreated, - // datasetPath: `${scale}-to-cumulative-coinblocks-created`, - // }, - // { - // title: "Cumulative Coinblocks Destroyed", - // color: colors.coinblocksDestroyed, - // datasetPath: `${scale}-to-cumulative-coinblocks-destroyed`, - // }, - // { - // title: "Cumulative Coinblocks Stored", - // color: colors.coinblocksStored, - // datasetPath: `${scale}-to-cumulative-coinblocks-stored`, - // }, - // ], - // }, - // { - // scale, - // name: "Created", - // title: "Cumulative Coinblocks Created", - // description: "", - // unit: "Coinblocks", - // bottom: [ - // { - // title: "Cumulative Coinblocks Created", - // color: colors.coinblocksCreated, - // datasetPath: `${scale}-to-cumulative-coinblocks-created`, - // }, - // ], - // }, - // { - // scale, - // name: "Destroyed", - // title: "Cumulative Coinblocks Destroyed", - // description: "", - // unit: "Coinblocks", - // bottom: [ - // { - // title: "Cumulative Coinblocks Destroyed", - // color: colors.coinblocksDestroyed, - // datasetPath: `${scale}-to-cumulative-coinblocks-destroyed`, - // }, - // ], - // }, - // { - // scale, - // name: "Stored", - // title: "Cumulative Coinblocks Stored", - // description: "", - // unit: "Coinblocks", - // bottom: [ - // { - // title: "Cumulative Coinblocks Stored", - // color: colors.coinblocksStored, - // datasetPath: `${scale}-to-cumulative-coinblocks-stored`, - // }, - // ], - // }, - // ], - // }, - // { - // name: "Liveliness & Vaultedness", - // tree: [ - // { - // scale, - // name: "Liveliness - Activity", - // title: "Liveliness (Activity)", - // description: "", - // unit: "", - // bottom: [ - // { - // title: "Liveliness", - // color: colors.liveliness, - // datasetPath: `${scale}-to-liveliness`, - // }, - // ], - // }, - // { - // scale, - // name: "Vaultedness", - // title: "Vaultedness", - // description: "", - // unit: "", - // bottom: [ - // { - // title: "Vaultedness", - // color: colors.vaultedness, - // datasetPath: `${scale}-to-vaultedness`, - // }, - // ], - // }, - // { - // scale, - // name: "Versus", - // title: "Liveliness V. Vaultedness", - // description: "", - // unit: "", - // bottom: [ - // { - // title: "Liveliness", - // color: colors.liveliness, - // datasetPath: `${scale}-to-liveliness`, - // }, - // { - // title: "Vaultedness", - // color: colors.vaultedness, - // datasetPath: `${scale}-to-vaultedness`, - // }, - // ], - // }, - // { - // scale, - // name: "Activity To Vaultedness Ratio", - // title: "Activity To Vaultedness Ratio", - // description: "", - // unit: "Percentage", - // bottom: [ - // { - // title: "Activity To Vaultedness Ratio", - // color: colors.activityToVaultednessRatio, - // datasetPath: `${scale}-to-activity-to-vaultedness-ratio`, - // }, - // ], - // }, - // ...(scale === "date" - // ? /** @satisfies {PartialOptionsTree} */ ([ - // { - // scale, - // name: "Concurrent Liveliness - Supply Adjusted Coindays Destroyed", - // title: - // "Concurrent Liveliness - Supply Adjusted Coindays Destroyed", - // description: "", - // unit: "", - // bottom: [ - // { - // title: "Concurrent Liveliness 14d Median", - // color: colors.liveliness, - // datasetPath: `${scale}-to-concurrent-liveliness-2w-median`, - // }, - // { - // title: "Concurrent Liveliness", - // color: colors.offLiveliness, - // datasetPath: `${scale}-to-concurrent-liveliness`, - // }, - // ], - // }, - // { - // scale, - // name: "Liveliness Incremental Change", - // title: "Liveliness Incremental Change", - // description: "", - // unit: "", - // bottom: [ - // { - // title: "Liveliness Incremental Change", - // color: colors.offLiveliness, - // type: "Baseline", - // datasetPath: `date-to-liveliness-net-change`, - // }, - // { - // title: "Liveliness Incremental Change 14 Day Median", - // color: colors.liveliness, - // type: "Baseline", - // datasetPath: `date-to-liveliness-net-change-2w-median`, - // }, - // bases[0]("date"), - // ], - // }, - // ]) - // : []), - // ], - // }, - // { - // name: "Supply", - // tree: [ - // { - // scale, - // name: "Vaulted", - // title: "Vaulted Supply", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Vaulted Supply", - // color: colors.vaultedness, - // datasetPath: `${scale}-to-vaulted-supply`, - // }, - // ], - // }, - // { - // scale, - // name: "Active", - // title: "Active Supply", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Active Supply", - // color: colors.liveliness, - // datasetPath: `${scale}-to-active-supply`, - // }, - // ], - // }, - // { - // scale, - // name: "Vaulted V. Active", - // title: "Vaulted V. Active", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Circulating Supply", - // color: colors.coinblocksCreated, - // datasetPath: `${scale}-to-supply`, - // }, - // { - // title: "Vaulted Supply", - // color: colors.vaultedness, - // datasetPath: `${scale}-to-vaulted-supply`, - // }, - // { - // title: "Active Supply", - // color: colors.liveliness, - // datasetPath: `${scale}-to-active-supply`, - // }, - // ], - // }, - // // TODO: Fix, Bad data - // // { - // // id: 'asymptomatic-supply-regions', - // // name: 'Asymptomatic Supply Regions', - // // title: 'Asymptomatic Supply Regions', - // // description: '', - // // applyPreset(params) { - // // return applyMultipleSeries({ - // // ...params, - // // priceScaleOptions: { - // // halved: true, - // // }, - // // list: [ - // // { - // // id: 'min-vaulted', - // // title: 'Min Vaulted Supply', - // // color: colors.vaultedness, - // // dataset: params.`/${scale}-to-dateToMinVaultedSupply, - // // }, - // // { - // // id: 'max-active', - // // title: 'Max Active Supply', - // // color: colors.liveliness, - // // dataset: params.`/${scale}-to-dateToMaxActiveSupply, - // // }, - // // ], - // // }) - // // }, - // // }, - // { - // scale, - // name: "Vaulted Net Change", - // title: "Vaulted Supply Net Change", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Vaulted Supply Net Change", - // color: colors.vaultedness, - // datasetPath: `${scale}-to-vaulted-supply-net-change`, - // }, - // ], - // }, - // { - // scale, - // name: "Active Net Change", - // title: "Active Supply Net Change", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Active Supply Net Change", - // color: colors.liveliness, - // datasetPath: `${scale}-to-active-supply-net-change`, - // }, - // ], - // }, - // { - // scale, - // name: "Active VS. Vaulted 90D Net Change", - // title: "Active VS. Vaulted 90 Day Supply Net Change", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Active Supply Net Change", - // color: colors.liveliness, - // datasetPath: `${scale}-to-active-supply-3m-net-change`, - // type: "Baseline", - // }, - // { - // title: "Vaulted Supply Net Change", - // color: colors.vaultedPrice, - // type: "Baseline", - // datasetPath: `${scale}-to-vaulted-supply-3m-net-change`, - // }, - // bases[0](scale), - // ], - // }, - // // TODO: Fix, Bad data - // // { - // // id: 'vaulted-supply-annualized-net-change', - // // name: 'Vaulted Annualized Net Change', - // // title: 'Vaulted Supply Annualized Net Change', - // // description: '', - // // applyPreset(params) { - // // return applyMultipleSeries({ - // // ...params, - // // priceScaleOptions: { - // // halved: true, - // // }, - // // list: [ - // // { - // // id: 'vaulted-annualized-supply-net-change', - // // title: 'Vaulted Supply Annualized Net Change', - // // color: colors.vaultedness, - // // dataset: - // // `/${scale}-to-vaultedAnnualizedSupplyNetChange, - // // }, - // // ], - // // }) - // // }, - // // }, - - // // TODO: Fix, Bad data - // // { - // // id: 'vaulting-rate', - // // name: 'Vaulting Rate', - // // title: 'Vaulting Rate', - // // description: '', - // // applyPreset(params) { - // // return applyMultipleSeries({ - // // ...params, - // // priceScaleOptions: { - // // halved: true, - // // }, - // // list: [ - // // { - // // id: 'vaulting-rate', - // // title: 'Vaulting Rate', - // // color: colors.vaultedness, - // // dataset: `${scale}-to-vaultingRate, - // // }, - // // { - // // id: 'nominal-inflation-rate', - // // title: 'Nominal Inflation Rate', - // // color: colors.orange, - // // dataset: params.`/${scale}-to-dateToYearlyInflationRate, - // // }, - // // ], - // // }) - // // }, - // // }, - - // // TODO: Fix, Bad data - // // { - // // id: 'active-supply-net-change-decomposition', - // // name: 'Active Supply Net Change Decomposition (90D)', - // // title: 'Active Supply Net 90 Day Change Decomposition', - // // description: '', - // // applyPreset(params) { - // // return applyMultipleSeries({ - // // ...params, - // // priceScaleOptions: { - // // halved: true, - // // }, - // // list: [ - // // { - // // id: 'issuance-change', - // // title: 'Change From Issuance', - // // color: colors.emerald, - // // dataset: - // // params.params.datasets[scale] - // // [scale].activeSupplyChangeFromIssuance90dChange, - // // }, - // // { - // // id: 'transactions-change', - // // title: 'Change From Transactions', - // // color: colors.rose, - // // dataset: - // // params.params.datasets[scale] - // // [scale].activeSupplyChangeFromTransactions90dChange, - // // }, - // // // { - // // // id: 'active', - // // // title: 'Active Supply', - // // // color: colors.liveliness, - // // // dataset: `${scale}-to-activeSupply, - // // // }, - // // ], - // // }) - // // }, - // // }, - - // { - // scale, - // name: "In Profit", - // title: "Cointime Supply In Profit", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Circulating Supply", - // color: colors.coinblocksCreated, - // datasetPath: `${scale}-to-supply`, - // }, - // { - // title: "Vaulted Supply", - // color: colors.vaultedness, - // datasetPath: `${scale}-to-vaulted-supply`, - // }, - // { - // title: "Supply in profit", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-supply-in-profit`, - // }, - // ], - // }, - // { - // scale, - // name: "In Loss", - // title: "Cointime Supply In Loss", - // description: "", - // unit: "Bitcoin", - // bottom: [ - // { - // title: "Circulating Supply", - // color: colors.coinblocksCreated, - // datasetPath: `${scale}-to-supply`, - // }, - // { - // title: "Active Supply", - // color: colors.liveliness, - // datasetPath: `${scale}-to-active-supply`, - // }, - // { - // title: "Supply in Loss", - // color: colors.bitcoin, - // datasetPath: `${scale}-to-supply-in-loss`, - // }, - // ], - // }, - // ], - // }, - // ...(scale === "date" - // ? /** @satisfies {PartialOptionsTree} */ ([ - // { - // name: "Inflation Rate", - // tree: [ - // { - // scale, - // name: "Normal", - // title: "Cointime Yearly Inflation Rate", - // description: "", - // unit: "Percentage", - // bottom: [ - // { - // title: "Cointime Adjusted", - // color: colors.coinblocksCreated, - // datasetPath: `date-to-cointime-adjusted-inflation-rate`, - // }, - // { - // title: "Nominal", - // color: colors.bitcoin, - // datasetPath: `date-to-inflation-rate`, - // }, - // ], - // }, - // { - // scale, - // name: "Yearly", - // title: "Cointime-Adjusted Yearly Inflation Rate", - // description: "", - // unit: "Percentage", - // bottom: [ - // { - // title: "Cointime Adjusted", - // color: colors.coinblocksCreated, - // datasetPath: `date-to-cointime-adjusted-yearly-inflation-rate`, - // }, - // { - // title: "Nominal", - // color: colors.bitcoin, - // datasetPath: `date-to-yearly-inflation-rate`, - // }, - // ], - // }, - // ], - // }, - - // { - // scale, - // name: "Cointime Velocity", - // title: "Cointime-Adjusted Transactions Velocity", - // description: "", - // unit: "", - // bottom: [ - // { - // title: "Cointime Adjusted", - // color: colors.coinblocksCreated, - // datasetPath: `date-to-cointime-adjusted-velocity`, - // }, - // { - // title: "Nominal", - // color: colors.bitcoin, - // datasetPath: `date-to-transaction-velocity`, - // }, - // ], - // }, - // ]) - // : []), - // ], - // }; - // } - - // /** - // * @param {TimeScale} scale - // * @returns {PartialOptionsGroup} - // */ - // function createResearchOptions(scale) { - // return { - // name: "Research", - // tree: [createCointimeOptions(scale)], - // }; - // } - return [ { name: "Charts", tree: [ - // name: "Market", - // tree: [ { - name: "Price", + name: "btc/usd", title: "Bitcoin Price in US Dollars", }, + { + name: "usd/sats", + title: "Satoshis Per US Dollar", + unit: "Satoshis", + bottom: [ + { + key: "sats-per-dollar", + title: "Satoshis", + color: colors.bitcoin, + }, + ], + }, { name: "Blocks", tree: [ @@ -4991,58 +737,6 @@ function createPartialOptions(colors) { }, ], }, - // { - // scale, - // name: "Satoshis Per Dollar", - // title: "Satoshis Per Dollar", - // description: "", - // unit: "Satoshis", - // bottom: [ - // { - // title: "Satoshis", - // datasetPath: `${scale}-to-sats-per-dollar`, - // color: colors.bitcoin, - // }, - // ], - // }, - // { - // name: "By Date", - // tree: [ - // createMarketOptions("date"), - // // createBlocksOptions("date"), - // // createMinersOptions("date"), - // // createTransactionsOptions("date"), - // // ...createCohortOptions({ - // // scale: "date", - // // color: colors.bitcoin, - // // datasetId: "", - // // name: "", - // // title: "", - // // }), - // // createHodlersOptions("date"), - // // createAddressesOptions("date"), - // // createResearchOptions("date"), - // ], - // }, - // { - // name: "By Height", - // tree: [ - // createMarketOptions("height"), - // // createBlocksOptions("height"), - // // createMinersOptions("height"), - // // createTransactionsOptions("height"), - // // ...createCohortOptions({ - // // scale: "height", - // // color: colors.bitcoin, - // // datasetId: "", - // // name: "", - // // title: "", - // // }), - // // createHodlersOptions("height"), - // // createAddressesOptions("height"), - // // createResearchOptions("height"), - // ], - // }, ], }, { @@ -5158,68 +852,6 @@ export function initOptions({ /** @type {string[] | undefined} */ const optionsIds = env.localhost ? [] : undefined; - // /** - // * @param {AnySeriesBlueprint[]} array - // */ - // function getMainIdFromBlueprints(array) { - // const searchArray = array.filter( - // (blueprint) => - // blueprint.options?.lastValueVisible !== false && - // /** @type {LineStyleOptions | undefined} */ (blueprint.options) - // ?.lineStyle === undefined, - // ); - - // const blueprint = - // searchArray.length === 1 - // ? searchArray[0] - // : searchArray.find((blueprint) => blueprint.main); - - // if (!blueprint) return undefined; - - // const id = blueprint.datasetPath - // .replace("date-to-", "") - // .replace("height-to-", ""); - - // return /** @type {LastPath} */ (id); - // } - - /** - * @param {Number | undefined} value - * @param {Unit} unit - */ - function formatValue(value, unit) { - if (!value) return ""; - - const s = - unit !== "Count" - ? utils.locale.numberToShortUSFormat(value) - : utils.locale.numberToUSFormat( - value, - unit === "Count" ? 0 : undefined, - ); - - switch (unit) { - case "US Dollars": { - return `$${s}`; - } - case "Bitcoin": { - return `₿${s}`; - } - case "Percentage": { - return `${s}%`; - } - case "Seconds": { - return `${s} sec`; - } - case "Megabytes": { - return `${s} MB`; - } - default: { - return s; - } - } - } - /** * @param {Object} args * @param {Option} args.option @@ -5424,7 +1056,7 @@ export function initOptions({ /** @type {string} */ let title; - if ("kind" in anyPartial) { + if ("kind" in anyPartial && anyPartial.kind === "simulation") { // Simulation kind = anyPartial.kind; id = anyPartial.kind; @@ -5443,6 +1075,8 @@ export function initOptions({ if (key) { if (key.includes("-interval")) { anyPartial.unit = "Seconds"; + } else if (key.startsWith("sats-")) { + anyPartial.unit = "Satoshis"; } else { console.log(anyPartial); throw Error("Unit not set"); @@ -5510,8 +1144,6 @@ export function initOptions({ setDefaultSelectedIfNeeded(); if (env.localhost) { - // TOOD: Check also unit - function checkUniqueIds() { if (!optionsIds) { throw "Should be set"; @@ -5545,3 +1177,40 @@ export function initOptions({ }; } /** @typedef {ReturnType} Options */ + +// /** +// * @param {Number | undefined} value +// * @param {Unit} unit +// */ +// function formatValue(value, unit) { +// if (!value) return ""; + +// const s = +// unit !== "Count" +// ? utils.locale.numberToShortUSFormat(value) +// : utils.locale.numberToUSFormat( +// value, +// unit === "Count" ? 0 : undefined, +// ); + +// switch (unit) { +// case "US Dollars": { +// return `$${s}`; +// } +// case "Bitcoin": { +// return `₿${s}`; +// } +// case "Percentage": { +// return `${s}%`; +// } +// case "Seconds": { +// return `${s} sec`; +// } +// case "Megabytes": { +// return `${s} MB`; +// } +// default: { +// return s; +// } +// } +// } diff --git a/websites/kibo.money/scripts/types/self.d.ts b/websites/kibo.money/scripts/types/self.d.ts deleted file mode 100644 index 51e2bcc3a..000000000 --- a/websites/kibo.money/scripts/types/self.d.ts +++ /dev/null @@ -1,153 +0,0 @@ -import { Accessor } from "../../packages/solid-signals/v0.2.4-treeshaked/types/signals"; -import { - DeepPartial, - BaselineStyleOptions, - CandlestickStyleOptions, - LineStyleOptions, - SeriesOptionsCommon, - Time, - SingleValueData as _SingleValueData, - CandlestickData as _CandlestickData, - BaselineData, -} from "../../packages/lightweight-charts/v5.0.5-treeshaked/types"; -import { AnyPossibleCohortId } from "../options"; - -type Unit = - | "" - | "Bitcoin" - | "Coinblocks" - | "Count" - | "Date" - | "Dollars / (PetaHash / Second)" - | "ExaHash / Second" - | "Height" - | "Gigabytes" - | "Megabytes" - | "Percentage" - | "Ratio" - | "Satoshis" - | "Seconds" - | "Transactions" - | "US Dollars" - | "Virtual Bytes" - | "Weight"; - -interface PartialOption { - name: string; -} - -interface BaseSeriesBlueprint { - title: string; - key: VecId; - defaultActive?: boolean; -} -interface BaselineSeriesBlueprint extends BaseSeriesBlueprint { - type: "Baseline"; - color?: Color; - options?: DeepPartial; - data?: Accessor[]>; -} -interface CandlestickSeriesBlueprint extends BaseSeriesBlueprint { - type: "Candlestick"; - color?: Color; - options?: DeepPartial; - data?: Accessor; -} -interface LineSeriesBlueprint extends BaseSeriesBlueprint { - type?: "Line"; - color: Color; - options?: DeepPartial; - data?: Accessor[]>; -} -type AnySeriesBlueprint = - | BaselineSeriesBlueprint - | CandlestickSeriesBlueprint - | LineSeriesBlueprint; - -interface PartialChartOption extends PartialOption { - title?: string; - unit?: Unit; - top?: AnySeriesBlueprint[]; - bottom?: AnySeriesBlueprint[]; -} - -interface PartialSimulationOption extends PartialOption { - kind: "simulation"; - title: string; - name: string; -} - -interface PartialUrlOption extends PartialOption { - qrcode?: true; - url: () => string; -} - -interface PartialOptionsGroup { - name: string; - tree: PartialOptionsTree; -} - -type AnyPartialOption = - | PartialChartOption - | PartialSimulationOption - | PartialUrlOption; - -type PartialOptionsTree = (AnyPartialOption | PartialOptionsGroup)[]; - -interface ProcessedOptionAddons { - id: string; - path: string[]; - title: string; -} - -type SimulationOption = PartialSimulationOption & ProcessedOptionAddons; - -interface UrlOption extends PartialUrlOption, ProcessedOptionAddons { - kind: "url"; -} - -interface ChartOption - extends Omit, - ProcessedOptionAddons { - kind: "chart"; - unit: Unit; -} - -type Option = UrlOption | ChartOption | SimulationOption; - -type OptionsTree = (Option | OptionsGroup)[]; - -interface OptionsGroup extends PartialOptionsGroup { - id: string; - tree: OptionsTree; -} - -type DefaultCohortOption = CohortOption; - -interface CohortOption { - name: string; - title: string; - datasetId: Id; - color: Color; - filenameAddon?: string; -} - -type DefaultCohortOptions = CohortOptions; - -interface CohortOptions { - name: string; - title: string; - list: CohortOption[]; -} - -interface RatioOption { - color: Color; - // valueDatasetPath: AnyDatasetPath; - // ratioDatasetPath: AnyDatasetPath; - title: string; -} - -interface RatioOptions { - title: string; - list: RatioOption[]; -}