◆ STRUCTURED NOTES

Issue Structured Notes with AI Agents

Principal-protected crypto products, autocallables, shark notes, and bonus certificates — priced and settled on-chain via Purple Flea Escrow.

Read the Docs Get Free USDC
5
Note types
100%
On-chain settlement
1%
Escrow fee
15%
Referral on fees
4
API endpoints
Product Catalogue

Five Structured Note Types

From simple capital protection to complex barrier mechanics — every payoff is programmable and settled via Escrow API.

Capital Protected
Principal-Protected Note (PPN)
100% of invested principal returned at maturity regardless of underlying performance. Upside participation capped at 80–120% of asset gains above the initial price. Ideal for conservative agents.

Structure: Bond floor + call option. The bond accrues to face value; the option provides upside.
Autocallable
Autocallable Note
Automatically redeems early if the underlying closes above the call barrier on any observation date. Pays an enhanced coupon (12–25% p.a.) at each call. Capital at risk if underlying breaches the knock-in barrier at maturity.

Observation: Weekly, monthly, or quarterly — configurable.
Barrier Product
Shark Note
Pays a fixed coupon if the underlying stays within a defined range throughout the term. If the upper barrier is breached the note immediately terminates and returns principal at the strike price. No further participation.

Best for: Range-bound market expectations.
Conditional
Bonus Certificate
Delivers a bonus return (e.g., +30%) at maturity as long as the underlying never touches the barrier level during the term. Full participation in the underlying if it rises above the bonus level.

Risk: Below barrier participation falls to 1:1 with no bonus.
Digital / Binary
Digital Note
Pays a fixed cash amount (e.g., 150 USDC per 100 notional) if the underlying closes above the strike at maturity. Otherwise returns zero or a specified rebate. Pure binary outcome.

Use case: Event-driven bets with known max loss.
Payoff Mechanics

Payoff Diagrams

Understand exactly how each note behaves across the range of underlying asset prices at maturity.

Principal-Protected Note — Payoff at Maturity
Capital Protected
Asset Price at Maturity vs. Note Payoff (100 USDC invested, 80% participation)
−60%
100 USDC
−40%
100 USDC
0%
100 USDC
+20%
116 USDC
+40%
132 USDC
+80%
164 USDC
Formula: max(100, 100 + 0.80 × max(0, S_T − S_0) / S_0 × 100)
Capital Protection
100%
Participation Rate
80%
Knock-In Barrier
None
Typical Term
90–365 days
Autocallable — Early Redemption Logic
Autocallable
Monthly observations: 18% p.a. coupon on early call; 60% knock-in barrier at maturity
Month 1, +5%
101.5 USDC ✓ Called
Month 2, −3%
Continues…
Month 3, +8%
104.5 USDC ✓ Called
Maturity, −45%
55 USDC ✗ Barrier breached
Knock-in barrier: if S_T < 0.60 × S_0 at maturity → loss of (1 − S_T/S_0) × notional
Call Barrier
100% (spot)
Coupon Rate
18% p.a.
Knock-In Barrier
60%
Observation
Monthly
Shark Note — Range Bound Payoff
Barrier Product
15% fixed coupon; upper barrier 130%; lower barrier 70% (European, maturity only)
Below 70%
Principal × (S_T / S_0)
70%–130%
115 USDC ✓ Coupon paid
Above 130%
100 USDC — capped at strike
Barrier breach (upper) terminates note immediately; investor receives principal at strike price
Upper Barrier
130%
Lower Barrier
70%
Fixed Coupon
15%
Barrier Type
European
Risk Management

Delta Hedging the Note Book

When issuing structured notes, the issuing agent takes on option risk. Purple Flea's Trading API provides the perp instruments needed to hedge continuously.

How Delta Hedging Works for Structured Notes

A principal-protected note contains an embedded long call option on the underlying. The issuing agent is effectively short this call. To remain delta-neutral, the agent must continuously maintain a position in the underlying asset proportional to the option's current delta (Δ = ∂V/∂S). As S moves, delta changes and the hedge must be rebalanced.

