mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 23:29:58 -07:00
website: options: objectify
This commit is contained in:
@@ -124,10 +124,10 @@ function createSingleSupplySeriesBase(ctx, cohort) {
|
||||
const { tree } = cohort;
|
||||
|
||||
return [
|
||||
...satsBtcUsd(tree.supply.total, "Supply", colors.default),
|
||||
...satsBtcUsd(tree.unrealized.supplyInProfit, "In Profit", colors.green),
|
||||
...satsBtcUsd(tree.unrealized.supplyInLoss, "In Loss", colors.red),
|
||||
...satsBtcUsd(tree.supply.halved, "half", colors.gray).map((s) => ({
|
||||
...satsBtcUsd({ pattern: tree.supply.total, name: "Supply", color: colors.default }),
|
||||
...satsBtcUsd({ pattern: tree.unrealized.supplyInProfit, name: "In Profit", color: colors.green }),
|
||||
...satsBtcUsd({ pattern: tree.unrealized.supplyInLoss, name: "In Loss", color: colors.red }),
|
||||
...satsBtcUsd({ pattern: tree.supply.halved, name: "half", color: colors.gray }).map((s) => ({
|
||||
...s,
|
||||
options: { lineStyle: 4 },
|
||||
})),
|
||||
@@ -206,7 +206,7 @@ export function createSingleSupplySeriesWithoutRelative(ctx, cohort) {
|
||||
*/
|
||||
export function createGroupedSupplyTotalSeries(list, { relativeMetrics } = {}) {
|
||||
return list.flatMap((cohort) => [
|
||||
...satsBtcUsd(cohort.tree.supply.total, cohort.name, cohort.color),
|
||||
...satsBtcUsd({ pattern: cohort.tree.supply.total, name: cohort.name, color: cohort.color }),
|
||||
...(relativeMetrics ? relativeMetrics(cohort) : []),
|
||||
]);
|
||||
}
|
||||
@@ -221,7 +221,7 @@ export function createGroupedSupplyTotalSeries(list, { relativeMetrics } = {}) {
|
||||
*/
|
||||
export function createGroupedSupplyInProfitSeries(list, { relativeMetrics } = {}) {
|
||||
return list.flatMap((cohort) => [
|
||||
...satsBtcUsd(cohort.tree.unrealized.supplyInProfit, cohort.name, cohort.color),
|
||||
...satsBtcUsd({ pattern: cohort.tree.unrealized.supplyInProfit, name: cohort.name, color: cohort.color }),
|
||||
...(relativeMetrics ? relativeMetrics(cohort) : []),
|
||||
]);
|
||||
}
|
||||
@@ -236,7 +236,7 @@ export function createGroupedSupplyInProfitSeries(list, { relativeMetrics } = {}
|
||||
*/
|
||||
export function createGroupedSupplyInLossSeries(list, { relativeMetrics } = {}) {
|
||||
return list.flatMap((cohort) => [
|
||||
...satsBtcUsd(cohort.tree.unrealized.supplyInLoss, cohort.name, cohort.color),
|
||||
...satsBtcUsd({ pattern: cohort.tree.unrealized.supplyInLoss, name: cohort.name, color: cohort.color }),
|
||||
...(relativeMetrics ? relativeMetrics(cohort) : []),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -947,26 +947,25 @@ function createSingleRealizedPnlSection(
|
||||
name: "P&L",
|
||||
title: title("Realized P&L"),
|
||||
bottom: [
|
||||
...fromCountPattern(
|
||||
tree.realized.realizedProfit,
|
||||
Unit.usd,
|
||||
"Profit",
|
||||
colors.green,
|
||||
),
|
||||
...fromCountPattern(
|
||||
tree.realized.realizedLoss,
|
||||
Unit.usd,
|
||||
"Loss",
|
||||
colors.red,
|
||||
),
|
||||
...fromBitcoinPatternWithUnit(
|
||||
tree.realized.negRealizedLoss,
|
||||
Unit.usd,
|
||||
"Negative Loss",
|
||||
colors.red,
|
||||
undefined,
|
||||
false,
|
||||
),
|
||||
...fromCountPattern({
|
||||
pattern: tree.realized.realizedProfit,
|
||||
unit: Unit.usd,
|
||||
title: "Profit",
|
||||
sumColor: colors.green,
|
||||
}),
|
||||
...fromCountPattern({
|
||||
pattern: tree.realized.realizedLoss,
|
||||
unit: Unit.usd,
|
||||
title: "Loss",
|
||||
sumColor: colors.red,
|
||||
}),
|
||||
...fromBitcoinPatternWithUnit({
|
||||
pattern: tree.realized.negRealizedLoss,
|
||||
unit: Unit.usd,
|
||||
title: "Negative Loss",
|
||||
sumColor: colors.red,
|
||||
defaultActive: false,
|
||||
}),
|
||||
...extra,
|
||||
line({
|
||||
metric: tree.realized.totalRealizedPnl,
|
||||
@@ -1009,11 +1008,11 @@ function createSingleRealizedPnlSection(
|
||||
name: "Net P&L",
|
||||
title: title("Net Realized P&L"),
|
||||
bottom: [
|
||||
...fromCountPattern(
|
||||
tree.realized.netRealizedPnl,
|
||||
Unit.usd,
|
||||
"Net",
|
||||
),
|
||||
...fromCountPattern({
|
||||
pattern: tree.realized.netRealizedPnl,
|
||||
unit: Unit.usd,
|
||||
title: "Net",
|
||||
}),
|
||||
baseline({
|
||||
metric: tree.realized.netRealizedPnlCumulative30dDelta,
|
||||
name: "Cumulative 30d Change",
|
||||
@@ -2618,24 +2617,21 @@ function createActivitySection({ ctx, cohort, title, valueMetrics = [] }) {
|
||||
name: "Sent",
|
||||
title: title("Sent"),
|
||||
bottom: [
|
||||
...fromCountPattern(
|
||||
tree.activity.sent.sats,
|
||||
Unit.sats,
|
||||
undefined,
|
||||
color,
|
||||
),
|
||||
...fromBitcoinPatternWithUnit(
|
||||
tree.activity.sent.bitcoin,
|
||||
Unit.btc,
|
||||
undefined,
|
||||
color,
|
||||
),
|
||||
...fromCountPattern(
|
||||
tree.activity.sent.dollars,
|
||||
Unit.usd,
|
||||
undefined,
|
||||
color,
|
||||
),
|
||||
...fromCountPattern({
|
||||
pattern: tree.activity.sent.sats,
|
||||
unit: Unit.sats,
|
||||
sumColor: color,
|
||||
}),
|
||||
...fromBitcoinPatternWithUnit({
|
||||
pattern: tree.activity.sent.bitcoin,
|
||||
unit: Unit.btc,
|
||||
sumColor: color,
|
||||
}),
|
||||
...fromCountPattern({
|
||||
pattern: tree.activity.sent.dollars,
|
||||
unit: Unit.usd,
|
||||
sumColor: color,
|
||||
}),
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user