Case Study — YieldSphere

Capital Allocation Optimization Engine

Reducing Gas and Slippage Costs by 22% While Improving Risk-Adjusted Yield

$7.2M annual value through protocol-level capital allocation optimization across a $143M portfolio

Industry

Institutional DeFi / Digital Asset Management

Timeline

12 weeks

Team

5 engineers

Tech

The Graph + ML + Ethers.js

The Challenge

An institutional DeFi portfolio allocating capital across 30+ protocols was rebalancing on a fixed weekly schedule regardless of actual opportunity, and sizing every reallocation using the same rule-of-thumb regardless of pool liquidity depth. Variable gas costs, slippage, and protocol-specific liquidity conditions across the portfolio made uniform rebalancing both wasteful and value-destroying — some reallocations cost more in gas and slippage than the yield improvement they captured.

Our Approach

How We Solved It

01

Protocol and Pool Liquidity Mapping

Combined historical TVL data, pool depth analysis, and on-chain liquidity concentration data to produce a per-pool execution-cost model covering all 30+ protocols — the precision foundation for every allocation decision.

02

Event-Driven Reallocation Sizing

ML models generate per-pool reallocation sizing recommendations that weigh forecast yield improvement against gas cost and expected slippage for that specific position size — replacing fixed weekly rebalancing with opportunity-triggered sizing.

03

Execution Route Optimization

Generated execution plans routing each reallocation through the lowest-cost path (direct pool interaction vs. aggregator vs. cross-chain bridge), enabling the execution engine to minimize total cost per reallocation automatically.

04

Execution Monitoring & Outcome Tracking

On-chain execution data is collected post-transaction and compared against the sizing model's cost estimate, with realized-yield comparison closing the feedback loop and improving next-cycle sizing models.

Engineering Process

How We Built It

On-Chain Data Processing Pipeline

Built an indexing pipeline that ingests, normalizes, and reconciles pool state and liquidity data from The Graph and direct RPC calls into a consistent internal representation for model input.

Protocol Clustering by Execution Profile

Clustering on liquidity depth and historical slippage data identifies protocols with stable execution-cost profiles — stable clusters receive consistent sizing heuristics across cycles, reducing model variance without sacrificing accuracy.

Execution Plan Generation

Execution-route generation handles routing differences across 4 different aggregator and bridge integrations without manual conversion steps by the portfolio operations team.

Architecture Decisions

Key Technical Choices

Position-Level Sizing Over Portfolio-Average Rebalancing

Portfolio-average rebalancing is simpler to reason about but practically leaves value on the table given real per-pool liquidity constraints. Position-level sizing required more compute but was measurably more capital-efficient.

Risk-Review-in-the-Loop for Large Reallocations

Reallocations above a configurable size threshold are reviewed and approved by the risk desk before execution rather than auto-submitted. The review step surfaces model errors before they affect a meaningful share of the $143M portfolio.

Simulation-Before-Execution for Every Reallocation

Every reallocation is simulated against current on-chain state immediately before submission, so execution reflects current liquidity and gas conditions rather than the conditions at model-generation time.

Results

What We Delivered

22%
Gas & Slippage Cost Reduction
$143M
Portfolio Under Optimization
Zero
Value-Destroying Reallocations
$7.2M
Annual Value Captured

Solution Blueprint

How It All Fits Together

On-Chain Intelligence Layer
  • Per-pool liquidity and execution-cost models
  • TVL & liquidity data fusion
  • The Graph indexing pipeline
Optimization Engine
  • Event-driven sizing models
  • Protocol clustering by execution profile
  • Cycle-over-cycle learning
Execution Layer
  • Multi-route execution planning
  • Pre-execution simulation
  • Realized-outcome feedback loop

Lessons Learned

What We Improved

01

Risk Desk Trust Unlocks Automation

The risk desk wouldn't approve automated reallocation above the review threshold until the sizing model was validated against a full quarter of shadow-mode recommendations. The pilot quarter was about trust, not optimization.

02

Execution Route Compatibility Is an Early Discovery Item

Of the 6 aggregator and bridge integrations evaluated, 2 had non-standard slippage-reporting behavior. Discovering this in week 2 rather than week 10 saved the project timeline.

03

Cost Reduction and Yield Protection Are Separate Models

The first version optimized purely for gas and slippage cost and reduced realized yield in a subset of reallocations. Separating the yield-protection constraint from the cost-optimization objective resolved the conflict.

Work With Halkwinds

Build Something Exceptional

Partner with the team that built YieldSphere.

View Platform