global: fixes

This commit is contained in:
nym21
2025-09-07 21:55:39 +02:00
parent 10b496e845
commit de98c5f706
5 changed files with 63 additions and 82 deletions
-2
View File
@@ -151,8 +151,6 @@ impl Computer {
.compute(indexer, &self.indexes, price, &starting_indexes, exit)?;
}
// let _ = generate_allocation_files(&self.pools);
chain.join().unwrap()?;
Ok(())
})?;
+12 -12
View File
@@ -50,12 +50,12 @@ pub struct Vecs {
pub indexes_to_coinblocks_destroyed: ComputedVecsFromHeight<StoredF64>,
pub indexes_to_coindays_destroyed: ComputedVecsFromHeight<StoredF64>,
pub dateindex_to_sopr: Option<EagerVec<DateIndex, StoredF32>>,
pub dateindex_to_sopr_7d_ema: Option<EagerVec<DateIndex, StoredF32>>,
pub dateindex_to_sopr_30d_ema: Option<EagerVec<DateIndex, StoredF32>>,
pub dateindex_to_adjusted_sopr: Option<EagerVec<DateIndex, StoredF32>>,
pub dateindex_to_adjusted_sopr_7d_ema: Option<EagerVec<DateIndex, StoredF32>>,
pub dateindex_to_adjusted_sopr_30d_ema: Option<EagerVec<DateIndex, StoredF32>>,
pub dateindex_to_sopr: Option<EagerVec<DateIndex, StoredF64>>,
pub dateindex_to_sopr_7d_ema: Option<EagerVec<DateIndex, StoredF64>>,
pub dateindex_to_sopr_30d_ema: Option<EagerVec<DateIndex, StoredF64>>,
pub dateindex_to_adjusted_sopr: Option<EagerVec<DateIndex, StoredF64>>,
pub dateindex_to_adjusted_sopr_7d_ema: Option<EagerVec<DateIndex, StoredF64>>,
pub dateindex_to_adjusted_sopr_30d_ema: Option<EagerVec<DateIndex, StoredF64>>,
pub indexes_to_realized_cap_30d_delta: Option<ComputedVecsFromDateIndex<Dollars>>,
pub dateindex_to_sell_side_risk_ratio: Option<EagerVec<DateIndex, StoredF32>>,
pub dateindex_to_sell_side_risk_ratio_7d_ema: Option<EagerVec<DateIndex, StoredF32>>,
@@ -720,7 +720,7 @@ impl Vecs {
EagerVec::forced_import(
db,
&suffix("sopr"),
version + VERSION + Version::ZERO,
version + VERSION + Version::ONE,
format,
)
.unwrap()
@@ -729,7 +729,7 @@ impl Vecs {
EagerVec::forced_import(
db,
&suffix("sopr_7d_ema"),
version + VERSION + Version::ZERO,
version + VERSION + Version::ONE,
format,
)
.unwrap()
@@ -738,7 +738,7 @@ impl Vecs {
EagerVec::forced_import(
db,
&suffix("sopr_30d_ema"),
version + VERSION + Version::ZERO,
version + VERSION + Version::ONE,
format,
)
.unwrap()
@@ -747,7 +747,7 @@ impl Vecs {
EagerVec::forced_import(
db,
&suffix("adjusted_sopr"),
version + VERSION + Version::ZERO,
version + VERSION + Version::ONE,
format,
)
.unwrap()
@@ -756,7 +756,7 @@ impl Vecs {
EagerVec::forced_import(
db,
&suffix("adjusted_sopr_7d_ema"),
version + VERSION + Version::ZERO,
version + VERSION + Version::ONE,
format,
)
.unwrap()
@@ -765,7 +765,7 @@ impl Vecs {
EagerVec::forced_import(
db,
&suffix("adjusted_sopr_30d_ema"),
version + VERSION + Version::ZERO,
version + VERSION + Version::ONE,
format,
)
.unwrap()
+2 -4
View File
@@ -7,8 +7,8 @@ use serde::Deserialize;
#[derive(Debug, Deref, JsonSchema)]
pub struct MaybeIds(Vec<String>);
const MAX_STRING_SIZE: usize = 10_000;
const MAX_VECS: usize = 64;
const MAX_VECS: usize = 32;
const MAX_STRING_SIZE: usize = 64 * MAX_VECS;
impl From<String> for MaybeIds {
fn from(value: String) -> Self {
@@ -34,7 +34,6 @@ impl<'de> Deserialize<'de> for MaybeIds {
str.split(",").map(|s| s.to_string()),
)))
} else {
dbg!(str.len(), MAX_STRING_SIZE);
Err(serde::de::Error::custom("Given parameter is too long"))
}
}
@@ -44,7 +43,6 @@ impl<'de> Deserialize<'de> for MaybeIds {
vec.into_iter().map(|s| s.as_str().unwrap().to_string()),
)))
} else {
dbg!(vec.len(), MAX_VECS);
Err(serde::de::Error::custom("Given parameter is too long"))
}
}
@@ -1,6 +1,7 @@
use std::{
cmp::Ordering,
f64,
iter::Sum,
ops::{Add, AddAssign, Div, Mul},
};
@@ -77,6 +78,13 @@ impl Div<StoredF64> for StoredF64 {
}
}
impl Div<Dollars> for StoredF64 {
type Output = Self;
fn div(self, rhs: Dollars) -> Self::Output {
Self::from(self.0 / *rhs)
}
}
impl Add for StoredF64 {
type Output = Self;
fn add(self, rhs: Self) -> Self::Output {
@@ -161,3 +169,9 @@ impl Printable for StoredF64 {
&["f64"]
}
}
impl Sum for StoredF64 {
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
Self(iter.map(|v| v.0).sum::<f64>())
}
}
+35 -64
View File
@@ -3740,15 +3740,9 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
return {
name,
tree: [
// indexes_to_dominance: ComputedVecsFromDateIndex<StoredF32>,
// indexes_to_1d_dominance: ComputedVecsFromDateIndex<StoredF32>,
// indexes_to_1w_dominance: ComputedVecsFromDateIndex<StoredF32>,
// indexes_to_1m_dominance: ComputedVecsFromDateIndex<StoredF32>,
// indexes_to_1y_dominance: ComputedVecsFromDateIndex<StoredF32>,
// indexes_to_days_since_block: ComputedVecsFromDateIndex<StoredU16>,
{
name: "Dominance",
title: `Dominance of ${name}`,
title: `Mining Dominance of ${name}`,
bottom: [
createBaseSeries({
key: `${key}_1d_dominance`,
@@ -3815,68 +3809,45 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
},
{
name: "Rewards",
tree: [
title: `Rewards collected by ${name}`,
bottom: [
{
name: "coinbase",
title: `coinbase collected by ${name}`,
bottom: [
...createSumCumulativeSeries({
concat: `${key}_coinbase`,
common: "coinbase",
// cumulativeColor: colors.
}),
...createSumCumulativeSeries({
concat: `${key}_coinbase_in_btc`,
common: "coinbase",
// cumulativeColor: colors.
}),
...createSumCumulativeSeries({
concat: `${key}_coinbase_in_usd`,
common: "coinbase",
}),
],
keyAddon: "coinbase",
cumulativeColor: colors.red,
sumColor: colors.orange,
},
{
name: "subsidy",
title: `subsidy collected by ${name}`,
bottom: [
...createSumCumulativeSeries({
concat: `${key}_subsidy`,
common: "subsidy",
// cumulativeColor: colors.
}),
...createSumCumulativeSeries({
concat: `${key}_subsidy_in_btc`,
common: "subsidy",
// cumulativeColor: colors.
}),
...createSumCumulativeSeries({
concat: `${key}_subsidy_in_usd`,
common: "subsidy",
}),
],
keyAddon: "subsidy",
cumulativeColor: colors.emerald,
sumColor: colors.lime,
},
{
name: "fees",
title: `fees collected by ${name}`,
bottom: [
...createSumCumulativeSeries({
concat: `${key}_fee`,
common: "fee",
// cumulativeColor: colors.
}),
...createSumCumulativeSeries({
concat: `${key}_fee_in_btc`,
common: "fee",
// cumulativeColor: colors.
}),
...createSumCumulativeSeries({
concat: `${key}_fee_in_usd`,
common: "fee",
}),
],
keyAddon: "fee",
cumulativeColor: colors.indigo,
sumColor: colors.cyan,
},
],
].flatMap(
({ keyAddon, sumColor, cumulativeColor }) => [
...createSumCumulativeSeries({
concat: `${key}_${keyAddon}`,
common: keyAddon,
sumColor,
cumulativeColor,
}),
...createSumCumulativeSeries({
concat: `${key}_${keyAddon}_in_btc`,
common: keyAddon,
sumColor,
cumulativeColor,
}),
...createSumCumulativeSeries({
concat: `${key}_${keyAddon}_in_usd`,
common: keyAddon,
sumColor,
cumulativeColor,
}),
],
),
},
{
name: "Days since block",
@@ -3884,7 +3855,7 @@ function createPartialOptions({ env, colors, vecIdToIndexes, pools }) {
bottom: [
createBaseSeries({
key: `${key}_days_since_block`,
name: "Raw",
name: "Since block",
}),
],
},