mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-08-12 02:03:09 -07:00
global: part X + 3
This commit is contained in:
@@ -81,15 +81,16 @@ function createMaSubSection(label, averages) {
|
||||
const more = averages.filter((a) => !includes(commonMaIds, a.id));
|
||||
|
||||
/** @param {MaPeriod} a */
|
||||
const toFolder = (a) => ({
|
||||
name: periodIdToName(a.id, true),
|
||||
tree: simplePriceRatioTree({
|
||||
const toChart = (a) => {
|
||||
const name = periodIdToName(a.id, true);
|
||||
const [chart] = simplePriceRatioTree({
|
||||
pattern: a.ratio,
|
||||
title: `${periodIdToName(a.id, true)} ${label}`,
|
||||
title: `${name} ${label}`,
|
||||
legend: "Average",
|
||||
color: a.color,
|
||||
}),
|
||||
});
|
||||
});
|
||||
return { ...chart, name };
|
||||
};
|
||||
|
||||
return {
|
||||
name: label,
|
||||
@@ -106,8 +107,8 @@ function createMaSubSection(label, averages) {
|
||||
}),
|
||||
),
|
||||
},
|
||||
...common.map(toFolder),
|
||||
{ name: "More...", tree: more.map(toFolder) },
|
||||
...common.map(toChart),
|
||||
{ name: "More...", tree: more.map(toChart) },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { brk } from "../../utils/client.js";
|
||||
import { colors } from "../../utils/colors.js";
|
||||
import { Unit } from "../../utils/units.js";
|
||||
import { histogram } from "../series.js";
|
||||
import { histogram, price } from "../series.js";
|
||||
|
||||
/**
|
||||
* Create Capital Sentiment model section.
|
||||
@@ -9,6 +9,30 @@ import { histogram } from "../series.js";
|
||||
*/
|
||||
export function createCapitalSentimentSection() {
|
||||
const { capitalSentiment } = brk.series.models;
|
||||
const { all, sth, lth } = brk.series.cohorts.utxo;
|
||||
const sma = brk.series.market.movingAverage.sma._1y;
|
||||
const references = () => [
|
||||
price({
|
||||
series: all.realized.capitalized.price,
|
||||
name: "All",
|
||||
color: colors.capitalized,
|
||||
}),
|
||||
price({
|
||||
series: sth.realized.capitalized.price,
|
||||
name: "STH",
|
||||
color: colors.term.short,
|
||||
}),
|
||||
price({
|
||||
series: lth.realized.capitalized.price,
|
||||
name: "LTH",
|
||||
color: colors.term.long,
|
||||
}),
|
||||
price({
|
||||
series: sma,
|
||||
name: "1Y SMA",
|
||||
color: colors.time._1y,
|
||||
}),
|
||||
];
|
||||
|
||||
return {
|
||||
name: "Capital Sentiment",
|
||||
@@ -16,6 +40,7 @@ export function createCapitalSentimentSection() {
|
||||
{
|
||||
name: "Score",
|
||||
title: "Capital Sentiment Score",
|
||||
top: references(),
|
||||
bottom: [
|
||||
histogram({
|
||||
series: capitalSentiment.score,
|
||||
@@ -35,6 +60,7 @@ export function createCapitalSentimentSection() {
|
||||
{
|
||||
name: "Position",
|
||||
title: "Capital Sentiment Position",
|
||||
top: references(),
|
||||
bottom: [
|
||||
histogram({
|
||||
series: capitalSentiment.isLong,
|
||||
|
||||
@@ -325,9 +325,9 @@ export function createPartialOptions() {
|
||||
{
|
||||
name: "Models",
|
||||
tree: [
|
||||
createCapitalSentimentSection(),
|
||||
createRarityMeterSection(),
|
||||
createBedrockSection(),
|
||||
createRarityMeterSection(),
|
||||
createCapitalSentimentSection(),
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user