proof-of-portfolio 0.0.92__py3-none-any.whl → 0.0.94__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 +7 -3
- proof_of_portfolio/circuits/components/src/core/omega.nr +36 -24
- proof_of_portfolio/circuits/src/main.nr +4 -1
- proof_of_portfolio/circuits/target/circuits.json +1 -1
- proof_of_portfolio/circuits/vk/vk +0 -0
- proof_of_portfolio/proof_generator.py +12 -3
- {proof_of_portfolio-0.0.92.dist-info → proof_of_portfolio-0.0.94.dist-info}/METADATA +1 -1
- {proof_of_portfolio-0.0.92.dist-info → proof_of_portfolio-0.0.94.dist-info}/RECORD +12 -12
- {proof_of_portfolio-0.0.92.dist-info → proof_of_portfolio-0.0.94.dist-info}/WHEEL +0 -0
- {proof_of_portfolio-0.0.92.dist-info → proof_of_portfolio-0.0.94.dist-info}/entry_points.txt +0 -0
- {proof_of_portfolio-0.0.92.dist-info → proof_of_portfolio-0.0.94.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.94"
|
@@ -18,6 +18,7 @@ pub fn calmar(
|
|
18
18
|
avg_daily_return: i64,
|
19
19
|
variance_val: i64,
|
20
20
|
ann_excess_return_val: i64,
|
21
|
+
calmar_cap: i64,
|
21
22
|
) -> i64 {
|
22
23
|
if !bypass_confidence & actual_len < STATISTICAL_CONFIDENCE_MINIMUM_N {
|
23
24
|
CALMAR_NOCONFIDENCE_VALUE
|
@@ -30,11 +31,10 @@ pub fn calmar(
|
|
30
31
|
0
|
31
32
|
} else {
|
32
33
|
let raw_calmar = (base_return_percentage * drawdown_normalization_factor) / SCALE;
|
33
|
-
let calmar_cap = 10 * RATIO_SCALE_FACTOR;
|
34
34
|
if raw_calmar > calmar_cap {
|
35
|
-
calmar_cap
|
35
|
+
calmar_cap * RATIO_SCALE_FACTOR
|
36
36
|
} else {
|
37
|
-
raw_calmar
|
37
|
+
raw_calmar * RATIO_SCALE_FACTOR
|
38
38
|
}
|
39
39
|
}
|
40
40
|
}
|
@@ -66,6 +66,7 @@ fn test_calmar_normal_case() {
|
|
66
66
|
avg,
|
67
67
|
variance_val,
|
68
68
|
ann_excess,
|
69
|
+
1,
|
69
70
|
);
|
70
71
|
assert(result != 0);
|
71
72
|
}
|
@@ -90,6 +91,7 @@ fn test_calmar_insufficient_data() {
|
|
90
91
|
avg,
|
91
92
|
variance_val,
|
92
93
|
ann_excess,
|
94
|
+
1,
|
93
95
|
);
|
94
96
|
assert(result == 0);
|
95
97
|
}
|
@@ -115,6 +117,7 @@ fn test_calmar_exactly_30_days() {
|
|
115
117
|
avg,
|
116
118
|
variance_val,
|
117
119
|
ann_excess,
|
120
|
+
1,
|
118
121
|
);
|
119
122
|
assert(result != 0);
|
120
123
|
}
|
@@ -140,6 +143,7 @@ fn test_calmar_negative_returns() {
|
|
140
143
|
avg,
|
141
144
|
variance_val,
|
142
145
|
ann_excess,
|
146
|
+
1,
|
143
147
|
);
|
144
148
|
assert(result != 0);
|
145
149
|
}
|
@@ -33,46 +33,58 @@ pub fn omega(
|
|
33
33
|
}
|
34
34
|
}
|
35
35
|
|
36
|
-
if sum_weights_positive
|
37
|
-
|
38
|
-
}
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
let positive_sum = (positive_sum_u128 / 1000000) as i64;
|
47
|
-
let negative_sum = (negative_sum_u128 / 1000000) as i64;
|
36
|
+
let mean_pos = if sum_weights_positive != 0 {
|
37
|
+
product_sum_positive / sum_weights_positive
|
38
|
+
} else {
|
39
|
+
0
|
40
|
+
};
|
41
|
+
let mean_neg = if sum_weights_negative != 0 {
|
42
|
+
(-product_sum_negative) / sum_weights_negative
|
43
|
+
} else {
|
44
|
+
0
|
45
|
+
};
|
48
46
|
|
49
|
-
let effective_denominator = if
|
50
|
-
|
47
|
+
let effective_denominator = if mean_neg >= OMEGA_LOSS_MINIMUM {
|
48
|
+
mean_neg
|
51
49
|
} else {
|
52
50
|
OMEGA_LOSS_MINIMUM
|
53
51
|
};
|
54
|
-
|
55
|
-
final_calc as i64
|
52
|
+
(mean_pos * RATIO_SCALE_FACTOR) / effective_denominator
|
56
53
|
} else {
|
57
|
-
let mut positive_sum:
|
58
|
-
let mut negative_sum:
|
54
|
+
let mut positive_sum: i64 = 0;
|
55
|
+
let mut negative_sum: i64 = 0;
|
56
|
+
let mut count_pos: u32 = 0;
|
57
|
+
let mut count_neg: u32 = 0;
|
59
58
|
|
60
59
|
for i in 0..ARRAY_SIZE {
|
61
60
|
if (i as u32) < actual_len {
|
62
61
|
if log_returns[i] > 0 {
|
63
|
-
positive_sum
|
62
|
+
positive_sum += log_returns[i];
|
63
|
+
count_pos += 1;
|
64
64
|
} else if log_returns[i] < 0 {
|
65
|
-
negative_sum
|
65
|
+
negative_sum += (-log_returns[i]);
|
66
|
+
count_neg += 1;
|
66
67
|
}
|
67
68
|
}
|
68
69
|
}
|
69
70
|
|
70
|
-
let
|
71
|
-
|
71
|
+
let mean_pos = if count_pos > 0 {
|
72
|
+
positive_sum / (count_pos as i64)
|
73
|
+
} else {
|
74
|
+
0
|
75
|
+
};
|
76
|
+
let mean_neg = if count_neg > 0 {
|
77
|
+
negative_sum / (count_neg as i64)
|
72
78
|
} else {
|
73
|
-
|
79
|
+
0
|
80
|
+
};
|
81
|
+
|
82
|
+
let effective_denominator = if mean_neg >= OMEGA_LOSS_MINIMUM {
|
83
|
+
mean_neg
|
84
|
+
} else {
|
85
|
+
OMEGA_LOSS_MINIMUM
|
74
86
|
};
|
75
|
-
(
|
87
|
+
(mean_pos * RATIO_SCALE_FACTOR) / effective_denominator
|
76
88
|
}
|
77
89
|
}
|
78
90
|
}
|
@@ -25,6 +25,8 @@ fn main(
|
|
25
25
|
use_weighting: bool,
|
26
26
|
bypass_confidence: pub bool,
|
27
27
|
account_size: i64,
|
28
|
+
weights: [i64; ARRAY_SIZE],
|
29
|
+
calmar_cap: i64,
|
28
30
|
) -> pub [Field; 9] {
|
29
31
|
// Verify all trading signals are included in the merkle tree
|
30
32
|
let mut all_verified = true;
|
@@ -51,7 +53,7 @@ fn main(
|
|
51
53
|
}
|
52
54
|
|
53
55
|
let weights = if use_weighting {
|
54
|
-
|
56
|
+
weights
|
55
57
|
} else {
|
56
58
|
// Equal weights when weighting is disabled
|
57
59
|
let mut equal_weights = [0; ARRAY_SIZE];
|
@@ -140,6 +142,7 @@ fn main(
|
|
140
142
|
avg_daily_return,
|
141
143
|
variance_val,
|
142
144
|
ann_excess_return_val,
|
145
|
+
calmar_cap,
|
143
146
|
);
|
144
147
|
let omega_ratio = omega(
|
145
148
|
returns_array,
|