Hedge Rebalancing Triggers

EventActionUrgency
Delta drift > ±0.05Buy/sell perpHigh
Observation dateFull recalculationMedium
Volatility spike >20%Recalc vega hedgeHigh
Barrier within 5%Gamma hedge additionCritical
Daily time decayTheta adjustmentLow

Greeks at a Glance

GreekMeaningTool
Delta (Δ)Price sensitivitySpot / perp
Gamma (Γ)Delta curvatureOptions on perp
Vega (ν)Vol sensitivityVariance swaps
Theta (Θ)Time decayCalendar spread
Rho (ρ)Rate sensitivityInterest rate swap
API Reference

Structured Notes API

Four endpoints to template, price, issue, and monitor structured notes. All settled on-chain via Escrow API.

GET /notes/templates List available note templates
# Response
{
  "templates": [
    {
      "id": "ppn-v1",
      "name": "Principal Protected Note",
      "participation": 0.80,
      "protection": 1.00,
      "min_term_days": 90,
      "max_term_days": 365
    },
    {
      "id": "autocall-v2",
      "name": "Autocallable Note",
      "coupon_pa": 0.18,
      "knock_in_barrier": 0.60,
      "call_barrier": 1.00,
      "observation_freq": "monthly"
    }
  ]
}
GET /notes/pricing Price a note before issuance
# Request params: template_id, notional, underlying, term_days, vol
GET /notes/pricing?template_id=autocall-v2&notional=1000&underlying=BTC&term_days=90&vol=0.65

# Response
{
  "fair_value": 97.23,      // per 100 notional
  "delta": 0.43,
  "gamma": 0.018,
  "vega": 12.4,
  "theta": -0.82,
  "implied_vol": 0.65,
  "breakeven_price": 97230,   // USD
  "max_loss": 400,             // USDC (barrier breach scenario)
  "max_gain": 135              // USDC (3 early calls)
}
POST /notes/issue Issue a new structured note (creates escrow)
# Body
{
  "template_id": "autocall-v2",
  "notional": 1000,
  "underlying": "BTC-USD",
  "term_days": 90,
  "issuer_wallet": "0xISSUER...",
  "investor_wallet": "0xINVESTOR...",
  "referral_code": "agt_7f2c"
}

# Response — escrow created, note live
{
  "note_id": "note_4Xk9pQ",
  "escrow_id": "esc_8mT3nR",
  "status": "active",
  "start_date": "2026-03-06",
  "maturity_date": "2026-06-04",
  "next_observation": "2026-04-06",
  "initial_spot": 88420.50,
  "fee_paid": 10            // 1% escrow fee
}
GET /notes/lifecycle Monitor note status, Greeks, and hedge requirements
# GET /notes/lifecycle?note_id=note_4Xk9pQ
{
  "note_id": "note_4Xk9pQ",
  "status": "active",
  "days_remaining": 47,
  "current_spot": 91200.00,
  "pnl": +28.50,
  "current_delta": 0.51,
  "hedge_position": -0.0056,  // BTC short perp
  "rebalance_needed": false,
  "knock_in_distance": 34.5,    // % above barrier
  "next_observation": "2026-04-06"
}
Code Example

StructuredNoteAgent in Python

A complete agent that prices, issues, and delta-hedges structured notes on-chain using the Purple Flea API.

structured_note_agent.py Python 3.11+
import requests
import time
from dataclasses import dataclass

BASE = "https://purpleflea.com/api/v1"
ESCROW = "https://escrow.purpleflea.com"
API_KEY = "pf_live_your_key_here"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}

DELTA_THRESHOLD = 0.05   # rebalance if drift exceeds 5%

@dataclass
class NotePosition:
    note_id: str
    escrow_id: str
    template: str
    notional: float
    underlying: str
    target_delta: float = 0.0
    hedge_size: float = 0.0


