global: snapshot

This commit is contained in:
nym21
2026-01-02 19:23:20 +01:00
parent 3e9b1cc2b2
commit c33444a92e
14 changed files with 557 additions and 557 deletions
Generated
+9 -8
View File
@@ -1405,9 +1405,9 @@ checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3"
[[package]]
name = "byteview"
version = "0.9.1"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d6e3a2110d267b9881afe689e6eebcc7635534a827928bd69bef59a8f9db644a"
checksum = "dda4398f387cc6395a3e93b3867cd9abda914c97a0b344d1eefb2e5c51785fca"
[[package]]
name = "castaway"
@@ -2154,8 +2154,9 @@ checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99"
[[package]]
name = "fjall"
version = "3.0.0-rc.9"
source = "git+https://github.com/fjall-rs/fjall#ef220cd8502ff1f41bf00f7a01162040148b57fb"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4986f550347ed1666561f36e8bf1be3c97df72850ecef0140129da6e2d0aa911"
dependencies = [
"byteorder-lite",
"byteview",
@@ -3034,9 +3035,9 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"
[[package]]
name = "lsm-tree"
version = "3.0.0-rc.9"
version = "3.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "27b24b4f8669054ca480aeedf97c19157f94736a1bf87ab688aaea66e8f2d54d"
checksum = "3a206e87e8bc38114045060ec1fc6bc4e4559748a37e9622b910d80e48863e87"
dependencies = [
"byteorder-lite",
"byteview",
@@ -4772,9 +4773,9 @@ dependencies = [
[[package]]
name = "sfa"
version = "0.1.0"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86cc3fab8d5eb0e19832083e29d69607305b01ae6a16d5790b3e5374c5da3d91"
checksum = "a1296838937cab56cd6c4eeeb8718ec777383700c33f060e2869867bd01d1175"
dependencies = [
"byteorder-lite",
"log",
+2 -3
View File
@@ -63,12 +63,11 @@ brk_store = { version = "0.1.0-alpha.1", path = "crates/brk_store" }
brk_types = { version = "0.1.0-alpha.1", path = "crates/brk_types" }
brk_traversable = { version = "0.1.0-alpha.1", path = "crates/brk_traversable", features = ["pco", "derive"] }
brk_traversable_derive = { version = "0.1.0-alpha.1", path = "crates/brk_traversable_derive" }
byteview = "0.9.1"
byteview = "0.10.0"
color-eyre = "0.6.5"
derive_deref = "1.1.1"
env_logger = "0.11.8"
# fjall = "3.0.0-rc.6"
fjall = { git = "https://github.com/fjall-rs/fjall" }
fjall = "3.0.0"
jiff = "0.2.17"
log = "0.4.29"
minreq = { version = "2.14.1", features = ["https", "serde_json"] }
+177 -177
View File
@@ -3826,32 +3826,32 @@ impl RelativePattern {
/// Pattern struct for repeated tree structure.
pub struct BlockSizePattern<T> {
pub average: MetricPattern1<T>,
pub average: MetricPattern2<T>,
pub cumulative: MetricPattern1<T>,
pub max: MetricPattern1<T>,
pub median: MetricPattern25<T>,
pub min: MetricPattern1<T>,
pub pct10: MetricPattern25<T>,
pub pct25: MetricPattern25<T>,
pub pct75: MetricPattern25<T>,
pub pct90: MetricPattern25<T>,
pub sum: MetricPattern1<T>,
pub max: MetricPattern2<T>,
pub median: MetricPattern21<T>,
pub min: MetricPattern2<T>,
pub pct10: MetricPattern21<T>,
pub pct25: MetricPattern21<T>,
pub pct75: MetricPattern21<T>,
pub pct90: MetricPattern21<T>,
pub sum: MetricPattern2<T>,
}
impl<T: DeserializeOwned> BlockSizePattern<T> {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
average: MetricPattern1::new(client.clone(), _m(&acc, "avg")),
average: MetricPattern2::new(client.clone(), _m(&acc, "avg")),
cumulative: MetricPattern1::new(client.clone(), _m(&acc, "cumulative")),
max: MetricPattern1::new(client.clone(), _m(&acc, "max")),
median: MetricPattern25::new(client.clone(), _m(&acc, "median")),
min: MetricPattern1::new(client.clone(), _m(&acc, "min")),
pct10: MetricPattern25::new(client.clone(), _m(&acc, "pct10")),
pct25: MetricPattern25::new(client.clone(), _m(&acc, "pct25")),
pct75: MetricPattern25::new(client.clone(), _m(&acc, "pct75")),
pct90: MetricPattern25::new(client.clone(), _m(&acc, "pct90")),
sum: MetricPattern1::new(client.clone(), _m(&acc, "sum")),
max: MetricPattern2::new(client.clone(), _m(&acc, "max")),
median: MetricPattern21::new(client.clone(), _m(&acc, "median")),
min: MetricPattern2::new(client.clone(), _m(&acc, "min")),
pct10: MetricPattern21::new(client.clone(), _m(&acc, "pct10")),
pct25: MetricPattern21::new(client.clone(), _m(&acc, "pct25")),
pct75: MetricPattern21::new(client.clone(), _m(&acc, "pct75")),
pct90: MetricPattern21::new(client.clone(), _m(&acc, "pct90")),
sum: MetricPattern2::new(client.clone(), _m(&acc, "sum")),
}
}
}
@@ -3886,58 +3886,30 @@ impl UnrealizedPattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct Constant0Pattern<T> {
pub dateindex: MetricPattern21<T>,
pub decadeindex: MetricPattern22<T>,
pub height: MetricPattern25<T>,
pub monthindex: MetricPattern27<T>,
pub quarterindex: MetricPattern39<T>,
pub semesterindex: MetricPattern40<T>,
pub weekindex: MetricPattern43<T>,
pub yearindex: MetricPattern44<T>,
}
impl<T: DeserializeOwned> Constant0Pattern<T> {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
dateindex: MetricPattern21::new(client.clone(), acc.clone()),
decadeindex: MetricPattern22::new(client.clone(), acc.clone()),
height: MetricPattern25::new(client.clone(), acc.clone()),
monthindex: MetricPattern27::new(client.clone(), acc.clone()),
quarterindex: MetricPattern39::new(client.clone(), acc.clone()),
semesterindex: MetricPattern40::new(client.clone(), acc.clone()),
weekindex: MetricPattern43::new(client.clone(), acc.clone()),
yearindex: MetricPattern44::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct AddresstypeToHeightToAddrCountPattern<T> {
pub p2a: MetricPattern25<T>,
pub p2pk33: MetricPattern25<T>,
pub p2pk65: MetricPattern25<T>,
pub p2pkh: MetricPattern25<T>,
pub p2sh: MetricPattern25<T>,
pub p2tr: MetricPattern25<T>,
pub p2wpkh: MetricPattern25<T>,
pub p2wsh: MetricPattern25<T>,
pub p2a: MetricPattern30<T>,
pub p2pk33: MetricPattern32<T>,
pub p2pk65: MetricPattern33<T>,
pub p2pkh: MetricPattern34<T>,
pub p2sh: MetricPattern35<T>,
pub p2tr: MetricPattern36<T>,
pub p2wpkh: MetricPattern37<T>,
pub p2wsh: MetricPattern38<T>,
}
impl<T: DeserializeOwned> AddresstypeToHeightToAddrCountPattern<T> {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
p2a: MetricPattern25::new(client.clone(), if acc.is_empty() { "p2a".to_string() } else { format!("p2a_{acc}") }),
p2pk33: MetricPattern25::new(client.clone(), if acc.is_empty() { "p2pk33".to_string() } else { format!("p2pk33_{acc}") }),
p2pk65: MetricPattern25::new(client.clone(), if acc.is_empty() { "p2pk65".to_string() } else { format!("p2pk65_{acc}") }),
p2pkh: MetricPattern25::new(client.clone(), if acc.is_empty() { "p2pkh".to_string() } else { format!("p2pkh_{acc}") }),
p2sh: MetricPattern25::new(client.clone(), if acc.is_empty() { "p2sh".to_string() } else { format!("p2sh_{acc}") }),
p2tr: MetricPattern25::new(client.clone(), if acc.is_empty() { "p2tr".to_string() } else { format!("p2tr_{acc}") }),
p2wpkh: MetricPattern25::new(client.clone(), if acc.is_empty() { "p2wpkh".to_string() } else { format!("p2wpkh_{acc}") }),
p2wsh: MetricPattern25::new(client.clone(), if acc.is_empty() { "p2wsh".to_string() } else { format!("p2wsh_{acc}") }),
p2a: MetricPattern30::new(client.clone(), if acc.is_empty() { "p2a".to_string() } else { format!("p2a_{acc}") }),
p2pk33: MetricPattern32::new(client.clone(), if acc.is_empty() { "p2pk33".to_string() } else { format!("p2pk33_{acc}") }),
p2pk65: MetricPattern33::new(client.clone(), if acc.is_empty() { "p2pk65".to_string() } else { format!("p2pk65_{acc}") }),
p2pkh: MetricPattern34::new(client.clone(), if acc.is_empty() { "p2pkh".to_string() } else { format!("p2pkh_{acc}") }),
p2sh: MetricPattern35::new(client.clone(), if acc.is_empty() { "p2sh".to_string() } else { format!("p2sh_{acc}") }),
p2tr: MetricPattern36::new(client.clone(), if acc.is_empty() { "p2tr".to_string() } else { format!("p2tr_{acc}") }),
p2wpkh: MetricPattern37::new(client.clone(), if acc.is_empty() { "p2wpkh".to_string() } else { format!("p2wpkh_{acc}") }),
p2wsh: MetricPattern38::new(client.clone(), if acc.is_empty() { "p2wsh".to_string() } else { format!("p2wsh_{acc}") }),
}
}
}
@@ -3970,6 +3942,34 @@ impl<T: DeserializeOwned> BlockIntervalPattern<T> {
}
}
/// Pattern struct for repeated tree structure.
pub struct Constant0Pattern<T> {
pub dateindex: MetricPattern21<T>,
pub decadeindex: MetricPattern22<T>,
pub height: MetricPattern25<T>,
pub monthindex: MetricPattern27<T>,
pub quarterindex: MetricPattern39<T>,
pub semesterindex: MetricPattern40<T>,
pub weekindex: MetricPattern43<T>,
pub yearindex: MetricPattern44<T>,
}
impl<T: DeserializeOwned> Constant0Pattern<T> {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
dateindex: MetricPattern21::new(client.clone(), acc.clone()),
decadeindex: MetricPattern22::new(client.clone(), acc.clone()),
height: MetricPattern25::new(client.clone(), acc.clone()),
monthindex: MetricPattern27::new(client.clone(), acc.clone()),
quarterindex: MetricPattern39::new(client.clone(), acc.clone()),
semesterindex: MetricPattern40::new(client.clone(), acc.clone()),
weekindex: MetricPattern43::new(client.clone(), acc.clone()),
yearindex: MetricPattern44::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct _0satsPattern {
pub activity: ActivityPattern2,
@@ -3996,6 +3996,30 @@ impl _0satsPattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct UpTo1dPattern {
pub activity: ActivityPattern2,
pub cost_basis: CostBasisPattern2,
pub realized: RealizedPattern3,
pub relative: RelativePattern2,
pub supply: SupplyPattern3,
pub unrealized: UnrealizedPattern,
}
impl UpTo1dPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
activity: ActivityPattern2::new(client.clone(), acc.clone()),
cost_basis: CostBasisPattern2::new(client.clone(), acc.clone()),
realized: RealizedPattern3::new(client.clone(), acc.clone()),
relative: RelativePattern2::new(client.clone(), acc.clone()),
supply: SupplyPattern3::new(client.clone(), acc.clone()),
unrealized: UnrealizedPattern::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct _0satsPattern2 {
pub activity: ActivityPattern2,
@@ -4044,30 +4068,6 @@ impl _10yTo12yPattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct UpTo1dPattern {
pub activity: ActivityPattern2,
pub cost_basis: CostBasisPattern2,
pub realized: RealizedPattern3,
pub relative: RelativePattern2,
pub supply: SupplyPattern3,
pub unrealized: UnrealizedPattern,
}
impl UpTo1dPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
activity: ActivityPattern2::new(client.clone(), acc.clone()),
cost_basis: CostBasisPattern2::new(client.clone(), acc.clone()),
realized: RealizedPattern3::new(client.clone(), acc.clone()),
relative: RelativePattern2::new(client.clone(), acc.clone()),
supply: SupplyPattern3::new(client.clone(), acc.clone()),
unrealized: UnrealizedPattern::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct SegwitAdoptionPattern<T> {
pub average: MetricPattern2<T>,
@@ -4156,26 +4156,6 @@ impl SentPattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct OpreturnPattern {
pub base: MetricPattern25<Sats>,
pub bitcoin: BitcoinPattern2<Bitcoin>,
pub dollars: BitcoinPattern2<Dollars>,
pub sats: SatsPattern4,
}
impl OpreturnPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
base: MetricPattern25::new(client.clone(), acc.clone()),
bitcoin: BitcoinPattern2::new(client.clone(), _m(&acc, "btc")),
dollars: BitcoinPattern2::new(client.clone(), _m(&acc, "usd")),
sats: SatsPattern4::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct SupplyPattern2 {
pub base: MetricPattern25<Sats>,
@@ -4197,19 +4177,21 @@ impl SupplyPattern2 {
}
/// Pattern struct for repeated tree structure.
pub struct UnclaimedRewardsPattern {
pub bitcoin: BlockCountPattern<Bitcoin>,
pub dollars: BlockCountPattern<Dollars>,
pub sats: BlockCountPattern<Sats>,
pub struct OpreturnPattern {
pub base: MetricPattern25<Sats>,
pub bitcoin: BitcoinPattern2<Bitcoin>,
pub dollars: BitcoinPattern2<Dollars>,
pub sats: SatsPattern4,
}
impl UnclaimedRewardsPattern {
impl OpreturnPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
bitcoin: BlockCountPattern::new(client.clone(), _m(&acc, "btc")),
dollars: BlockCountPattern::new(client.clone(), _m(&acc, "usd")),
sats: BlockCountPattern::new(client.clone(), acc.clone()),
base: MetricPattern25::new(client.clone(), acc.clone()),
bitcoin: BitcoinPattern2::new(client.clone(), _m(&acc, "btc")),
dollars: BitcoinPattern2::new(client.clone(), _m(&acc, "usd")),
sats: SatsPattern4::new(client.clone(), acc.clone()),
}
}
}
@@ -4232,24 +4214,6 @@ impl CoinbasePattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct ActiveSupplyPattern {
pub bitcoin: MetricPattern1<Bitcoin>,
pub dollars: MetricPattern1<Dollars>,
pub sats: MetricPattern1<Sats>,
}
impl ActiveSupplyPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
bitcoin: MetricPattern1::new(client.clone(), _m(&acc, "btc")),
dollars: MetricPattern1::new(client.clone(), _m(&acc, "usd")),
sats: MetricPattern1::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct CostBasisPattern2 {
pub max_cost_basis: MetricPattern1<Dollars>,
@@ -4269,19 +4233,37 @@ impl CostBasisPattern2 {
}
/// Pattern struct for repeated tree structure.
pub struct BlockCountPattern<T> {
pub base: MetricPattern25<T>,
pub cumulative: MetricPattern1<T>,
pub sum: MetricPattern2<T>,
pub struct UnclaimedRewardsPattern {
pub bitcoin: BlockCountPattern<Bitcoin>,
pub dollars: BlockCountPattern<Dollars>,
pub sats: BlockCountPattern<Sats>,
}
impl<T: DeserializeOwned> BlockCountPattern<T> {
impl UnclaimedRewardsPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
base: MetricPattern25::new(client.clone(), acc.clone()),
cumulative: MetricPattern1::new(client.clone(), _m(&acc, "cumulative")),
sum: MetricPattern2::new(client.clone(), _m(&acc, "sum")),
bitcoin: BlockCountPattern::new(client.clone(), _m(&acc, "btc")),
dollars: BlockCountPattern::new(client.clone(), _m(&acc, "usd")),
sats: BlockCountPattern::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct ActiveSupplyPattern {
pub bitcoin: MetricPattern1<Bitcoin>,
pub dollars: MetricPattern1<Dollars>,
pub sats: MetricPattern1<Sats>,
}
impl ActiveSupplyPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
bitcoin: MetricPattern1::new(client.clone(), _m(&acc, "btc")),
dollars: MetricPattern1::new(client.clone(), _m(&acc, "usd")),
sats: MetricPattern1::new(client.clone(), acc.clone()),
}
}
}
@@ -4305,49 +4287,19 @@ impl<T: DeserializeOwned> BitcoinPattern2<T> {
}
/// Pattern struct for repeated tree structure.
pub struct SatsPattern4 {
pub cumulative: MetricPattern1<Sats>,
pub last: MetricPattern2<Sats>,
pub struct BlockCountPattern<T> {
pub base: MetricPattern25<T>,
pub cumulative: MetricPattern1<T>,
pub sum: MetricPattern2<T>,
}
impl SatsPattern4 {
impl<T: DeserializeOwned> BlockCountPattern<T> {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
base: MetricPattern25::new(client.clone(), acc.clone()),
cumulative: MetricPattern1::new(client.clone(), _m(&acc, "cumulative")),
last: MetricPattern2::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct CostBasisPattern {
pub max_cost_basis: MetricPattern1<Dollars>,
pub min_cost_basis: MetricPattern1<Dollars>,
}
impl CostBasisPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
max_cost_basis: MetricPattern1::new(client.clone(), _m(&acc, "max_cost_basis")),
min_cost_basis: MetricPattern1::new(client.clone(), _m(&acc, "min_cost_basis")),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct SatsPattern {
pub cumulative: MetricPattern1<Sats>,
pub sum: MetricPattern2<Sats>,
}
impl SatsPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
cumulative: MetricPattern1::new(client.clone(), _m(&acc, "cumulative")),
sum: MetricPattern2::new(client.clone(), acc.clone()),
sum: MetricPattern2::new(client.clone(), _m(&acc, "sum")),
}
}
}
@@ -4368,6 +4320,38 @@ impl _1dReturns1mSdPattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct SatsPattern {
pub cumulative: MetricPattern1<Sats>,
pub sum: MetricPattern2<Sats>,
}
impl SatsPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
cumulative: MetricPattern1::new(client.clone(), _m(&acc, "cumulative")),
sum: MetricPattern2::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct CostBasisPattern {
pub max_cost_basis: MetricPattern1<Dollars>,
pub min_cost_basis: MetricPattern1<Dollars>,
}
impl CostBasisPattern {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
max_cost_basis: MetricPattern1::new(client.clone(), _m(&acc, "max_cost_basis")),
min_cost_basis: MetricPattern1::new(client.clone(), _m(&acc, "min_cost_basis")),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct SupplyValuePattern {
pub bitcoin: MetricPattern25<Bitcoin>,
@@ -4384,6 +4368,22 @@ impl SupplyValuePattern {
}
}
/// Pattern struct for repeated tree structure.
pub struct SatsPattern4 {
pub cumulative: MetricPattern1<Sats>,
pub last: MetricPattern2<Sats>,
}
impl SatsPattern4 {
/// Create a new pattern node with accumulated metric name.
pub fn new(client: Arc<BrkClientBase>, acc: String) -> Self {
Self {
cumulative: MetricPattern1::new(client.clone(), _m(&acc, "cumulative")),
last: MetricPattern2::new(client.clone(), acc.clone()),
}
}
}
/// Pattern struct for repeated tree structure.
pub struct TotalRealizedPnlPattern<T> {
pub base: MetricPattern25<T>,
+205 -205
View File
@@ -2653,16 +2653,16 @@ function createRelativePattern(client, acc) {
/**
* @template T
* @typedef {Object} BlockSizePattern
* @property {MetricPattern1<T>} average
* @property {MetricPattern2<T>} average
* @property {MetricPattern1<T>} cumulative
* @property {MetricPattern1<T>} max
* @property {MetricPattern25<T>} median
* @property {MetricPattern1<T>} min
* @property {MetricPattern25<T>} pct10
* @property {MetricPattern25<T>} pct25
* @property {MetricPattern25<T>} pct75
* @property {MetricPattern25<T>} pct90
* @property {MetricPattern1<T>} sum
* @property {MetricPattern2<T>} max
* @property {MetricPattern21<T>} median
* @property {MetricPattern2<T>} min
* @property {MetricPattern21<T>} pct10
* @property {MetricPattern21<T>} pct25
* @property {MetricPattern21<T>} pct75
* @property {MetricPattern21<T>} pct90
* @property {MetricPattern2<T>} sum
*/
/**
@@ -2674,16 +2674,16 @@ function createRelativePattern(client, acc) {
*/
function createBlockSizePattern(client, acc) {
return {
average: createMetricPattern1(client, _m(acc, 'avg')),
average: createMetricPattern2(client, _m(acc, 'avg')),
cumulative: createMetricPattern1(client, _m(acc, 'cumulative')),
max: createMetricPattern1(client, _m(acc, 'max')),
median: createMetricPattern25(client, _m(acc, 'median')),
min: createMetricPattern1(client, _m(acc, 'min')),
pct10: createMetricPattern25(client, _m(acc, 'pct10')),
pct25: createMetricPattern25(client, _m(acc, 'pct25')),
pct75: createMetricPattern25(client, _m(acc, 'pct75')),
pct90: createMetricPattern25(client, _m(acc, 'pct90')),
sum: createMetricPattern1(client, _m(acc, 'sum')),
max: createMetricPattern2(client, _m(acc, 'max')),
median: createMetricPattern21(client, _m(acc, 'median')),
min: createMetricPattern2(client, _m(acc, 'min')),
pct10: createMetricPattern21(client, _m(acc, 'pct10')),
pct25: createMetricPattern21(client, _m(acc, 'pct25')),
pct75: createMetricPattern21(client, _m(acc, 'pct75')),
pct90: createMetricPattern21(client, _m(acc, 'pct90')),
sum: createMetricPattern2(client, _m(acc, 'sum')),
};
}
@@ -2720,50 +2720,17 @@ function createUnrealizedPattern(client, acc) {
};
}
/**
* @template T
* @typedef {Object} Constant0Pattern
* @property {MetricPattern21<T>} dateindex
* @property {MetricPattern22<T>} decadeindex
* @property {MetricPattern25<T>} height
* @property {MetricPattern27<T>} monthindex
* @property {MetricPattern39<T>} quarterindex
* @property {MetricPattern40<T>} semesterindex
* @property {MetricPattern43<T>} weekindex
* @property {MetricPattern44<T>} yearindex
*/
/**
* Create a Constant0Pattern pattern node
* @template T
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {Constant0Pattern<T>}
*/
function createConstant0Pattern(client, acc) {
return {
dateindex: createMetricPattern21(client, acc),
decadeindex: createMetricPattern22(client, acc),
height: createMetricPattern25(client, acc),
monthindex: createMetricPattern27(client, acc),
quarterindex: createMetricPattern39(client, acc),
semesterindex: createMetricPattern40(client, acc),
weekindex: createMetricPattern43(client, acc),
yearindex: createMetricPattern44(client, acc),
};
}
/**
* @template T
* @typedef {Object} AddresstypeToHeightToAddrCountPattern
* @property {MetricPattern25<T>} p2a
* @property {MetricPattern25<T>} p2pk33
* @property {MetricPattern25<T>} p2pk65
* @property {MetricPattern25<T>} p2pkh
* @property {MetricPattern25<T>} p2sh
* @property {MetricPattern25<T>} p2tr
* @property {MetricPattern25<T>} p2wpkh
* @property {MetricPattern25<T>} p2wsh
* @property {MetricPattern30<T>} p2a
* @property {MetricPattern32<T>} p2pk33
* @property {MetricPattern33<T>} p2pk65
* @property {MetricPattern34<T>} p2pkh
* @property {MetricPattern35<T>} p2sh
* @property {MetricPattern36<T>} p2tr
* @property {MetricPattern37<T>} p2wpkh
* @property {MetricPattern38<T>} p2wsh
*/
/**
@@ -2775,14 +2742,14 @@ function createConstant0Pattern(client, acc) {
*/
function createAddresstypeToHeightToAddrCountPattern(client, acc) {
return {
p2a: createMetricPattern25(client, (acc ? `p2a_${acc}` : 'p2a')),
p2pk33: createMetricPattern25(client, (acc ? `p2pk33_${acc}` : 'p2pk33')),
p2pk65: createMetricPattern25(client, (acc ? `p2pk65_${acc}` : 'p2pk65')),
p2pkh: createMetricPattern25(client, (acc ? `p2pkh_${acc}` : 'p2pkh')),
p2sh: createMetricPattern25(client, (acc ? `p2sh_${acc}` : 'p2sh')),
p2tr: createMetricPattern25(client, (acc ? `p2tr_${acc}` : 'p2tr')),
p2wpkh: createMetricPattern25(client, (acc ? `p2wpkh_${acc}` : 'p2wpkh')),
p2wsh: createMetricPattern25(client, (acc ? `p2wsh_${acc}` : 'p2wsh')),
p2a: createMetricPattern30(client, (acc ? `p2a_${acc}` : 'p2a')),
p2pk33: createMetricPattern32(client, (acc ? `p2pk33_${acc}` : 'p2pk33')),
p2pk65: createMetricPattern33(client, (acc ? `p2pk65_${acc}` : 'p2pk65')),
p2pkh: createMetricPattern34(client, (acc ? `p2pkh_${acc}` : 'p2pkh')),
p2sh: createMetricPattern35(client, (acc ? `p2sh_${acc}` : 'p2sh')),
p2tr: createMetricPattern36(client, (acc ? `p2tr_${acc}` : 'p2tr')),
p2wpkh: createMetricPattern37(client, (acc ? `p2wpkh_${acc}` : 'p2wpkh')),
p2wsh: createMetricPattern38(client, (acc ? `p2wsh_${acc}` : 'p2wsh')),
};
}
@@ -2819,6 +2786,39 @@ function createBlockIntervalPattern(client, acc) {
};
}
/**
* @template T
* @typedef {Object} Constant0Pattern
* @property {MetricPattern21<T>} dateindex
* @property {MetricPattern22<T>} decadeindex
* @property {MetricPattern25<T>} height
* @property {MetricPattern27<T>} monthindex
* @property {MetricPattern39<T>} quarterindex
* @property {MetricPattern40<T>} semesterindex
* @property {MetricPattern43<T>} weekindex
* @property {MetricPattern44<T>} yearindex
*/
/**
* Create a Constant0Pattern pattern node
* @template T
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {Constant0Pattern<T>}
*/
function createConstant0Pattern(client, acc) {
return {
dateindex: createMetricPattern21(client, acc),
decadeindex: createMetricPattern22(client, acc),
height: createMetricPattern25(client, acc),
monthindex: createMetricPattern27(client, acc),
quarterindex: createMetricPattern39(client, acc),
semesterindex: createMetricPattern40(client, acc),
weekindex: createMetricPattern43(client, acc),
yearindex: createMetricPattern44(client, acc),
};
}
/**
* @typedef {Object} _0satsPattern
* @property {ActivityPattern2} activity
@@ -2848,6 +2848,33 @@ function create_0satsPattern(client, acc) {
};
}
/**
* @typedef {Object} UpTo1dPattern
* @property {ActivityPattern2} activity
* @property {CostBasisPattern2} costBasis
* @property {RealizedPattern3} realized
* @property {RelativePattern2} relative
* @property {SupplyPattern3} supply
* @property {UnrealizedPattern} unrealized
*/
/**
* Create a UpTo1dPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {UpTo1dPattern}
*/
function createUpTo1dPattern(client, acc) {
return {
activity: createActivityPattern2(client, acc),
costBasis: createCostBasisPattern2(client, acc),
realized: createRealizedPattern3(client, acc),
relative: createRelativePattern2(client, acc),
supply: createSupplyPattern3(client, acc),
unrealized: createUnrealizedPattern(client, acc),
};
}
/**
* @typedef {Object} _0satsPattern2
* @property {ActivityPattern2} activity
@@ -2902,33 +2929,6 @@ function create_10yTo12yPattern(client, acc) {
};
}
/**
* @typedef {Object} UpTo1dPattern
* @property {ActivityPattern2} activity
* @property {CostBasisPattern2} costBasis
* @property {RealizedPattern3} realized
* @property {RelativePattern2} relative
* @property {SupplyPattern3} supply
* @property {UnrealizedPattern} unrealized
*/
/**
* Create a UpTo1dPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {UpTo1dPattern}
*/
function createUpTo1dPattern(client, acc) {
return {
activity: createActivityPattern2(client, acc),
costBasis: createCostBasisPattern2(client, acc),
realized: createRealizedPattern3(client, acc),
relative: createRelativePattern2(client, acc),
supply: createSupplyPattern3(client, acc),
unrealized: createUnrealizedPattern(client, acc),
};
}
/**
* @template T
* @typedef {Object} SegwitAdoptionPattern
@@ -3031,29 +3031,6 @@ function createSentPattern(client, acc) {
};
}
/**
* @typedef {Object} OpreturnPattern
* @property {MetricPattern25<Sats>} base
* @property {BitcoinPattern2<Bitcoin>} bitcoin
* @property {BitcoinPattern2<Dollars>} dollars
* @property {SatsPattern4} sats
*/
/**
* Create a OpreturnPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {OpreturnPattern}
*/
function createOpreturnPattern(client, acc) {
return {
base: createMetricPattern25(client, acc),
bitcoin: createBitcoinPattern2(client, _m(acc, 'btc')),
dollars: createBitcoinPattern2(client, _m(acc, 'usd')),
sats: createSatsPattern4(client, acc),
};
}
/**
* @typedef {Object} SupplyPattern2
* @property {MetricPattern25<Sats>} base
@@ -3078,23 +3055,25 @@ function createSupplyPattern2(client, acc) {
}
/**
* @typedef {Object} UnclaimedRewardsPattern
* @property {BlockCountPattern<Bitcoin>} bitcoin
* @property {BlockCountPattern<Dollars>} dollars
* @property {BlockCountPattern<Sats>} sats
* @typedef {Object} OpreturnPattern
* @property {MetricPattern25<Sats>} base
* @property {BitcoinPattern2<Bitcoin>} bitcoin
* @property {BitcoinPattern2<Dollars>} dollars
* @property {SatsPattern4} sats
*/
/**
* Create a UnclaimedRewardsPattern pattern node
* Create a OpreturnPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {UnclaimedRewardsPattern}
* @returns {OpreturnPattern}
*/
function createUnclaimedRewardsPattern(client, acc) {
function createOpreturnPattern(client, acc) {
return {
bitcoin: createBlockCountPattern(client, _m(acc, 'btc')),
dollars: createBlockCountPattern(client, _m(acc, 'usd')),
sats: createBlockCountPattern(client, acc),
base: createMetricPattern25(client, acc),
bitcoin: createBitcoinPattern2(client, _m(acc, 'btc')),
dollars: createBitcoinPattern2(client, _m(acc, 'usd')),
sats: createSatsPattern4(client, acc),
};
}
@@ -3119,27 +3098,6 @@ function createCoinbasePattern(client, acc) {
};
}
/**
* @typedef {Object} ActiveSupplyPattern
* @property {MetricPattern1<Bitcoin>} bitcoin
* @property {MetricPattern1<Dollars>} dollars
* @property {MetricPattern1<Sats>} sats
*/
/**
* Create a ActiveSupplyPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {ActiveSupplyPattern}
*/
function createActiveSupplyPattern(client, acc) {
return {
bitcoin: createMetricPattern1(client, _m(acc, 'btc')),
dollars: createMetricPattern1(client, _m(acc, 'usd')),
sats: createMetricPattern1(client, acc),
};
}
/**
* @typedef {Object} CostBasisPattern2
* @property {MetricPattern1<Dollars>} maxCostBasis
@@ -3162,25 +3120,44 @@ function createCostBasisPattern2(client, acc) {
}
/**
* @template T
* @typedef {Object} BlockCountPattern
* @property {MetricPattern25<T>} base
* @property {MetricPattern1<T>} cumulative
* @property {MetricPattern2<T>} sum
* @typedef {Object} UnclaimedRewardsPattern
* @property {BlockCountPattern<Bitcoin>} bitcoin
* @property {BlockCountPattern<Dollars>} dollars
* @property {BlockCountPattern<Sats>} sats
*/
/**
* Create a BlockCountPattern pattern node
* @template T
* Create a UnclaimedRewardsPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {BlockCountPattern<T>}
* @returns {UnclaimedRewardsPattern}
*/
function createBlockCountPattern(client, acc) {
function createUnclaimedRewardsPattern(client, acc) {
return {
base: createMetricPattern25(client, acc),
cumulative: createMetricPattern1(client, _m(acc, 'cumulative')),
sum: createMetricPattern2(client, _m(acc, 'sum')),
bitcoin: createBlockCountPattern(client, _m(acc, 'btc')),
dollars: createBlockCountPattern(client, _m(acc, 'usd')),
sats: createBlockCountPattern(client, acc),
};
}
/**
* @typedef {Object} ActiveSupplyPattern
* @property {MetricPattern1<Bitcoin>} bitcoin
* @property {MetricPattern1<Dollars>} dollars
* @property {MetricPattern1<Sats>} sats
*/
/**
* Create a ActiveSupplyPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {ActiveSupplyPattern}
*/
function createActiveSupplyPattern(client, acc) {
return {
bitcoin: createMetricPattern1(client, _m(acc, 'btc')),
dollars: createMetricPattern1(client, _m(acc, 'usd')),
sats: createMetricPattern1(client, acc),
};
}
@@ -3208,59 +3185,25 @@ function createBitcoinPattern2(client, acc) {
}
/**
* @typedef {Object} SatsPattern4
* @property {MetricPattern1<Sats>} cumulative
* @property {MetricPattern2<Sats>} last
* @template T
* @typedef {Object} BlockCountPattern
* @property {MetricPattern25<T>} base
* @property {MetricPattern1<T>} cumulative
* @property {MetricPattern2<T>} sum
*/
/**
* Create a SatsPattern4 pattern node
* Create a BlockCountPattern pattern node
* @template T
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {SatsPattern4}
* @returns {BlockCountPattern<T>}
*/
function createSatsPattern4(client, acc) {
function createBlockCountPattern(client, acc) {
return {
base: createMetricPattern25(client, acc),
cumulative: createMetricPattern1(client, _m(acc, 'cumulative')),
last: createMetricPattern2(client, acc),
};
}
/**
* @typedef {Object} CostBasisPattern
* @property {MetricPattern1<Dollars>} maxCostBasis
* @property {MetricPattern1<Dollars>} minCostBasis
*/
/**
* Create a CostBasisPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {CostBasisPattern}
*/
function createCostBasisPattern(client, acc) {
return {
maxCostBasis: createMetricPattern1(client, _m(acc, 'max_cost_basis')),
minCostBasis: createMetricPattern1(client, _m(acc, 'min_cost_basis')),
};
}
/**
* @typedef {Object} SatsPattern
* @property {MetricPattern1<Sats>} cumulative
* @property {MetricPattern2<Sats>} sum
*/
/**
* Create a SatsPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {SatsPattern}
*/
function createSatsPattern(client, acc) {
return {
cumulative: createMetricPattern1(client, _m(acc, 'cumulative')),
sum: createMetricPattern2(client, acc),
sum: createMetricPattern2(client, _m(acc, 'sum')),
};
}
@@ -3283,6 +3226,44 @@ function create_1dReturns1mSdPattern(client, acc) {
};
}
/**
* @typedef {Object} SatsPattern
* @property {MetricPattern1<Sats>} cumulative
* @property {MetricPattern2<Sats>} sum
*/
/**
* Create a SatsPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {SatsPattern}
*/
function createSatsPattern(client, acc) {
return {
cumulative: createMetricPattern1(client, _m(acc, 'cumulative')),
sum: createMetricPattern2(client, acc),
};
}
/**
* @typedef {Object} CostBasisPattern
* @property {MetricPattern1<Dollars>} maxCostBasis
* @property {MetricPattern1<Dollars>} minCostBasis
*/
/**
* Create a CostBasisPattern pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {CostBasisPattern}
*/
function createCostBasisPattern(client, acc) {
return {
maxCostBasis: createMetricPattern1(client, _m(acc, 'max_cost_basis')),
minCostBasis: createMetricPattern1(client, _m(acc, 'min_cost_basis')),
};
}
/**
* @typedef {Object} SupplyValuePattern
* @property {MetricPattern25<Bitcoin>} bitcoin
@@ -3302,6 +3283,25 @@ function createSupplyValuePattern(client, acc) {
};
}
/**
* @typedef {Object} SatsPattern4
* @property {MetricPattern1<Sats>} cumulative
* @property {MetricPattern2<Sats>} last
*/
/**
* Create a SatsPattern4 pattern node
* @param {BrkClientBase} client
* @param {string} acc - Accumulated metric name
* @returns {SatsPattern4}
*/
function createSatsPattern4(client, acc) {
return {
cumulative: createMetricPattern1(client, _m(acc, 'cumulative')),
last: createMetricPattern2(client, acc),
};
}
/**
* @template T
* @typedef {Object} TotalRealizedPnlPattern
+89 -89
View File
@@ -2539,16 +2539,16 @@ class BlockSizePattern(Generic[T]):
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.average: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'avg'))
self.average: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'avg'))
self.cumulative: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'cumulative'))
self.max: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'max'))
self.median: MetricPattern25[T] = MetricPattern25(client, _m(acc, 'median'))
self.min: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'min'))
self.pct10: MetricPattern25[T] = MetricPattern25(client, _m(acc, 'pct10'))
self.pct25: MetricPattern25[T] = MetricPattern25(client, _m(acc, 'pct25'))
self.pct75: MetricPattern25[T] = MetricPattern25(client, _m(acc, 'pct75'))
self.pct90: MetricPattern25[T] = MetricPattern25(client, _m(acc, 'pct90'))
self.sum: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'sum'))
self.max: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'max'))
self.median: MetricPattern21[T] = MetricPattern21(client, _m(acc, 'median'))
self.min: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'min'))
self.pct10: MetricPattern21[T] = MetricPattern21(client, _m(acc, 'pct10'))
self.pct25: MetricPattern21[T] = MetricPattern21(client, _m(acc, 'pct25'))
self.pct75: MetricPattern21[T] = MetricPattern21(client, _m(acc, 'pct75'))
self.pct90: MetricPattern21[T] = MetricPattern21(client, _m(acc, 'pct90'))
self.sum: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'sum'))
class UnrealizedPattern:
"""Pattern struct for repeated tree structure."""
@@ -2565,33 +2565,19 @@ class UnrealizedPattern:
self.unrealized_loss: MetricPattern3[Dollars] = MetricPattern3(client, _m(acc, 'unrealized_loss'))
self.unrealized_profit: MetricPattern3[Dollars] = MetricPattern3(client, _m(acc, 'unrealized_profit'))
class Constant0Pattern(Generic[T]):
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.dateindex: MetricPattern21[T] = MetricPattern21(client, acc)
self.decadeindex: MetricPattern22[T] = MetricPattern22(client, acc)
self.height: MetricPattern25[T] = MetricPattern25(client, acc)
self.monthindex: MetricPattern27[T] = MetricPattern27(client, acc)
self.quarterindex: MetricPattern39[T] = MetricPattern39(client, acc)
self.semesterindex: MetricPattern40[T] = MetricPattern40(client, acc)
self.weekindex: MetricPattern43[T] = MetricPattern43(client, acc)
self.yearindex: MetricPattern44[T] = MetricPattern44(client, acc)
class AddresstypeToHeightToAddrCountPattern(Generic[T]):
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.p2a: MetricPattern25[T] = MetricPattern25(client, (f'p2a_{{acc}}' if acc else 'p2a'))
self.p2pk33: MetricPattern25[T] = MetricPattern25(client, (f'p2pk33_{{acc}}' if acc else 'p2pk33'))
self.p2pk65: MetricPattern25[T] = MetricPattern25(client, (f'p2pk65_{{acc}}' if acc else 'p2pk65'))
self.p2pkh: MetricPattern25[T] = MetricPattern25(client, (f'p2pkh_{{acc}}' if acc else 'p2pkh'))
self.p2sh: MetricPattern25[T] = MetricPattern25(client, (f'p2sh_{{acc}}' if acc else 'p2sh'))
self.p2tr: MetricPattern25[T] = MetricPattern25(client, (f'p2tr_{{acc}}' if acc else 'p2tr'))
self.p2wpkh: MetricPattern25[T] = MetricPattern25(client, (f'p2wpkh_{{acc}}' if acc else 'p2wpkh'))
self.p2wsh: MetricPattern25[T] = MetricPattern25(client, (f'p2wsh_{{acc}}' if acc else 'p2wsh'))
self.p2a: MetricPattern30[T] = MetricPattern30(client, (f'p2a_{{acc}}' if acc else 'p2a'))
self.p2pk33: MetricPattern32[T] = MetricPattern32(client, (f'p2pk33_{{acc}}' if acc else 'p2pk33'))
self.p2pk65: MetricPattern33[T] = MetricPattern33(client, (f'p2pk65_{{acc}}' if acc else 'p2pk65'))
self.p2pkh: MetricPattern34[T] = MetricPattern34(client, (f'p2pkh_{{acc}}' if acc else 'p2pkh'))
self.p2sh: MetricPattern35[T] = MetricPattern35(client, (f'p2sh_{{acc}}' if acc else 'p2sh'))
self.p2tr: MetricPattern36[T] = MetricPattern36(client, (f'p2tr_{{acc}}' if acc else 'p2tr'))
self.p2wpkh: MetricPattern37[T] = MetricPattern37(client, (f'p2wpkh_{{acc}}' if acc else 'p2wpkh'))
self.p2wsh: MetricPattern38[T] = MetricPattern38(client, (f'p2wsh_{{acc}}' if acc else 'p2wsh'))
class BlockIntervalPattern(Generic[T]):
"""Pattern struct for repeated tree structure."""
@@ -2607,6 +2593,20 @@ class BlockIntervalPattern(Generic[T]):
self.pct75: MetricPattern25[T] = MetricPattern25(client, _m(acc, 'pct75'))
self.pct90: MetricPattern25[T] = MetricPattern25(client, _m(acc, 'pct90'))
class Constant0Pattern(Generic[T]):
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.dateindex: MetricPattern21[T] = MetricPattern21(client, acc)
self.decadeindex: MetricPattern22[T] = MetricPattern22(client, acc)
self.height: MetricPattern25[T] = MetricPattern25(client, acc)
self.monthindex: MetricPattern27[T] = MetricPattern27(client, acc)
self.quarterindex: MetricPattern39[T] = MetricPattern39(client, acc)
self.semesterindex: MetricPattern40[T] = MetricPattern40(client, acc)
self.weekindex: MetricPattern43[T] = MetricPattern43(client, acc)
self.yearindex: MetricPattern44[T] = MetricPattern44(client, acc)
class _0satsPattern:
"""Pattern struct for repeated tree structure."""
@@ -2620,6 +2620,18 @@ class _0satsPattern:
self.supply: SupplyPattern3 = SupplyPattern3(client, acc)
self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc)
class UpTo1dPattern:
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.activity: ActivityPattern2 = ActivityPattern2(client, acc)
self.cost_basis: CostBasisPattern2 = CostBasisPattern2(client, acc)
self.realized: RealizedPattern3 = RealizedPattern3(client, acc)
self.relative: RelativePattern2 = RelativePattern2(client, acc)
self.supply: SupplyPattern3 = SupplyPattern3(client, acc)
self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc)
class _0satsPattern2:
"""Pattern struct for repeated tree structure."""
@@ -2644,18 +2656,6 @@ class _10yTo12yPattern:
self.supply: SupplyPattern3 = SupplyPattern3(client, acc)
self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc)
class UpTo1dPattern:
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.activity: ActivityPattern2 = ActivityPattern2(client, acc)
self.cost_basis: CostBasisPattern2 = CostBasisPattern2(client, acc)
self.realized: RealizedPattern3 = RealizedPattern3(client, acc)
self.relative: RelativePattern2 = RelativePattern2(client, acc)
self.supply: SupplyPattern3 = SupplyPattern3(client, acc)
self.unrealized: UnrealizedPattern = UnrealizedPattern(client, acc)
class SegwitAdoptionPattern(Generic[T]):
"""Pattern struct for repeated tree structure."""
@@ -2700,16 +2700,6 @@ class SentPattern:
self.dollars: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'usd'))
self.sats: SatsPattern = SatsPattern(client, acc)
class OpreturnPattern:
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.base: MetricPattern25[Sats] = MetricPattern25(client, acc)
self.bitcoin: BitcoinPattern2[Bitcoin] = BitcoinPattern2(client, _m(acc, 'btc'))
self.dollars: BitcoinPattern2[Dollars] = BitcoinPattern2(client, _m(acc, 'usd'))
self.sats: SatsPattern4 = SatsPattern4(client, acc)
class SupplyPattern2:
"""Pattern struct for repeated tree structure."""
@@ -2720,14 +2710,15 @@ class SupplyPattern2:
self.dollars: MetricPattern4[Dollars] = MetricPattern4(client, _m(acc, 'usd'))
self.sats: MetricPattern4[Sats] = MetricPattern4(client, acc)
class UnclaimedRewardsPattern:
class OpreturnPattern:
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.bitcoin: BlockCountPattern[Bitcoin] = BlockCountPattern(client, _m(acc, 'btc'))
self.dollars: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'usd'))
self.sats: BlockCountPattern[Sats] = BlockCountPattern(client, acc)
self.base: MetricPattern25[Sats] = MetricPattern25(client, acc)
self.bitcoin: BitcoinPattern2[Bitcoin] = BitcoinPattern2(client, _m(acc, 'btc'))
self.dollars: BitcoinPattern2[Dollars] = BitcoinPattern2(client, _m(acc, 'usd'))
self.sats: SatsPattern4 = SatsPattern4(client, acc)
class CoinbasePattern:
"""Pattern struct for repeated tree structure."""
@@ -2738,15 +2729,6 @@ class CoinbasePattern:
self.dollars: BitcoinPattern[Dollars] = BitcoinPattern(client, _m(acc, 'usd'))
self.sats: BitcoinPattern[Sats] = BitcoinPattern(client, acc)
class ActiveSupplyPattern:
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.bitcoin: MetricPattern1[Bitcoin] = MetricPattern1(client, _m(acc, 'btc'))
self.dollars: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd'))
self.sats: MetricPattern1[Sats] = MetricPattern1(client, acc)
class CostBasisPattern2:
"""Pattern struct for repeated tree structure."""
@@ -2756,14 +2738,23 @@ class CostBasisPattern2:
self.min_cost_basis: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'min_cost_basis'))
self.percentiles: PercentilesPattern = PercentilesPattern(client, _m(acc, 'cost_basis'))
class BlockCountPattern(Generic[T]):
class UnclaimedRewardsPattern:
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.base: MetricPattern25[T] = MetricPattern25(client, acc)
self.cumulative: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'cumulative'))
self.sum: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'sum'))
self.bitcoin: BlockCountPattern[Bitcoin] = BlockCountPattern(client, _m(acc, 'btc'))
self.dollars: BlockCountPattern[Dollars] = BlockCountPattern(client, _m(acc, 'usd'))
self.sats: BlockCountPattern[Sats] = BlockCountPattern(client, acc)
class ActiveSupplyPattern:
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.bitcoin: MetricPattern1[Bitcoin] = MetricPattern1(client, _m(acc, 'btc'))
self.dollars: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd'))
self.sats: MetricPattern1[Sats] = MetricPattern1(client, acc)
class BitcoinPattern2(Generic[T]):
"""Pattern struct for repeated tree structure."""
@@ -2774,29 +2765,14 @@ class BitcoinPattern2(Generic[T]):
self.cumulative: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'cumulative'))
self.last: MetricPattern2[T] = MetricPattern2(client, acc)
class SatsPattern4:
class BlockCountPattern(Generic[T]):
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.cumulative: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'cumulative'))
self.last: MetricPattern2[Sats] = MetricPattern2(client, acc)
class CostBasisPattern:
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.max_cost_basis: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'max_cost_basis'))
self.min_cost_basis: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'min_cost_basis'))
class SatsPattern:
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.cumulative: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'cumulative'))
self.sum: MetricPattern2[Sats] = MetricPattern2(client, acc)
self.base: MetricPattern25[T] = MetricPattern25(client, acc)
self.cumulative: MetricPattern1[T] = MetricPattern1(client, _m(acc, 'cumulative'))
self.sum: MetricPattern2[T] = MetricPattern2(client, _m(acc, 'sum'))
class _1dReturns1mSdPattern:
"""Pattern struct for repeated tree structure."""
@@ -2806,6 +2782,22 @@ class _1dReturns1mSdPattern:
self.sd: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'sd'))
self.sma: MetricPattern4[StoredF32] = MetricPattern4(client, _m(acc, 'sma'))
class SatsPattern:
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.cumulative: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'cumulative'))
self.sum: MetricPattern2[Sats] = MetricPattern2(client, acc)
class CostBasisPattern:
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.max_cost_basis: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'max_cost_basis'))
self.min_cost_basis: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'min_cost_basis'))
class SupplyValuePattern:
"""Pattern struct for repeated tree structure."""
@@ -2814,6 +2806,14 @@ class SupplyValuePattern:
self.bitcoin: MetricPattern25[Bitcoin] = MetricPattern25(client, _m(acc, 'btc'))
self.dollars: MetricPattern25[Dollars] = MetricPattern25(client, _m(acc, 'usd'))
class SatsPattern4:
"""Pattern struct for repeated tree structure."""
def __init__(self, client: BrkClientBase, acc: str):
"""Create pattern node with accumulated metric name."""
self.cumulative: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'cumulative'))
self.last: MetricPattern2[Sats] = MetricPattern2(client, acc)
class TotalRealizedPnlPattern(Generic[T]):
"""Pattern struct for repeated tree structure."""
+4 -4
View File
@@ -40,17 +40,17 @@
* @typedef {AllUtxoPattern | MinAgePattern | UtxoAmountPattern} PatternWithRealizedPrice
* @typedef {AllUtxoPattern} PatternWithFullRealized
* @typedef {AllUtxoPattern | MinAgePattern | UtxoAmountPattern} PatternWithNupl
* @typedef {AllUtxoPattern | MinAgePattern | UtxoAmountPattern} PatternWithPricePaidStats
* @typedef {AllUtxoPattern | MinAgePattern | UtxoAmountPattern} PatternWithCostBasis
* @typedef {AllUtxoPattern | MinAgePattern | UtxoAmountPattern} PatternWithActivity
* @typedef {AllUtxoPattern | MaxAgePattern | MinAgePattern} PatternWithPricePercentiles
* @typedef {AllUtxoPattern | MaxAgePattern | MinAgePattern} PatternWithCostBasisPercentiles
*
* Cohort objects with specific pattern capabilities
* @typedef {{ name: string, title: string, color: Color, tree: PatternWithRealizedPrice }} CohortWithRealizedPrice
* @typedef {{ name: string, title: string, color: Color, tree: PatternWithFullRealized }} CohortWithFullRealized
* @typedef {{ name: string, title: string, color: Color, tree: PatternWithNupl }} CohortWithNupl
* @typedef {{ name: string, title: string, color: Color, tree: PatternWithPricePaidStats }} CohortWithPricePaidStats
* @typedef {{ name: string, title: string, color: Color, tree: PatternWithCostBasis }} CohortWithCostBasis
* @typedef {{ name: string, title: string, color: Color, tree: PatternWithActivity }} CohortWithActivity
* @typedef {{ name: string, title: string, color: Color, tree: PatternWithPricePercentiles }} CohortWithPricePercentiles
* @typedef {{ name: string, title: string, color: Color, tree: PatternWithCostBasisPercentiles }} CohortWithCostBasisPercentiles
*
* Tree branch types
* @typedef {InstanceType<typeof BrkClient>["tree"]["computed"]["market"]} Market
+5 -5
View File
@@ -2500,7 +2500,7 @@ export function createPartialOptions({ colors, brk }) {
top: list.flatMap(({ color, name, tree }) => {
return /** @type {const} */ ([
s({
metric: tree.pricePaid.minPricePaid,
metric: tree.costBasis.minCostBasis,
name,
color: color,
}),
@@ -2513,7 +2513,7 @@ export function createPartialOptions({ colors, brk }) {
top: list.flatMap(({ color, name, tree }) => {
return /** @type {const} */ ([
s({
metric: tree.pricePaid.maxPricePaid,
metric: tree.costBasis.maxCostBasis,
name,
color: color,
}),
@@ -2526,7 +2526,7 @@ export function createPartialOptions({ colors, brk }) {
: [
{
name: "Cost Basis",
title: `Costs Basis ${title}`,
title: `Cost Basis ${title}`,
top: [
s({
metric: args.tree.realizedPrice,
@@ -2534,13 +2534,13 @@ export function createPartialOptions({ colors, brk }) {
color: args.color,
}),
s({
metric: args.tree.pricePaid.minPricePaid,
metric: args.tree.costBasis.minCostBasis,
name: "Min",
color: colors.green,
defaultActive: false,
}),
s({
metric: args.tree.pricePaid.maxPricePaid,
metric: args.tree.costBasis.maxCostBasis,
name: "Max",
color: colors.red,
}),
@@ -1,7 +1,7 @@
/**
* Address cohort folder builder
* Creates option trees for address-based cohorts (has addrCount)
* Address cohorts use _0satsPattern which has PricePaidPattern (no percentiles)
* Address cohorts use _0satsPattern which has CostBasisPattern (no percentiles)
*/
import {
@@ -104,8 +104,8 @@ export function createAddressCohortFolder(ctx, args) {
// Unrealized section
...createUnrealizedSection(ctx, list, useGroupName, title),
// Price paid section (no percentiles for address cohorts)
...createPricePaidSection(ctx, list, useGroupName, title),
// Cost basis section (no percentiles for address cohorts)
...createCostBasisSection(ctx, list, useGroupName, title),
// Activity section
...createActivitySection(ctx, list, useGroupName, title),
@@ -237,32 +237,32 @@ function createUnrealizedSection(ctx, list, useGroupName, title) {
}
/**
* Create price paid section (no percentiles for address cohorts)
* Create cost basis section (no percentiles for address cohorts)
* @param {PartialContext} ctx
* @param {readonly AddressCohortObject[]} list
* @param {boolean} useGroupName
* @param {string} title
* @returns {PartialOptionsTree}
*/
function createPricePaidSection(ctx, list, useGroupName, title) {
function createCostBasisSection(ctx, list, useGroupName, title) {
const { s } = ctx;
return [
{
name: "Price Paid",
name: "Cost Basis",
tree: [
{
name: "min",
title: `Min Price Paid ${title}`,
title: `Min Cost Basis ${title}`,
top: list.map(({ color, name, tree }) =>
s({ metric: tree.pricePaid.minPricePaid, name: useGroupName ? name : "Min", color }),
s({ metric: tree.costBasis.minCostBasis, name: useGroupName ? name : "Min", color }),
),
},
{
name: "max",
title: `Max Price Paid ${title}`,
title: `Max Cost Basis ${title}`,
top: list.map(({ color, name, tree }) =>
s({ metric: tree.pricePaid.maxPricePaid, name: useGroupName ? name : "Max", color }),
s({ metric: tree.costBasis.maxCostBasis, name: useGroupName ? name : "Max", color }),
),
},
],
@@ -20,6 +20,6 @@ export {
createRealizedPriceSeries,
createRealizedPriceRatioSeries,
createRealizedCapSeries,
createPricePaidMinMaxSeries,
createPricePercentilesSeries,
createCostBasisMinMaxSeries,
createCostBasisPercentilesSeries,
} from "./shared.js";
@@ -178,39 +178,39 @@ export function createRealizedCapSeries(ctx, list, useGroupName) {
}
/**
* Create price paid min/max series (available on all cohorts)
* Create cost basis min/max series (available on all cohorts)
* @param {PartialContext} ctx
* @param {readonly CohortObject[]} list
* @param {boolean} useGroupName
* @returns {AnyFetchedSeriesBlueprint[]}
*/
export function createPricePaidMinMaxSeries(ctx, list, useGroupName) {
export function createCostBasisMinMaxSeries(ctx, list, useGroupName) {
const { s } = ctx;
return list.flatMap(({ color, name, tree }) => [
s({ metric: tree.pricePaid.minPricePaid, name: useGroupName ? `${name} min` : "Min", color }),
s({ metric: tree.pricePaid.maxPricePaid, name: useGroupName ? `${name} max` : "Max", color }),
s({ metric: tree.costBasis.minCostBasis, name: useGroupName ? `${name} min` : "Min", color }),
s({ metric: tree.costBasis.maxCostBasis, name: useGroupName ? `${name} max` : "Max", color }),
]);
}
/**
* Create price percentile series (only for cohorts with PricePaidPattern2)
* Create cost basis percentile series (only for cohorts with CostBasisPattern2)
* @param {PartialContext} ctx
* @param {readonly CohortWithPricePercentiles[]} list
* @param {readonly CohortWithCostBasisPercentiles[]} list
* @param {boolean} useGroupName
* @returns {AnyFetchedSeriesBlueprint[]}
*/
export function createPricePercentilesSeries(ctx, list, useGroupName) {
export function createCostBasisPercentilesSeries(ctx, list, useGroupName) {
const { s, colors } = ctx;
return list.flatMap(({ color, name, tree }) => {
const pp = tree.pricePaid.pricePercentiles;
const percentiles = tree.costBasis.percentiles;
return [
s({ metric: pp.pct10, name: useGroupName ? `${name} p10` : "p10", color, defaultActive: false }),
s({ metric: pp.pct25, name: useGroupName ? `${name} p25` : "p25", color, defaultActive: false }),
s({ metric: pp.pct50, name: useGroupName ? `${name} p50` : "p50", color }),
s({ metric: pp.pct75, name: useGroupName ? `${name} p75` : "p75", color, defaultActive: false }),
s({ metric: pp.pct90, name: useGroupName ? `${name} p90` : "p90", color, defaultActive: false }),
s({ metric: percentiles.pct10, name: useGroupName ? `${name} p10` : "p10", color, defaultActive: false }),
s({ metric: percentiles.pct25, name: useGroupName ? `${name} p25` : "p25", color, defaultActive: false }),
s({ metric: percentiles.pct50, name: useGroupName ? `${name} p50` : "p50", color }),
s({ metric: percentiles.pct75, name: useGroupName ? `${name} p75` : "p75", color, defaultActive: false }),
s({ metric: percentiles.pct90, name: useGroupName ? `${name} p90` : "p90", color, defaultActive: false }),
];
});
}
@@ -3,8 +3,8 @@
* Creates option trees for UTXO-based cohorts (no addrCount)
*
* Two main builders:
* - createAgeCohortFolder: For term, maxAge, minAge, ageRange, epoch (has price percentiles)
* - createAmountCohortFolder: For geAmount, ltAmount, amountRange, type (no price percentiles)
* - createAgeCohortFolder: For term, maxAge, minAge, ageRange, epoch (has cost basis percentiles)
* - createAmountCohortFolder: For geAmount, ltAmount, amountRange, type (no cost basis percentiles)
*/
import {
@@ -16,13 +16,13 @@ import {
createRealizedPriceSeries,
createRealizedPriceRatioSeries,
createRealizedCapSeries,
createPricePaidMinMaxSeries,
createPricePercentilesSeries,
createCostBasisMinMaxSeries,
createCostBasisPercentilesSeries,
} from "./shared.js";
/**
* Create a cohort folder for age-based UTXO cohorts (term, maxAge, minAge, ageRange, epoch)
* These cohorts have price percentiles via PricePaidPattern2
* These cohorts have cost basis percentiles via CostBasisPattern2
* @param {PartialContext} ctx
* @param {AgeCohortObject | AgeCohortGroupObject} args
* @returns {PartialOptionsGroup}
@@ -40,7 +40,7 @@ export function createAgeCohortFolder(ctx, args) {
createUtxoCountSection(ctx, list, useGroupName, title),
createRealizedSection(ctx, list, args, useGroupName, isSingle, title),
...createUnrealizedSection(ctx, list, useGroupName, title),
...createPricePaidSectionWithPercentiles(ctx, list, useGroupName, title),
...createCostBasisSectionWithPercentiles(ctx, list, useGroupName, title),
...createActivitySection(ctx, list, useGroupName, title),
],
};
@@ -48,7 +48,7 @@ export function createAgeCohortFolder(ctx, args) {
/**
* Create a cohort folder for amount-based UTXO cohorts (geAmount, ltAmount, amountRange, type)
* These cohorts have only min/max price paid via PricePaidPattern
* These cohorts have only min/max cost basis via CostBasisPattern
* @param {PartialContext} ctx
* @param {AmountCohortObject | AmountCohortGroupObject} args
* @returns {PartialOptionsGroup}
@@ -66,7 +66,7 @@ export function createAmountCohortFolder(ctx, args) {
createUtxoCountSection(ctx, list, useGroupName, title),
createRealizedSection(ctx, list, args, useGroupName, isSingle, title),
...createUnrealizedSection(ctx, list, useGroupName, title),
...createPricePaidSectionBasic(ctx, list, useGroupName, title),
...createCostBasisSectionBasic(ctx, list, useGroupName, title),
...createActivitySection(ctx, list, useGroupName, title),
],
};
@@ -87,7 +87,7 @@ export function createUtxoCohortFolder(ctx, args) {
const title = args.title ? `${useGroupName ? "by" : "of"} ${args.title}` : "";
// Runtime check for percentiles
const hasPercentiles = "pricePercentiles" in list[0].tree.pricePaid;
const hasPercentiles = "percentiles" in list[0].tree.costBasis;
return {
name: args.name || "all",
@@ -97,8 +97,8 @@ export function createUtxoCohortFolder(ctx, args) {
createRealizedSection(ctx, list, args, useGroupName, isSingle, title),
...createUnrealizedSection(ctx, list, useGroupName, title),
...(hasPercentiles
? createPricePaidSectionWithPercentiles(ctx, /** @type {readonly AgeCohortObject[]} */ (list), useGroupName, title)
: createPricePaidSectionBasic(ctx, list, useGroupName, title)),
? createCostBasisSectionWithPercentiles(ctx, /** @type {readonly AgeCohortObject[]} */ (list), useGroupName, title)
: createCostBasisSectionBasic(ctx, list, useGroupName, title)),
...createActivitySection(ctx, list, useGroupName, title),
],
};
@@ -372,38 +372,38 @@ function createUnrealizedSection(ctx, list, useGroupName, title) {
}
/**
* Create price paid section for cohorts WITH percentiles (age cohorts)
* Create cost basis section for cohorts WITH percentiles (age cohorts)
* @param {PartialContext} ctx
* @param {readonly AgeCohortObject[]} list
* @param {boolean} useGroupName
* @param {string} title
* @returns {PartialOptionsTree}
*/
function createPricePaidSectionWithPercentiles(ctx, list, useGroupName, title) {
function createCostBasisSectionWithPercentiles(ctx, list, useGroupName, title) {
const { s } = ctx;
return [
{
name: "Price Paid",
name: "Cost Basis",
tree: [
{
name: "min",
title: `Min Price Paid ${title}`,
title: `Min Cost Basis ${title}`,
top: list.map(({ color, name, tree }) =>
s({ metric: tree.pricePaid.minPricePaid, name: useGroupName ? name : "Min", color }),
s({ metric: tree.costBasis.minCostBasis, name: useGroupName ? name : "Min", color }),
),
},
{
name: "max",
title: `Max Price Paid ${title}`,
title: `Max Cost Basis ${title}`,
top: list.map(({ color, name, tree }) =>
s({ metric: tree.pricePaid.maxPricePaid, name: useGroupName ? name : "Max", color }),
s({ metric: tree.costBasis.maxCostBasis, name: useGroupName ? name : "Max", color }),
),
},
{
name: "percentiles",
title: `Price Paid Percentiles ${title}`,
top: createPricePercentilesSeries(ctx, list, useGroupName),
title: `Cost Basis Percentiles ${title}`,
top: createCostBasisPercentilesSeries(ctx, list, useGroupName),
},
],
},
@@ -411,32 +411,32 @@ function createPricePaidSectionWithPercentiles(ctx, list, useGroupName, title) {
}
/**
* Create price paid section for cohorts WITHOUT percentiles (amount cohorts)
* Create cost basis section for cohorts WITHOUT percentiles (amount cohorts)
* @param {PartialContext} ctx
* @param {readonly UtxoCohortObject[]} list
* @param {boolean} useGroupName
* @param {string} title
* @returns {PartialOptionsTree}
*/
function createPricePaidSectionBasic(ctx, list, useGroupName, title) {
function createCostBasisSectionBasic(ctx, list, useGroupName, title) {
const { s } = ctx;
return [
{
name: "Price Paid",
name: "Cost Basis",
tree: [
{
name: "min",
title: `Min Price Paid ${title}`,
title: `Min Cost Basis ${title}`,
top: list.map(({ color, name, tree }) =>
s({ metric: tree.pricePaid.minPricePaid, name: useGroupName ? name : "Min", color }),
s({ metric: tree.costBasis.minCostBasis, name: useGroupName ? name : "Min", color }),
),
},
{
name: "max",
title: `Max Price Paid ${title}`,
title: `Max Cost Basis ${title}`,
top: list.map(({ color, name, tree }) =>
s({ metric: tree.pricePaid.maxPricePaid, name: useGroupName ? name : "Max", color }),
s({ metric: tree.costBasis.maxCostBasis, name: useGroupName ? name : "Max", color }),
),
},
],
@@ -121,14 +121,14 @@
* @property {Color} color
* @property {UtxoCohortPattern} tree
*
* Age cohorts (term, maxAge, minAge, ageRange, epoch) - have price percentiles
* Age cohorts (term, maxAge, minAge, ageRange, epoch) - have cost basis percentiles
* @typedef {Object} AgeCohortObject
* @property {string} name
* @property {string} title
* @property {Color} color
* @property {PatternWithPricePercentiles} tree
* @property {PatternWithCostBasisPercentiles} tree
*
* Amount cohorts (geAmount, ltAmount, amountRange, type) - no price percentiles
* Amount cohorts (geAmount, ltAmount, amountRange, type) - no cost basis percentiles
* @typedef {Object} AmountCohortObject
* @property {string} name
* @property {string} title
+10 -10
View File
@@ -644,7 +644,7 @@ export function init({ colors, createChartElement, signals, resources }) {
equals: false,
},
);
const averagePricePaidData = signals.createSignal(
const averageCostBasisData = signals.createSignal(
/** @type {LineData[]} */ ([]),
{
equals: false,
@@ -772,7 +772,7 @@ export function init({ colors, createChartElement, signals, resources }) {
title: "Average Cost Basis",
type: "Line",
color: colors.lime,
data: averagePricePaidData,
data: averageCostBasisData,
},
],
},
@@ -873,7 +873,7 @@ export function init({ colors, createChartElement, signals, resources }) {
totalValueData().length = 0;
investmentData().length = 0;
bitcoinAddedData().length = 0;
averagePricePaidData().length = 0;
averageCostBasisData().length = 0;
bitcoinPriceData().length = 0;
buyCountData().length = 0;
totalFeesPaidData().length = 0;
@@ -887,7 +887,7 @@ export function init({ colors, createChartElement, signals, resources }) {
let investedAmount = 0;
let postFeesInvestedAmount = 0;
let buyCount = 0;
let averagePricePaid = 0;
let averageCostBasis = 0;
let bitcoinValue = 0;
let roi = 0;
let totalValue = 0;
@@ -951,7 +951,7 @@ export function init({ colors, createChartElement, signals, resources }) {
totalValue = dollars + bitcoinValue;
averagePricePaid = postFeesInvestedAmount / bitcoin;
averageCostBasis = postFeesInvestedAmount / bitcoin;
roi = (bitcoinValue / postFeesInvestedAmount - 1) * 100;
@@ -1010,9 +1010,9 @@ export function init({ colors, createChartElement, signals, resources }) {
value: bitcoinAdded,
});
averagePricePaidData().push({
averageCostBasisData().push({
time,
value: averagePricePaid,
value: averageCostBasis,
});
buyCountData().push({
@@ -1057,12 +1057,12 @@ export function init({ colors, createChartElement, signals, resources }) {
const serSats = c("orange", f(sats));
const serBitcoin = c("orange", `~${f(bitcoin)}`);
const serBitcoinValue = c("amber", fd(bitcoinValue));
const serAveragePricePaid = c("lime", fd(averagePricePaid));
const serAverageCostBasis = c("lime", fd(averageCostBasis));
const serRoi = c("yellow", fp(roi / 100));
const serDollars = c("emerald", fd(dollars));
const serTotalFeesPaid = c("rose", fd(totalFeesPaid));
p1.innerHTML = `After exchanging ${serInvestedAmount} in the span of ${serDaysCount} days, you would have accumulated ${serSats} Satoshis (${serBitcoin} Bitcoin) worth today ${serBitcoinValue} at an average price of ${serAveragePricePaid} per Bitcoin with a return of investment of ${serRoi}, have ${serDollars} left and paid a total of ${serTotalFeesPaid} in fees.`;
p1.innerHTML = `After exchanging ${serInvestedAmount} in the span of ${serDaysCount} days, you would have accumulated ${serSats} Satoshis (${serBitcoin} Bitcoin) worth today ${serBitcoinValue} at an average cost basis of ${serAverageCostBasis} per Bitcoin with a return of investment of ${serRoi}, have ${serDollars} left and paid a total of ${serTotalFeesPaid} in fees.`;
const dayDiff = Math.floor(
differenceBetweenDates(new Date(), lastInvestDay),
@@ -1092,7 +1092,7 @@ export function init({ colors, createChartElement, signals, resources }) {
totalValueData.set((a) => a);
investmentData.set((a) => a);
bitcoinAddedData.set((a) => a);
averagePricePaidData.set((a) => a);
averageCostBasisData.set((a) => a);
bitcoinPriceData.set((a) => a);
buyCountData.set((a) => a);
totalFeesPaidData.set((a) => a);
+1 -1
View File
@@ -308,7 +308,7 @@ export const serdeUnit = {
(v.includes("_usd") && !v.endsWith("velocity")) ||
v.includes("cointime_value") ||
v.endsWith("_ago") ||
v.endsWith("price_paid") ||
v.endsWith("cost_basis") ||
v.endsWith("_price") ||
(v.startsWith("price") && (v.endsWith("min") || v.endsWith("max"))) ||
(v.endsWith("_cap") && !v.includes("rel_to")) ||