proof-of-portfolio 0.0.93__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 +8 -5
- proof_of_portfolio/circuits/components/src/core/omega.nr +36 -24
- proof_of_portfolio/circuits/src/main.nr +2 -0
- proof_of_portfolio/circuits/target/circuits.json +1 -1
- proof_of_portfolio/circuits/vk/vk +0 -0
- proof_of_portfolio/proof_generator.py +4 -1
- {proof_of_portfolio-0.0.93.dist-info → proof_of_portfolio-0.0.94.dist-info}/METADATA +1 -1
- {proof_of_portfolio-0.0.93.dist-info → proof_of_portfolio-0.0.94.dist-info}/RECORD +12 -12
- {proof_of_portfolio-0.0.93.dist-info → proof_of_portfolio-0.0.94.dist-info}/WHEEL +0 -0
- {proof_of_portfolio-0.0.93.dist-info → proof_of_portfolio-0.0.94.dist-info}/entry_points.txt +0 -0
- {proof_of_portfolio-0.0.93.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
|
@@ -29,13 +30,11 @@ pub fn calmar(
|
|
29
30
|
if drawdown_normalization_factor == 0 {
|
30
31
|
0
|
31
32
|
} else {
|
32
|
-
let raw_calmar = (
|
33
|
-
* RATIO_SCALE_FACTOR;
|
34
|
-
let calmar_cap = 10 * RATIO_SCALE_FACTOR;
|
33
|
+
let raw_calmar = (base_return_percentage * drawdown_normalization_factor) / SCALE;
|
35
34
|
if raw_calmar > calmar_cap {
|
36
|
-
calmar_cap
|
35
|
+
calmar_cap * RATIO_SCALE_FACTOR
|
37
36
|
} else {
|
38
|
-
raw_calmar
|
37
|
+
raw_calmar * RATIO_SCALE_FACTOR
|
39
38
|
}
|
40
39
|
}
|
41
40
|
}
|
@@ -67,6 +66,7 @@ fn test_calmar_normal_case() {
|
|
67
66
|
avg,
|
68
67
|
variance_val,
|
69
68
|
ann_excess,
|
69
|
+
1,
|
70
70
|
);
|
71
71
|
assert(result != 0);
|
72
72
|
}
|
@@ -91,6 +91,7 @@ fn test_calmar_insufficient_data() {
|
|
91
91
|
avg,
|
92
92
|
variance_val,
|
93
93
|
ann_excess,
|
94
|
+
1,
|
94
95
|
);
|
95
96
|
assert(result == 0);
|
96
97
|
}
|
@@ -116,6 +117,7 @@ fn test_calmar_exactly_30_days() {
|
|
116
117
|
avg,
|
117
118
|
variance_val,
|
118
119
|
ann_excess,
|
120
|
+
1,
|
119
121
|
);
|
120
122
|
assert(result != 0);
|
121
123
|
}
|
@@ -141,6 +143,7 @@ fn test_calmar_negative_returns() {
|
|
141
143
|
avg,
|
142
144
|
variance_val,
|
143
145
|
ann_excess,
|
146
|
+
1,
|
144
147
|
);
|
145
148
|
assert(result != 0);
|
146
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
|
}
|
@@ -26,6 +26,7 @@ fn main(
|
|
26
26
|
bypass_confidence: pub bool,
|
27
27
|
account_size: i64,
|
28
28
|
weights: [i64; ARRAY_SIZE],
|
29
|
+
calmar_cap: i64,
|
29
30
|
) -> pub [Field; 9] {
|
30
31
|
// Verify all trading signals are included in the merkle tree
|
31
32
|
let mut all_verified = true;
|
@@ -141,6 +142,7 @@ fn main(
|
|
141
142
|
avg_daily_return,
|
142
143
|
variance_val,
|
143
144
|
ann_excess_return_val,
|
145
|
+
calmar_cap,
|
144
146
|
);
|
145
147
|
let omega_ratio = omega(
|
146
148
|
returns_array,
|