proof-of-portfolio 0.0.102__py3-none-any.whl → 0.0.104__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.
- proof_of_portfolio/_version.py +1 -1
- proof_of_portfolio/circuits/components/src/core/calmar.nr +10 -15
- proof_of_portfolio/circuits/components/src/core/omega.nr +18 -13
- proof_of_portfolio/circuits/target/circuits.json +1 -1
- proof_of_portfolio/circuits/vk/vk +0 -0
- {proof_of_portfolio-0.0.102.dist-info → proof_of_portfolio-0.0.104.dist-info}/METADATA +1 -1
- {proof_of_portfolio-0.0.102.dist-info → proof_of_portfolio-0.0.104.dist-info}/RECORD +10 -10
- {proof_of_portfolio-0.0.102.dist-info → proof_of_portfolio-0.0.104.dist-info}/WHEEL +0 -0
- {proof_of_portfolio-0.0.102.dist-info → proof_of_portfolio-0.0.104.dist-info}/entry_points.txt +0 -0
- {proof_of_portfolio-0.0.102.dist-info → proof_of_portfolio-0.0.104.dist-info}/top_level.txt +0 -0
proof_of_portfolio/_version.py
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
# This file is auto-generated during build
|
2
|
-
__version__ = "0.0.
|
2
|
+
__version__ = "0.0.104"
|
@@ -1,9 +1,6 @@
|
|
1
|
-
use crate::utils::{
|
2
|
-
|
3
|
-
|
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
|
-
|
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
|
23
|
-
let max_drawdown_decimal = daily_max_drawdown(log_returns, actual_len)
|
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
|
22
|
+
if (max_drawdown_decimal == 0) | (ann_excess_return <= 0) {
|
28
23
|
0
|
29
24
|
} else {
|
30
|
-
let raw_calmar =
|
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
|
29
|
+
raw_calmar
|
35
30
|
}
|
36
31
|
}
|
37
32
|
}
|
@@ -18,8 +18,8 @@ pub fn omega(
|
|
18
18
|
if use_weighting {
|
19
19
|
let mut product_sum_positive: i64 = 0;
|
20
20
|
let mut product_sum_negative: i64 = 0;
|
21
|
-
let mut
|
22
|
-
let mut
|
21
|
+
let mut sum_weights_positive_raw: i64 = 0;
|
22
|
+
let mut sum_weights_negative_raw: i64 = 0;
|
23
23
|
|
24
24
|
for i in 0..ARRAY_SIZE {
|
25
25
|
if (i as u32) < actual_len {
|
@@ -27,31 +27,36 @@ pub fn omega(
|
|
27
27
|
let log_return = log_returns[i];
|
28
28
|
if log_return > 0 {
|
29
29
|
product_sum_positive += log_return * weight;
|
30
|
-
|
30
|
+
sum_weights_positive_raw += weight;
|
31
31
|
} else {
|
32
32
|
product_sum_negative += log_return * weight;
|
33
|
-
|
33
|
+
sum_weights_negative_raw += weight;
|
34
34
|
}
|
35
35
|
}
|
36
36
|
}
|
37
37
|
|
38
|
-
|
39
|
-
|
38
|
+
// Apply max with omega_loss_min like in Python reference
|
39
|
+
let sum_weights_positive = if sum_weights_positive_raw >= omega_loss_min {
|
40
|
+
sum_weights_positive_raw
|
40
41
|
} else {
|
41
|
-
|
42
|
+
omega_loss_min
|
42
43
|
};
|
43
|
-
let
|
44
|
-
|
44
|
+
let sum_weights_negative = if sum_weights_negative_raw >= omega_loss_min {
|
45
|
+
sum_weights_negative_raw
|
45
46
|
} else {
|
46
|
-
|
47
|
+
omega_loss_min
|
47
48
|
};
|
48
49
|
|
49
|
-
|
50
|
-
|
50
|
+
// Apply cross-multiplication like in PTN reference implementation
|
51
|
+
let positive_sum_weighted = product_sum_positive * sum_weights_negative;
|
52
|
+
let negative_sum_weighted = product_sum_negative * sum_weights_positive;
|
53
|
+
|
54
|
+
let effective_denominator = if (-negative_sum_weighted) >= omega_loss_min {
|
55
|
+
-negative_sum_weighted
|
51
56
|
} else {
|
52
57
|
omega_loss_min
|
53
58
|
};
|
54
|
-
(
|
59
|
+
(positive_sum_weighted * RATIO_SCALE_FACTOR) / effective_denominator
|
55
60
|
} else {
|
56
61
|
let mut positive_sum: i64 = 0;
|
57
62
|
let mut negative_sum: i64 = 0;
|