proof-of-portfolio 0.0.98__py3-none-any.whl → 0.0.99__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  # This file is auto-generated during build
2
- __version__ = "0.0.98"
2
+ __version__ = "0.0.99"
@@ -31,7 +31,7 @@ fn exp_scaled(x_scaled: i64) -> i64 {
31
31
  }
32
32
 
33
33
  pub fn daily_max_drawdown(log_returns: [i64; ARRAY_SIZE], actual_len: u32) -> i64 {
34
- let mut max_drawdown_factor = SCALE;
34
+ let mut max_drawdown_decimal: i64 = 0;
35
35
 
36
36
  if actual_len > 0 {
37
37
  let mut cumulative_sum: i64 = 0;
@@ -45,21 +45,19 @@ pub fn daily_max_drawdown(log_returns: [i64; ARRAY_SIZE], actual_len: u32) -> i6
45
45
  running_max = cumulative_sum;
46
46
  }
47
47
 
48
- if running_max > 0 {
49
- let cumulative_value = exp_scaled(cumulative_sum);
50
- let max_value = exp_scaled(running_max);
51
-
52
- let drawdown_factor = (cumulative_value * SCALE) / max_value;
53
-
54
- if drawdown_factor < max_drawdown_factor {
55
- max_drawdown_factor = drawdown_factor;
48
+ let delta_scaled = cumulative_sum - running_max;
49
+ if delta_scaled < 0 {
50
+ let exp_delta = exp_scaled(delta_scaled);
51
+ let dd_decimal_i = SCALE - exp_delta;
52
+ if dd_decimal_i > max_drawdown_decimal {
53
+ max_drawdown_decimal = dd_decimal_i;
56
54
  }
57
55
  }
58
56
  }
59
57
  }
60
58
  }
61
59
 
62
- SCALE - max_drawdown_factor
60
+ max_drawdown_decimal
63
61
  }
64
62
 
65
63
  #[test]