Commit Graph

15 Commits

Author SHA1 Message Date
Jeff Emmett 38e14a52c6 feat: add 208 tests and 4 deep-dive notebooks for new modules
Tests cover risk_tranching (54), conviction (54), crosschain (54), and
cadCAD integration (46). All 558 tests pass. Notebooks provide interactive
explorations of risk tranches, cross-chain simulation, conviction governance,
and cadCAD Monte Carlo analysis. Includes parameter sweep results (405 sims).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 12:20:55 -07:00
Jeff Emmett 2b37f59755 fix: add apply_collateral_change for proper gain/loss rebalancing
The tranche system wasn't redistributing collateral appreciation back to
tranche buffers. Added apply_collateral_change() which routes gains through
_rebalance_collateral (rebuilds junior buffer first) and losses through
the existing waterfall.

Parameter sweep results (param_sweep_v2.csv) show:
- Low vol (30%): 96% of configs keep senior safe, optimal SR=1.2 MZ=1.35
- Med vol (60%): 89% safe, optimal SR=1.5 MZ=1.20
- High vol (90%): 19% safe, requires SR=1.8 minimum

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 12:15:12 -07:00
Jeff Emmett c48b7ae82a feat: add cadCAD simulation, risk tranches, cross-chain, and conviction governance
- Add risk_tranching.py: Senior/Mezzanine/Junior tranche system with yield
  waterfall, loss absorption, and liquidation mechanics
- Add conviction.py: Full conviction voting engine for parameter governance
  (ported from conviction/ research repo)
- Add crosschain/hub_spoke.py: 5-chain hub-spoke simulation with CCIP messaging,
  staking yield, and price shock modeling
- Add cadcad/ module: State definitions, 7 policy functions, 7 state update
  functions, pre-built scenarios (normal growth, stress test, parameter sweep)
- Add 4 dashboard tabs: Cross-Chain map, Risk Tranches, Governance, cadCAD Sim
- Wire cadCAD 0.5.3 with pandas/networkx/seaborn as new dependencies
- All 350 existing tests still pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 12:11:15 -07:00
Jeff Emmett e179587901 feat: add live parameter visualizations and basic/advanced view to System Config
Add 4 interactive charts that update as parameters change:
- P-AMM redemption curve showing rate vs fraction redeemed at various backing ratios
- Imbalance fee structure showing static-to-surge fee transition
- Flow dampening penalty multiplier curve
- Stakeholder outcome scenarios (early/mid/late redeemers + commitment caps)

Add basic/advanced view toggle:
- Basic: presets, P-AMM controls, fee controls, and all visualizations
- Advanced: adds surface geometry, commitment caps, flow_memory, and JSON export/import

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 15:50:38 -07:00
Jeff Emmett 33d09010f3 fix: correct DCA history keys in charts.py (effective_price, tokens_minted)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 15:43:16 -07:00
Jeff Emmett 20392e824f fix: set PYTHONPATH=/app in Dockerfile for dashboard imports
Streamlit adds the script directory to sys.path, not the working
directory, so dashboard/ wasn't importable as a package.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 15:38:31 -07:00
Jeff Emmett c080f8de74 fix: add missing dashboard/__init__.py for package import
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 15:35:39 -07:00
Jeff Emmett 688f82e024 fix: add Traefik priority to avoid rspace wildcard conflict
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 15:04:39 -07:00
Jeff Emmett d9dec8ba5b feat: add System Config tab, presets, JSON export/import, and Dockerize for simulate.rspace.online
- Add System Config tab with ~15 parameter sliders grouped in accordions
- Add 4 named presets (Conservative, Balanced, Aggressive, High-Risk)
- Add JSON config export/import for sharing configurations
- All tabs now read config from session_state instead of hardcoding
- Signal Router uses config's fee/flow params as base AdaptiveParams
- Multi-stage Dockerfile (Python 3.12-slim, non-root, healthcheck)
- docker-compose.yml with Traefik labels for simulate.rspace.online

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 14:55:14 -07:00
Jeff Emmett 1cb3701769 feat: add CLI, dashboard, notebook, and CRDT bridge (350 tests)
- CRDT bridge: multi-peer gossip network simulation wrapping all 6 merge functions
- CLI tool: argparse entry point with simulate, compare-dca, signal-routing, stress-test
- Notebook 06: DCA strategies, signal routing, CRDT lifecycle visualizations
- Streamlit dashboard: 5-tab interactive visualization (plotly, optional dep)
- pyproject.toml: added myco CLI entry point + dashboard optional-deps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 14:14:39 -07:00
Jeff Emmett e27d76d273 feat: add signal router, CRDT DCA schedules, and subscription/donation DCA (74 tests)
Three integration layers connecting the TWAP oracle and DCA executor
to the rest of the system:

- Signal Router: routes oracle volatility/deviation signals into
  adaptive params (flow threshold, PAMM curvature, surge fees)
- CRDT DCA Schedules: G-Set of chunks with monotone status lattice
  (pending→submitted→executed), composes with batch settlement
- Subscription/Donation DCA: recurring payments and one-time donations
  flow through the bonding curve via time-spread DCA chunks

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 12:28:18 -07:00
Jeff Emmett 7fd03463fd feat: add TWAP oracle + DCA execution engine (40 tests)
TWAP oracle primitive with ring buffer, cumulative accumulator,
VWAP, deviation signals, and realized volatility. DCA executor
composes oracle with MycoSystem for time-spread purchases with
fixed and TWAP-aware chunk sizing strategies. Oracle integration
is opt-in via MycoSystemConfig.twap_oracle_params.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 11:54:07 -07:00
Jeff Emmett 89b74049e8 feat: implement CRDT-native primitives layer (6 modules, 89 tests)
Add off-chain CRDT wrappers for DeFi primitives with per-peer tracking
and merge semantics (commutative, associative, idempotent). Enables most
MYCO operations to happen off-chain with only net positions settling
on-chain.

Modules: flow_dampening, labor_crdt, trust_pamm, credit_invariant,
intent_matching (CoW engine), batch_settlement (orchestrator).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 11:22:55 -07:00
Jeff Emmett 82ae7993ce docs: add CRDT-native primitives design — mapping DeFi to off-chain tokens
Maps Balancer, Gyroscope, and CoW Protocol primitives to the Automerge/BFT
CRDT token layer. Identifies flow dampening, CoW intent matching, labor
attestations, and LBP schedules as fully CRDT-native. Proposes batch
settlement architecture where CoW matching handles most trades off-chain
and only net positions settle on-chain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 10:33:29 -07:00
Jeff Emmett 9dce4e2855 feat: complete MYCO bonding surface system — math specs, simulations, and tests
N-dimensional ellipsoidal bonding surface for multi-asset token issuance,
combining Balancer/Gyroscope DeFi primitives with commitment-based minting
channels (labor, subscriptions, staking). 128 tests, 13 math specs,
5 Jupyter notebooks, composed system with scenario simulator.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-01 00:12:00 -07:00