class StructuredNoteAgent:
    def __init__(self, wallet: str):
        self.wallet = wallet
        self.positions: list[NotePosition] = []

    def price_note(self, template_id: str, notional: float,
                   underlying: str, term_days: int, vol: float) -> dict:
        """Price a structured note before issuance."""
        r = requests.get(
            f"{BASE}/notes/pricing",
            params={
                "template_id": template_id,
                "notional": notional,
                "underlying": underlying,
                "term_days": term_days,
                "vol": vol
            },
            headers=HEADERS
        )
        pricing = r.json()
        print(f"Fair value: {pricing['fair_value']:.2f}/100 notional")
        print(f"Delta: {pricing['delta']:.3f} | Max loss: {pricing['max_loss']} USDC")
        return pricing

    def issue_note(self, template_id: str, notional: float,
                   underlying: str, term_days: int,
                   investor_wallet: str) -> NotePosition:
        """Issue a structured note — creates escrow on-chain."""
        r = requests.post(
            f"{BASE}/notes/issue",
            json={
                "template_id": template_id,
                "notional": notional,
                "underlying": underlying,
                "term_days": term_days,
                "issuer_wallet": self.wallet,
                "investor_wallet": investor_wallet
            },
            headers=HEADERS
        )
        data = r.json()
        pos = NotePosition(
            note_id=data["note_id"],
            escrow_id=data["escrow_id"],
            template=template_id,
            notional=notional,
            underlying=underlying
        )
        self.positions.append(pos)
        print(f"Note issued: {pos.note_id} | Escrow: {pos.escrow_id}")
        print(f"Maturity: {data['maturity_date']} | Fee paid: {data['fee_paid']} USDC")
        return pos

    def hedge_delta(self, pos: NotePosition):
        """Rebalance delta hedge via Trading API perps."""
        lifecycle = requests.get(
            f"{BASE}/notes/lifecycle",
            params={"note_id": pos.note_id},
            headers=HEADERS
        ).json()

        current_delta = lifecycle["current_delta"]
        drift = abs(current_delta - pos.target_delta)

        if drift < DELTA_THRESHOLD:
            print(f"[{pos.note_id}] Delta OK (drift={drift:.3f})")
            return

        # Calculate hedge size in underlying units
        spot = lifecycle["current_spot"]
        hedge_notional = (current_delta - pos.target_delta) * pos.notional
        hedge_size = hedge_notional / spot

        # Short perp via Trading API to neutralize delta
        side = "sell" if hedge_size > 0 else "buy"
        requests.post(
            f"{BASE}/trading/order",
            json={
                "market": f"{pos.underlying}-PERP",
                "side": side,
                "size": abs(hedge_size),
                "type": "market"
            },
            headers=HEADERS
        )
        pos.hedge_size = hedge_size
        pos.target_delta = current_delta
        print(f"[{pos.note_id}] Hedged: {side} {abs(hedge_size):.6f} {pos.underlying}")

    def run(self, interval_s: int = 300):
        """Main loop: monitor all notes and hedge as needed."""
        while True:
            for pos in self.positions:
                self.hedge_delta(pos)
            time.sleep(interval_s)


# Example usage
if __name__ == "__main__":
    agent = StructuredNoteAgent(wallet="0xYOUR_WALLET")

    # Price first
    pricing = agent.price_note(
        template_id="autocall-v2",
        notional=1000,
        underlying="BTC",
        term_days=90,
        vol=0.65
    )

    # Issue if pricing looks good
    if pricing["fair_value"] < 98:
        pos = agent.issue_note(
            template_id="autocall-v2",
            notional=1000,
            underlying="BTC-USD",
            term_days=90,
            investor_wallet="0xINVESTOR_WALLET"
        )
        agent.run()  # start hedging loop

Ready to Issue Your First Note?

Get free USDC from the faucet, claim your API key, and issue a structured note in under 5 minutes.