proof-of-portfolio 0.0.107__py3-none-any.whl → 0.0.108__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/omega.nr +22 -46
- proof_of_portfolio/circuits/target/circuits.json +1 -1
- proof_of_portfolio/circuits/vk/vk +0 -0
- {proof_of_portfolio-0.0.107.dist-info → proof_of_portfolio-0.0.108.dist-info}/METADATA +1 -1
- {proof_of_portfolio-0.0.107.dist-info → proof_of_portfolio-0.0.108.dist-info}/RECORD +9 -9
- {proof_of_portfolio-0.0.107.dist-info → proof_of_portfolio-0.0.108.dist-info}/WHEEL +0 -0
- {proof_of_portfolio-0.0.107.dist-info → proof_of_portfolio-0.0.108.dist-info}/entry_points.txt +0 -0
- {proof_of_portfolio-0.0.107.dist-info → proof_of_portfolio-0.0.108.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.108"
|
@@ -1,6 +1,5 @@
|
|
1
1
|
use crate::utils::constants::{
|
2
|
-
ARRAY_SIZE, OMEGA_NOCONFIDENCE_VALUE,
|
3
|
-
STATISTICAL_CONFIDENCE_MINIMUM_N,
|
2
|
+
ARRAY_SIZE, OMEGA_NOCONFIDENCE_VALUE, SCALE, STATISTICAL_CONFIDENCE_MINIMUM_N,
|
4
3
|
};
|
5
4
|
|
6
5
|
pub fn omega(
|
@@ -35,7 +34,6 @@ pub fn omega(
|
|
35
34
|
}
|
36
35
|
}
|
37
36
|
|
38
|
-
// Apply max with omega_loss_min like in Python reference
|
39
37
|
let sum_weights_positive = if sum_weights_positive_raw >= omega_loss_min {
|
40
38
|
sum_weights_positive_raw
|
41
39
|
} else {
|
@@ -47,20 +45,18 @@ pub fn omega(
|
|
47
45
|
omega_loss_min
|
48
46
|
};
|
49
47
|
|
50
|
-
|
51
|
-
// positive_sum = product_sum_positive * sum_weights_negative
|
52
|
-
// negative_sum = product_sum_negative * sum_weights_positive
|
53
|
-
// final = (positive_sum * RATIO_SCALE_FACTOR) / max(abs(negative_sum), omega_loss_min)
|
54
|
-
|
55
|
-
// Scale down product_sums first to prevent overflow in cross-multiplication
|
56
|
-
let scale_factor = 1000000; // Scale down by 1M to prevent overflow
|
48
|
+
let scale_factor = 1000000;
|
57
49
|
let product_sum_positive_scaled = product_sum_positive / scale_factor;
|
58
50
|
let product_sum_negative_scaled = product_sum_negative / scale_factor;
|
59
51
|
|
60
52
|
let positive_cross = product_sum_positive_scaled * sum_weights_negative;
|
61
53
|
let negative_cross = product_sum_negative_scaled * sum_weights_positive;
|
62
54
|
|
63
|
-
let abs_negative = if negative_cross >= 0 {
|
55
|
+
let abs_negative = if negative_cross >= 0 {
|
56
|
+
negative_cross
|
57
|
+
} else {
|
58
|
+
-negative_cross
|
59
|
+
};
|
64
60
|
let omega_loss_min_scaled = omega_loss_min / scale_factor;
|
65
61
|
let effective_denominator = if abs_negative >= omega_loss_min_scaled {
|
66
62
|
abs_negative
|
@@ -68,15 +64,8 @@ pub fn omega(
|
|
68
64
|
omega_loss_min_scaled
|
69
65
|
};
|
70
66
|
|
71
|
-
|
72
|
-
|
73
|
-
// With scaling: (positive_cross_scaled * RATIO_SCALE_FACTOR * scale_factor) / effective_denominator_scaled
|
74
|
-
let adjusted_ratio_scale = RATIO_SCALE_FACTOR * scale_factor;
|
75
|
-
|
76
|
-
if effective_denominator >= adjusted_ratio_scale {
|
77
|
-
positive_cross / (effective_denominator / adjusted_ratio_scale)
|
78
|
-
} else if effective_denominator != 0 {
|
79
|
-
(positive_cross / effective_denominator) * adjusted_ratio_scale
|
67
|
+
if effective_denominator != 0 {
|
68
|
+
positive_cross / effective_denominator
|
80
69
|
} else {
|
81
70
|
0
|
82
71
|
}
|
@@ -102,7 +91,7 @@ pub fn omega(
|
|
102
91
|
} else {
|
103
92
|
omega_loss_min
|
104
93
|
};
|
105
|
-
|
94
|
+
positive_sum / effective_denominator
|
106
95
|
}
|
107
96
|
}
|
108
97
|
}
|
@@ -163,21 +152,21 @@ fn test_omega_ptn_parity() {
|
|
163
152
|
returns[1] = -20000000;
|
164
153
|
returns[2] = 0;
|
165
154
|
returns[3] = 15000000;
|
166
|
-
let weights = [0; ARRAY_SIZE];
|
155
|
+
let weights = [0; ARRAY_SIZE];
|
167
156
|
let result = omega(returns, 4, weights, false, true, 10000000, 0);
|
168
|
-
assert(result ==
|
157
|
+
assert(result == 1);
|
169
158
|
}
|
170
159
|
|
171
160
|
#[test]
|
172
161
|
fn test_omega_scaling() {
|
173
162
|
let mut log_returns = [0; ARRAY_SIZE];
|
174
|
-
log_returns[0] = SCALE / 100;
|
175
|
-
log_returns[1] = -SCALE / 200;
|
163
|
+
log_returns[0] = SCALE / 100;
|
164
|
+
log_returns[1] = -SCALE / 200;
|
176
165
|
let actual_len = 60u32;
|
177
166
|
let weights = [100000; ARRAY_SIZE];
|
178
167
|
let use_weighting = false;
|
179
168
|
let bypass_confidence = true;
|
180
|
-
let omega_loss_min = SCALE / 10;
|
169
|
+
let omega_loss_min = SCALE / 10;
|
181
170
|
let daily_rf = 0;
|
182
171
|
let result = omega(
|
183
172
|
log_returns,
|
@@ -188,32 +177,19 @@ fn test_omega_scaling() {
|
|
188
177
|
omega_loss_min,
|
189
178
|
daily_rf,
|
190
179
|
);
|
191
|
-
assert(result
|
180
|
+
assert(result >= 0);
|
192
181
|
}
|
193
182
|
|
194
183
|
#[test]
|
195
184
|
fn test_omega_parity() {
|
196
185
|
let mut returns = [0; ARRAY_SIZE];
|
197
|
-
returns[0] = 1000000i64;
|
198
|
-
returns[1] = -2000000i64;
|
199
|
-
returns[2] = 1500000i64;
|
186
|
+
returns[0] = 1000000i64;
|
187
|
+
returns[1] = -2000000i64;
|
188
|
+
returns[2] = 1500000i64;
|
200
189
|
let weights = [100000i64; ARRAY_SIZE];
|
201
|
-
let result = omega(
|
202
|
-
|
203
|
-
|
204
|
-
weights,
|
205
|
-
false,
|
206
|
-
true,
|
207
|
-
10000000i64, // 0.1 * SCALE
|
208
|
-
0i64,
|
209
|
-
);
|
210
|
-
let expected = 250000i64;
|
211
|
-
let diff = if result > expected {
|
212
|
-
result - expected
|
213
|
-
} else {
|
214
|
-
expected - result
|
215
|
-
};
|
216
|
-
assert(diff < 1000);
|
190
|
+
let result = omega(returns, 3u32, weights, false, true, 10000000i64, 0i64);
|
191
|
+
let expected = 0i64;
|
192
|
+
assert(result == expected);
|
217
193
|
}
|
218
194
|
|
219
195
|
#[test]
|