proof-of-portfolio 0.0.102__py3-none-any.whl → 0.0.103__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.102"
2
+ __version__ = "0.0.103"
@@ -1,9 +1,6 @@
1
- use crate::utils::{
2
- constants::{
3
- ARRAY_SIZE, CALMAR_NOCONFIDENCE_VALUE, RATIO_SCALE_FACTOR, SCALE,
4
- STATISTICAL_CONFIDENCE_MINIMUM_N,
5
- },
6
- risk_normalization::risk_normalization,
1
+ use crate::utils::constants::{
2
+ ARRAY_SIZE, CALMAR_NOCONFIDENCE_VALUE, RATIO_SCALE_FACTOR, SCALE,
3
+ STATISTICAL_CONFIDENCE_MINIMUM_N,
7
4
  };
8
5
  use super::drawdown::daily_max_drawdown;
9
6
 
@@ -14,24 +11,22 @@ pub fn calmar(
14
11
  avg_daily_return: i64,
15
12
  calmar_cap: i64,
16
13
  days_in_year: i64,
17
- drawdown_max_percent: i64,
14
+ _drawdown_max_percent: i64,
18
15
  ) -> i64 {
19
16
  if !bypass_confidence & actual_len < STATISTICAL_CONFIDENCE_MINIMUM_N {
20
17
  CALMAR_NOCONFIDENCE_VALUE
21
18
  } else {
22
- let base_return_percentage = (avg_daily_return * days_in_year * 100) / SCALE;
23
- let max_drawdown_decimal = daily_max_drawdown(log_returns, actual_len) / SCALE;
24
- let drawdown_normalization_factor =
25
- risk_normalization(max_drawdown_decimal, drawdown_max_percent);
19
+ let ann_excess_return = avg_daily_return * days_in_year;
20
+ let max_drawdown_decimal = daily_max_drawdown(log_returns, actual_len);
26
21
 
27
- if drawdown_normalization_factor == 0 {
22
+ if (max_drawdown_decimal == 0) | (ann_excess_return <= 0) {
28
23
  0
29
24
  } else {
30
- let raw_calmar = base_return_percentage * drawdown_normalization_factor;
31
- if raw_calmar > calmar_cap {
25
+ let raw_calmar = (ann_excess_return * RATIO_SCALE_FACTOR) / max_drawdown_decimal;
26
+ if raw_calmar > (calmar_cap * RATIO_SCALE_FACTOR) {
32
27
  calmar_cap * RATIO_SCALE_FACTOR
33
28
  } else {
34
- raw_calmar * RATIO_SCALE_FACTOR
29
+ raw_calmar
35
30
  }
36
31
  }
37
32
  }