website: snapshot

This commit is contained in:
nym21
2026-02-02 12:44:16 +01:00
parent f7d7c5704a
commit da923e409a
23 changed files with 2537 additions and 619 deletions
+13 -13
View File
@@ -67,7 +67,7 @@ impl Vecs {
compute_period_profitability(
&mut self.period_days_in_profit,
&mut self.period_days_in_loss,
&mut self.period_max_drawdown,
&mut self.period_min_return,
&mut self.period_max_return,
&self.period_returns,
starting_indexes,
@@ -95,7 +95,7 @@ impl Vecs {
compute_period_profitability(
&mut self.period_lump_sum_days_in_profit,
&mut self.period_lump_sum_days_in_loss,
&mut self.period_lump_sum_max_drawdown,
&mut self.period_lump_sum_min_return,
&mut self.period_lump_sum_max_return,
&self.period_lump_sum_returns,
starting_indexes,
@@ -130,7 +130,7 @@ impl Vecs {
compute_class_profitability(
&mut self.class_days_in_profit,
&mut self.class_days_in_loss,
&mut self.class_max_drawdown,
&mut self.class_min_return,
&mut self.class_max_return,
&self.class_returns,
starting_indexes,
@@ -144,16 +144,16 @@ impl Vecs {
fn compute_period_profitability(
days_in_profit: &mut ByDcaPeriod<ComputedFromDateLast<StoredU32>>,
days_in_loss: &mut ByDcaPeriod<ComputedFromDateLast<StoredU32>>,
max_drawdown: &mut ByDcaPeriod<ComputedFromDateLast<StoredF32>>,
min_return: &mut ByDcaPeriod<ComputedFromDateLast<StoredF32>>,
max_return: &mut ByDcaPeriod<ComputedFromDateLast<StoredF32>>,
returns: &ByDcaPeriod<LazyBinaryFromDateLast<StoredF32, Close<Dollars>, Dollars>>,
starting_indexes: &ComputeIndexes,
exit: &Exit,
) -> Result<()> {
for ((((dip, dil), md), mr), (ret, days)) in days_in_profit
for ((((dip, dil), minr), maxr), (ret, days)) in days_in_profit
.iter_mut()
.zip(days_in_loss.iter_mut())
.zip(max_drawdown.iter_mut())
.zip(min_return.iter_mut())
.zip(max_return.iter_mut())
.zip(returns.iter_with_days())
{
@@ -177,7 +177,7 @@ fn compute_period_profitability(
)?)
})?;
md.compute_all(starting_indexes, exit, |v| {
minr.compute_all(starting_indexes, exit, |v| {
Ok(v.compute_min(
starting_indexes.dateindex,
&ret.dateindex,
@@ -186,7 +186,7 @@ fn compute_period_profitability(
)?)
})?;
mr.compute_all(starting_indexes, exit, |v| {
maxr.compute_all(starting_indexes, exit, |v| {
Ok(v.compute_max(
starting_indexes.dateindex,
&ret.dateindex,
@@ -201,7 +201,7 @@ fn compute_period_profitability(
fn compute_class_profitability(
days_in_profit: &mut ByDcaClass<ComputedFromDateLast<StoredU32>>,
days_in_loss: &mut ByDcaClass<ComputedFromDateLast<StoredU32>>,
max_drawdown: &mut ByDcaClass<ComputedFromDateLast<StoredF32>>,
min_return: &mut ByDcaClass<ComputedFromDateLast<StoredF32>>,
max_return: &mut ByDcaClass<ComputedFromDateLast<StoredF32>>,
returns: &ByDcaClass<LazyBinaryFromDateLast<StoredF32, Close<Dollars>, Dollars>>,
starting_indexes: &ComputeIndexes,
@@ -209,10 +209,10 @@ fn compute_class_profitability(
) -> Result<()> {
let dateindexes = ByDcaClass::<()>::dateindexes();
for (((((dip, dil), md), mr), ret), from) in days_in_profit
for (((((dip, dil), minr), maxr), ret), from) in days_in_profit
.iter_mut()
.zip(days_in_loss.iter_mut())
.zip(max_drawdown.iter_mut())
.zip(min_return.iter_mut())
.zip(max_return.iter_mut())
.zip(returns.iter())
.zip(dateindexes)
@@ -237,7 +237,7 @@ fn compute_class_profitability(
)?)
})?;
md.compute_all(starting_indexes, exit, |v| {
minr.compute_all(starting_indexes, exit, |v| {
Ok(v.compute_all_time_low_from(
starting_indexes.dateindex,
&ret.dateindex,
@@ -246,7 +246,7 @@ fn compute_class_profitability(
)?)
})?;
mr.compute_all(starting_indexes, exit, |v| {
maxr.compute_all(starting_indexes, exit, |v| {
Ok(v.compute_all_time_high_from(
starting_indexes.dateindex,
&ret.dateindex,
+9 -9
View File
@@ -67,10 +67,10 @@ impl Vecs {
)
})?;
let period_max_drawdown = ByDcaPeriod::try_new(|name, _days| {
let period_min_return = ByDcaPeriod::try_new(|name, _days| {
ComputedFromDateLast::forced_import(
db,
&format!("{name}_dca_max_drawdown"),
&format!("{name}_dca_min_return"),
version,
indexes,
)
@@ -130,10 +130,10 @@ impl Vecs {
)
})?;
let period_lump_sum_max_drawdown = ByDcaPeriod::try_new(|name, _days| {
let period_lump_sum_min_return = ByDcaPeriod::try_new(|name, _days| {
ComputedFromDateLast::forced_import(
db,
&format!("{name}_lump_sum_max_drawdown"),
&format!("{name}_lump_sum_min_return"),
version,
indexes,
)
@@ -189,10 +189,10 @@ impl Vecs {
)
})?;
let class_max_drawdown = ByDcaClass::try_new(|name, _year, _dateindex| {
let class_min_return = ByDcaClass::try_new(|name, _year, _dateindex| {
ComputedFromDateLast::forced_import(
db,
&format!("{name}_max_drawdown"),
&format!("{name}_min_return"),
version,
indexes,
)
@@ -214,20 +214,20 @@ impl Vecs {
period_cagr,
period_days_in_profit,
period_days_in_loss,
period_max_drawdown,
period_min_return,
period_max_return,
period_lump_sum_stack,
period_lump_sum_returns,
period_lump_sum_days_in_profit,
period_lump_sum_days_in_loss,
period_lump_sum_max_drawdown,
period_lump_sum_min_return,
period_lump_sum_max_return,
class_stack,
class_average_price,
class_returns,
class_days_in_profit,
class_days_in_loss,
class_max_drawdown,
class_min_return,
class_max_return,
})
}
+3 -3
View File
@@ -16,7 +16,7 @@ pub struct Vecs {
// DCA by period - profitability
pub period_days_in_profit: ByDcaPeriod<ComputedFromDateLast<StoredU32>>,
pub period_days_in_loss: ByDcaPeriod<ComputedFromDateLast<StoredU32>>,
pub period_max_drawdown: ByDcaPeriod<ComputedFromDateLast<StoredF32>>,
pub period_min_return: ByDcaPeriod<ComputedFromDateLast<StoredF32>>,
pub period_max_return: ByDcaPeriod<ComputedFromDateLast<StoredF32>>,
// Lump sum by period (for comparison with DCA) - KISS types
@@ -26,7 +26,7 @@ pub struct Vecs {
// Lump sum by period - profitability
pub period_lump_sum_days_in_profit: ByDcaPeriod<ComputedFromDateLast<StoredU32>>,
pub period_lump_sum_days_in_loss: ByDcaPeriod<ComputedFromDateLast<StoredU32>>,
pub period_lump_sum_max_drawdown: ByDcaPeriod<ComputedFromDateLast<StoredF32>>,
pub period_lump_sum_min_return: ByDcaPeriod<ComputedFromDateLast<StoredF32>>,
pub period_lump_sum_max_return: ByDcaPeriod<ComputedFromDateLast<StoredF32>>,
// DCA by year class - KISS types
@@ -37,6 +37,6 @@ pub struct Vecs {
// DCA by year class - profitability
pub class_days_in_profit: ByDcaClass<ComputedFromDateLast<StoredU32>>,
pub class_days_in_loss: ByDcaClass<ComputedFromDateLast<StoredU32>>,
pub class_max_drawdown: ByDcaClass<ComputedFromDateLast<StoredF32>>,
pub class_min_return: ByDcaClass<ComputedFromDateLast<StoredF32>>,
pub class_max_return: ByDcaClass<ComputedFromDateLast<StoredF32>>,
}