proof-of-portfolio 0.0.53__py3-none-any.whl → 0.0.55__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.53"
2
+ __version__ = "0.0.55"
@@ -3,7 +3,6 @@ import toml
3
3
  import re
4
4
  import os
5
5
  import time
6
- from .min_metrics import MinMetrics
7
6
  import math
8
7
  import bittensor as bt
9
8
 
@@ -358,27 +357,60 @@ def generate_proof(
358
357
  bt.logging.info("Preparing circuit inputs...")
359
358
 
360
359
  cps = perf_ledger["cps"]
361
- checkpoint_count = len(cps)
362
- if checkpoint_count > MAX_CHECKPOINTS:
360
+ if len(cps) > MAX_CHECKPOINTS:
363
361
  if verbose:
364
362
  bt.logging.warning(
365
- f"Warning: Miner has {checkpoint_count} checkpoints, but circuit only supports {MAX_CHECKPOINTS}. Truncating."
363
+ f"Warning: Miner has {len(cps)} checkpoints, but circuit only supports {MAX_CHECKPOINTS}. Truncating."
366
364
  )
367
365
  cps = cps[:MAX_CHECKPOINTS]
368
- checkpoint_count = MAX_CHECKPOINTS
366
+
367
+ target_duration = perf_ledger["target_cp_duration_ms"]
369
368
 
370
369
  gains = [int(c["gain"] * SCALING_FACTOR) for c in cps]
371
370
  losses = [int(c["loss"] * SCALING_FACTOR) for c in cps]
372
371
  last_update_times = [c["last_update_ms"] for c in cps]
373
372
  accum_times = [c["accum_ms"] for c in cps]
374
- target_duration = perf_ledger["target_cp_duration_ms"]
373
+ checkpoint_count = len(cps)
375
374
 
376
- # Pad
377
375
  gains += [0] * (MAX_CHECKPOINTS - len(gains))
378
376
  losses += [0] * (MAX_CHECKPOINTS - len(losses))
379
377
  last_update_times += [0] * (MAX_CHECKPOINTS - len(last_update_times))
380
378
  accum_times += [0] * (MAX_CHECKPOINTS - len(accum_times))
381
379
 
380
+ daily_log_returns = aggregate_daily_returns(cps, target_duration, daily_checkpoints)
381
+ aggregated_gains = []
382
+ aggregated_losses = []
383
+ aggregated_last_update_times = []
384
+ aggregated_accum_times = []
385
+
386
+ for i, daily_return in enumerate(daily_log_returns):
387
+ if daily_return >= 0:
388
+ aggregated_gains.append(int(daily_return * SCALING_FACTOR))
389
+ aggregated_losses.append(0)
390
+ else:
391
+ aggregated_gains.append(0)
392
+ aggregated_losses.append(int(daily_return * SCALING_FACTOR))
393
+
394
+ aggregated_last_update_times.append(target_duration + (i * target_duration))
395
+ aggregated_accum_times.append(target_duration)
396
+
397
+ aggregated_checkpoint_count = len(daily_log_returns)
398
+
399
+ aggregated_gains += [0] * (MAX_CHECKPOINTS - len(aggregated_gains))
400
+ aggregated_losses += [0] * (MAX_CHECKPOINTS - len(aggregated_losses))
401
+ aggregated_last_update_times += [0] * (
402
+ MAX_CHECKPOINTS - len(aggregated_last_update_times)
403
+ )
404
+ aggregated_accum_times += [0] * (MAX_CHECKPOINTS - len(aggregated_accum_times))
405
+
406
+ if verbose:
407
+ bt.logging.info(
408
+ f"Processing {checkpoint_count} raw checkpoints for merkle roots"
409
+ )
410
+ bt.logging.info(
411
+ f"Using {aggregated_checkpoint_count} aggregated daily returns for metrics"
412
+ )
413
+
382
414
  all_orders = []
383
415
  for pos in positions:
384
416
  all_orders.extend(pos["orders"])
@@ -439,7 +471,7 @@ def generate_proof(
439
471
 
440
472
  if verbose:
441
473
  bt.logging.info(
442
- f"Prepared {checkpoint_count} checkpoints and {signals_count} signals."
474
+ f"Prepared {aggregated_checkpoint_count} aggregated daily returns and {signals_count} signals for circuit."
443
475
  )
444
476
 
445
477
  if verbose:
@@ -538,11 +570,11 @@ def generate_proof(
538
570
 
539
571
  # Finally, LFG
540
572
  main_prover_input = {
541
- "gains": [str(g) for g in gains],
542
- "losses": [str(l) for l in losses],
543
- "last_update_times": [str(t) for t in last_update_times],
544
- "accum_times": [str(a) for a in accum_times],
545
- "checkpoint_count": str(checkpoint_count),
573
+ "gains": [str(g) for g in aggregated_gains],
574
+ "losses": [str(l) for l in aggregated_losses],
575
+ "last_update_times": [str(t) for t in aggregated_last_update_times],
576
+ "accum_times": [str(a) for a in aggregated_accum_times],
577
+ "checkpoint_count": str(aggregated_checkpoint_count),
546
578
  "target_duration": str(target_duration),
547
579
  "signals": signals,
548
580
  "signals_count": str(signals_count),
@@ -644,39 +676,6 @@ def generate_proof(
644
676
 
645
677
  prove_time, verification_success = run_bb_prove(main_circuit_dir)
646
678
 
647
- # Calculate MinMetrics (Python) for comparison with ZK circuit
648
- try:
649
- daily_log_returns = aggregate_daily_returns(
650
- cps, target_duration, daily_checkpoints
651
- )
652
-
653
- if len(daily_log_returns) > 0:
654
- python_avg_daily_pnl = MinMetrics.average(daily_log_returns)
655
- python_sharpe = MinMetrics.sharpe(daily_log_returns, bypass_confidence=True)
656
- python_max_drawdown = MinMetrics.daily_max_drawdown(daily_log_returns)
657
- python_calmar = MinMetrics.calmar(daily_log_returns, bypass_confidence=True)
658
- python_omega = MinMetrics.omega(daily_log_returns, bypass_confidence=True)
659
- python_sortino = MinMetrics.sortino(
660
- daily_log_returns, bypass_confidence=True
661
- )
662
- python_stat_confidence = MinMetrics.statistical_confidence(
663
- daily_log_returns, bypass_confidence=True
664
- )
665
- else:
666
- python_avg_daily_pnl = python_sharpe = python_max_drawdown = (
667
- python_calmar
668
- ) = python_omega = python_sortino = python_stat_confidence = 0.0
669
-
670
- except Exception as e:
671
- if verbose:
672
- print(f"Warning: Could not calculate Python MinMetrics: {e}")
673
- import traceback
674
-
675
- print(f"Traceback: {traceback.format_exc()}")
676
- python_avg_daily_pnl = python_sharpe = python_max_drawdown = python_calmar = (
677
- python_omega
678
- ) = python_sortino = python_stat_confidence = "N/A"
679
-
680
679
  # Always print key production info: hotkey and verification status
681
680
  print(f"Hotkey: {miner_hotkey}")
682
681
  print(f"Orders processed: {signals_count}")
@@ -690,38 +689,6 @@ def generate_proof(
690
689
  print(f"Sortino Ratio: {sortino_ratio_scaled:.9f}")
691
690
  print(f"Statistical Confidence: {stat_confidence_scaled:.9f}")
692
691
 
693
- # Print Python MinMetrics for comparison
694
- print("\n--- PYTHON MINMETRICS ---")
695
- if isinstance(python_avg_daily_pnl, (int, float)):
696
- print(f"Average Daily PnL: {python_avg_daily_pnl:.9f}")
697
- else:
698
- print(f"Average Daily PnL: {python_avg_daily_pnl}")
699
- if isinstance(python_sharpe, (int, float)):
700
- print(f"Sharpe Ratio: {python_sharpe:.9f}")
701
- else:
702
- print(f"Sharpe Ratio: {python_sharpe}")
703
- if isinstance(python_max_drawdown, (int, float)):
704
- print(
705
- f"Max Drawdown: {python_max_drawdown:.9f} ({python_max_drawdown * 100:.6f}%)"
706
- )
707
- else:
708
- print(f"Max Drawdown: {python_max_drawdown}")
709
- if isinstance(python_calmar, (int, float)):
710
- print(f"Calmar Ratio: {python_calmar:.9f}")
711
- else:
712
- print(f"Calmar Ratio: {python_calmar}")
713
- if isinstance(python_omega, (int, float)):
714
- print(f"Omega Ratio: {python_omega:.9f}")
715
- else:
716
- print(f"Omega Ratio: {python_omega}")
717
- if isinstance(python_sortino, (int, float)):
718
- print(f"Sortino Ratio: {python_sortino:.9f}")
719
- else:
720
- print(f"Sortino Ratio: {python_sortino}")
721
- if isinstance(python_stat_confidence, (int, float)):
722
- print(f"Statistical Confidence: {python_stat_confidence:.9f}")
723
- else:
724
- print(f"Statistical Confidence: {python_stat_confidence}")
725
692
  if prove_time is not None:
726
693
  print(f"Proof generated in {prove_time}s")
727
694
  else:
@@ -733,26 +700,8 @@ def generate_proof(
733
700
  print(f"Signals Merkle Root: {signals_merkle_root}")
734
701
  print(f"Returns Merkle Root: {returns_merkle_root}")
735
702
 
736
- print("\n=== PORTFOLIO METRICS ===")
737
- print(f"Average Daily PnL (raw): {avg_daily_pnl_value}")
738
- print(f"Average Daily PnL (scaled): {avg_daily_pnl_scaled:.9f}")
739
- print(f"Sharpe Ratio (raw): {sharpe_ratio_raw}")
740
- print(f"Sharpe Ratio (scaled): {sharpe_ratio_scaled:.9f}")
741
- print(f"Max Drawdown (raw): {max_drawdown_raw}")
742
- print(
743
- f"Max Drawdown (scaled): {max_drawdown_scaled:.9f} ({max_drawdown_scaled * 100:.6f}%)"
744
- )
745
- print(f"Calmar Ratio (raw): {calmar_ratio_raw}")
746
- print(f"Calmar Ratio (scaled): {calmar_ratio_scaled:.9f}")
747
- print(f"Omega Ratio (raw): {omega_ratio_raw}")
748
- print(f"Omega Ratio (scaled): {omega_ratio_scaled:.9f}")
749
- print(f"Sortino Ratio (raw): {sortino_ratio_raw}")
750
- print(f"Sortino Ratio (scaled): {sortino_ratio_scaled:.9f}")
751
- print(f"Statistical Confidence (raw): {stat_confidence_raw}")
752
- print(f"Statistical Confidence (scaled): {stat_confidence_scaled:.9f}")
753
-
754
703
  print("\n=== DATA SUMMARY ===")
755
- print(f"Checkpoints processed: {checkpoint_count}")
704
+ print(f"Daily returns processed: {aggregated_checkpoint_count}")
756
705
  print(f"Trading signals processed: {signals_count}")
757
706
  print(f"Valid daily returns: {valid_days}")
758
707
 
@@ -790,7 +739,7 @@ def generate_proof(
790
739
  "stat_confidence_scaled": stat_confidence_scaled,
791
740
  },
792
741
  "data_summary": {
793
- "checkpoints_processed": checkpoint_count,
742
+ "daily_returns_processed": aggregated_checkpoint_count,
794
743
  "signals_processed": signals_count,
795
744
  "valid_daily_returns": int(valid_days),
796
745
  },
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: proof-of-portfolio
3
- Version: 0.0.53
3
+ Version: 0.0.55
4
4
  Summary: Zero-Knowledge Proof framework for verifiable, private portfolio performance metrics
5
5
  Author-email: "Inference Labs, Inc." <info@inferencelabs.com>
6
6
  Requires-Python: >=3.10
@@ -1,12 +1,12 @@
1
1
  proof_of_portfolio/__init__.py,sha256=YTYX7P0aBNCoRyG_wEX5fTQBMIjF1S4-1VpFqNRWsfQ,4587
2
- proof_of_portfolio/_version.py,sha256=YcFzjGDHxJt8m7qeesJgKY3B2yez5bvyOOZTQnIhjXI,66
2
+ proof_of_portfolio/_version.py,sha256=Cvic-e5bQyn9XJHe3xvdpZm4cj128CGRoCnVPDXG_wY,66
3
3
  proof_of_portfolio/analyze_data.py,sha256=t80ueFtBUzcWTrPiamiC1HXvw5Em-151zXJx0cCk8sQ,3709
4
4
  proof_of_portfolio/main.py,sha256=JbvdAK7B6hw2sQdjT0EVCiglCQZgN3urKphdeWcW43w,30994
5
5
  proof_of_portfolio/min_metrics.py,sha256=U16B7YRl0UbCterdJ1ksqFOxR5DiQeslUzMVGEWNyog,13211
6
6
  proof_of_portfolio/miner.py,sha256=eGXcPMRQVAepzXJj1ePbbDAf-72E9Yj9n-yfP7GohLw,17177
7
7
  proof_of_portfolio/parsing_utils.py,sha256=Hx61Sby5mEbC6uzhG9G69K7YPCLbjU6vK8fazpNBeLc,6463
8
8
  proof_of_portfolio/post_install.py,sha256=e-57Z_h-svQdjA8ibsM985MXmdV6-KLyymQm3Cgu8YM,5654
9
- proof_of_portfolio/proof_generator.py,sha256=zvk0XloDM1T4hhAZDranRx1Pei7lQLKUTLa4W6yultA,29738
9
+ proof_of_portfolio/proof_generator.py,sha256=0eoGlG2SHdLlbuK2Hw4hz8eR_qSdcrJFEEjFQgBnVkk,27231
10
10
  proof_of_portfolio/signal_processor.py,sha256=JQjnkMJEbv_MWIgKNrjKjrBIcIT5pAkAlCneEOGsqT0,6702
11
11
  proof_of_portfolio/validator.py,sha256=kt3BeaXOffv-h52PZBKV1YHUWtiGsnPte16m3EJpITY,3839
12
12
  proof_of_portfolio/circuits/Nargo.toml,sha256=D6ycN7H3xiTcWHH5wz4qXYTXn7Ht0WgPr9w4B7d8ZGw,141
@@ -81,8 +81,8 @@ proof_of_portfolio/tree_generator/Nargo.toml,sha256=O6iSvb-EpV0XcETiDxNgSp7XKNiY
81
81
  proof_of_portfolio/tree_generator/target.gz,sha256=7LPzAb8JvKWSDOzyW5vI_6NKQ0aB9cb31q4CWbchFSw,308614
82
82
  proof_of_portfolio/tree_generator/src/main.nr,sha256=zHG_0OphqSROyeVc7yTSEULg4bYS8B-LsmvTzTl8aW4,2393
83
83
  proof_of_portfolio/tree_generator/target/tree_generator.json,sha256=M_bI5et5ncgILJ_Czen4ZsGfWHwComEVxMLQpIWmN1k,1540889
84
- proof_of_portfolio-0.0.53.dist-info/METADATA,sha256=QPycRxpkz-gTqp4u9h9JcQ4AMQoOT949oeHY6EJViJ4,7076
85
- proof_of_portfolio-0.0.53.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
86
- proof_of_portfolio-0.0.53.dist-info/entry_points.txt,sha256=KeLSJT_UJtr1WiLTkhlGqWQuPKbO_ylgj6OXOC2gJV4,53
87
- proof_of_portfolio-0.0.53.dist-info/top_level.txt,sha256=sY5xZnE6YuiISK1IuRHPfl71NV0vXO3N3YA2li_SPXU,19
88
- proof_of_portfolio-0.0.53.dist-info/RECORD,,
84
+ proof_of_portfolio-0.0.55.dist-info/METADATA,sha256=zQsjfIg3eeRNGuz1di8_mHX22JuX6WafkBJItemyf44,7076
85
+ proof_of_portfolio-0.0.55.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
86
+ proof_of_portfolio-0.0.55.dist-info/entry_points.txt,sha256=KeLSJT_UJtr1WiLTkhlGqWQuPKbO_ylgj6OXOC2gJV4,53
87
+ proof_of_portfolio-0.0.55.dist-info/top_level.txt,sha256=sY5xZnE6YuiISK1IuRHPfl71NV0vXO3N3YA2li_SPXU,19
88
+ proof_of_portfolio-0.0.55.dist-info/RECORD,,