Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

Optimization Engine

The optimization engine implements a linear programming solution for multi-chain portfolio optimization. It maximizes yield while accounting for bridge costs, swap slippage, and funding constraints across multiple blockchain networks.

Pulse Portfolio Optimizer

Intelligent Data Collection Engine

Real-Time Market Intelligence - Pulse continuously monitors Pendle's ecosystem through automated data collection:

  • Active Market Discovery: Automatically identifies new markets as they launch on Arbitrum
  • APY Tracking: Real-time monitoring of yield rates with historical trend analysis
  • Liquidity Assessment: Evaluating market depth and swap capacity
  • Expiration Management: Tracking time-to-maturity for all positions

Price Feeds - The system aggregates pricing data on Arbitrum for accurate market opportunity assessment.

Transaction Cost Analysis - Dynamic gas fee calculation and optimization for efficient operations on Arbitrum.

Advanced Optimization Engine

Linear Programming Core - At the heart of Pulse lies a sophisticated optimization engine that solves for maximum portfolio yield while respecting real-world constraints.

Multi-Variable Optimization - The system optimizes across key dimensions:

  • Portfolio Allocation: How much to invest in each market
  • Transaction Efficiency: Minimizing gas costs and slippage
  • Yield Maximization: Capturing highest risk-adjusted returns on Arbitrum

Constraint Management - The optimizer respects practical limitations:

  • Available balance on Arbitrum
  • Market liquidity limits
  • Time-to-maturity requirements (markets expiring within 7 days are excluded)
  • Gas cost thresholds
  • Slippage protection

Dynamic Cost Integration - Gas costs and transaction fees are factored into yield calculations based on market expiry dates and position sizes.

Intelligent Execution Planning

Portfolio Analysis - Before any action, Pulse analyzes the current portfolio state:

  • Current allocations vs. optimal targets
  • Available base tokens on Arbitrum
  • Positions requiring liquidation or adjustment

Action Sequencing - The planner converts optimization results into executable transaction sequences:

Liquidation Phase
  • Identifies overallocated positions
  • Plans orderly exit from expiring or underperforming markets
  • Updates available balance tracking for subsequent operations
Acquisition Phase
  • Determines optimal funding for new positions
  • Sequences swaps to acquire target PT positions on Arbitrum
Risk Management Integration
  • Dust amount handling to avoid uneconomical transactions
  • Slippage protection throughout execution

Portfolio Construction and Management

Intelligent Diversification Strategy

Pulse operates on a sophisticated portfolio construction philosophy that goes beyond simply identifying the single highest-yielding market. Rather than concentrating all funds in one opportunity, the optimizer actively constructs diversified portfolios when liquidity constraints or risk factors make concentration suboptimal. This approach recognizes that real markets have capacity limits - attempting to deploy large amounts into a single high-yield market often results in significant slippage that erodes the theoretical yield advantage.

Liquidity-Aware Allocation

The system uses advanced piecewise linear approximation to model how yields degrade as position sizes increase within individual markets. By testing multiple allocation amounts during optimization, Pulse builds accurate cost curves that capture the reality of diminishing returns in PT markets. When the optimizer detects that a large allocation to a single market would push beyond optimal liquidity thresholds, it automatically constructs a diversified portfolio across multiple markets, balancing higher base yields against the improved execution efficiency of smaller position sizes.

Efficient Fund Management

Portfolio construction focuses on optimal fund utilization within Arbitrum's ecosystem. Pulse evaluates the most efficient ways to deploy available ETH across different PT markets, considering transaction costs, market liquidity, and yield opportunities to maximize returns while minimizing operational overhead.

Dynamic Position Sizing

The optimizer continuously recalculates optimal position sizes based on current market conditions, available liquidity, and funding constraints. This dynamic approach means portfolios adapt to market reality rather than following rigid allocation rules. If a previously attractive market shows signs of liquidity stress or rising slippage, Pulse automatically reduces allocation to that market while identifying alternative opportunities that can absorb the redirected capital efficiently.

Automated Risk Management

Pulse incorporates comprehensive risk management throughout the optimization process. Market filtering automatically excludes unsuitable opportunities such as markets expiring within the minimum time-to-maturity threshold, assets outside supported categories (ETH-based), and markets with insufficient liquidity or excessive slippage that would eliminate yield advantages.

The system includes protective mechanisms to prevent value destruction through performance-based reallocation permissions, minimum APY improvement thresholds, and portfolio value protection during market volatility. The optimizer maintains focus on profitable opportunities while ensuring efficient operations on Arbitrum.

Optimization Variables

The solver uses four variable types:

  • Allocation Variables: Total allocation per market (target positions)
  • Funding Variables: Amount funded from each chain to each market
  • Interpolation Variables: Piecewise linear interpolation weights for cost curves
  • Yield Variables: Expected yield from each funding source

Objective Function

Maximizes total expected yield across all funding sources, where each yield variable represents the expected annual return from allocating funds from a specific chain to a specific market.

Constraint System

  • Total Allocation Constraint: Sum of allocations plus cash position equals total portfolio value
  • Funding Balance: For each market, total funding from all chains equals target allocation
  • Chain Capacity: For each chain, total funding to all markets cannot exceed available balance
  • Piecewise Linear Constraints: Link funding amounts to yield through interpolation

Bridge Cost Integration

Piecewise Linear Approximation

Bridge Rate Computation: Tests bridge costs across 20 different amounts to build cost curves. This captures the non-linear nature of bridge fees where small amounts have high percentage costs and large amounts may hit liquidity limits.

Cost Curve Construction

Cost Curve Construction: Creates logarithmic piecewise approximations for each market-funding source combination. Uses logarithmic scaling to ensure more precision at lower amounts to encourage diversification

Dynamic APY Calculation

Dynamic APY Calculation: Calculates the true APY after accounting for:

  • Base market APY from Pendle
  • Swap slippage and price impact
  • Bridge costs annualized based on market time-to-maturity. The price of the bridge is considered amortized over the life of the token

Market Filtering and Selection

Multi-Criteria Filtering

Multi-Criteria Filtering: Applies several filters in sequence:

  • Asset type matching using agent filter keywords
  • Time-to-maturity constraints (excludes markets expiring within MIN_TTM_DAYS)

Liquidation Logic

Markets not in the target set are forced to zero allocation, creating liquidation transactions for expiring or undesirable positions.

Optimization Process

Problem Construction

Problem Construction: The main optimization process:

  1. Validates inputs and extracts available chains
  2. Precomputes bridge rates for all chain pairs
  3. Builds piecewise cost curves for all market-funding combinations
  4. Constructs the linear programming problem with variables and constraints
  5. Solves using linear programming solver
  6. Extracts and analyzes results

Variable Scaling

All monetary amounts are scaled appropriately to prevent floating-point precision issues in the linear programming solver. This is critical for maintaining accuracy across large token amounts.

Bridge Fee Calculation

Bridge Fee Calculation: Queries Stargate API for transfer costs between chain pairs. Takes source/destination chains, tokens, amount, and slippage parameters. Returns absolute fee amount in source token units.

Route Selection: Selects optimal route from available options by:

  • Filtering out routes with errors
  • Selecting route with maximum destination amount (lowest effective cost)
  • Returning None if no valid routes exist