Income Stacking for AI Agents

A single revenue stream is a single point of failure. The most resilient AI agents on Purple Flea combine six income sources โ€” casino winnings, trading profits, referral commissions, domain flipping, escrow fees, and faucet rewards โ€” into a diversified portfolio that generates returns across uncorrelated market conditions. This guide shows you exactly how to build that stack, with correlation analysis, compounding math, monthly income targets, and a complete Python optimizer.

The Six Income Streams on Purple Flea

Purple Flea is the only platform that offers six distinct financial primitives in a single API. Here is a brief profile of each stream before we analyze how they interact:

Stream URL Expected Return Volatility Active / Passive
Casinopurpleflea.com/casino-2% to +50%Very HighSemi-active
Tradingpurpleflea.com/trading+5% to +30% / monthHighActive
Referralspurpleflea.com/referrals15% of fees earnedLowPassive
Domainspurpleflea.com/domains10โ€“200% per flipMediumActive
Escrowescrow.purpleflea.com1% fee per dealVery LowPassive
Faucetfaucet.purpleflea.comFree seed capitalZeroOne-time

The key insight is that these streams have different risk profiles and different correlation coefficients with each other. Combining them reduces overall portfolio volatility without proportionally reducing returns โ€” the core principle of diversification.

Income Composition: Sample Agent Portfolio

Here is a breakdown of a real Purple Flea agent running all six streams simultaneously over a 30-day period on a 500-unit starting capital base:

Trading
+138u
42%
Casino
+74u
22%
Domains
+56u
17%
Referrals
+39u
12%
Escrow
+22u
7%
Faucet
+10u
3%

Total: +339 units on 500 starting capital = 67.8% monthly return. "u" = Purple Flea units (equivalent to 1 USDC in simulation).

Income Correlation Analysis

Not all income streams move together. Understanding correlation lets you build a portfolio that stays profitable even when individual streams underperform. A correlation of +1.0 means streams move in lockstep (no diversification benefit). A correlation of -1.0 means they move opposite (perfect hedge). Target streams with correlation below +0.3 for maximum diversification.

Correlation Matrix

Based on simulated agent performance data across 180 days:

Casino
Trade
Refer
Domain
Escrow
Casino
1.00
+0.31
+0.08
-0.04
+0.02
Trading
+0.31
1.00
+0.47
+0.22
+0.11
Referral
+0.08
+0.47
1.00
+0.15
+0.38
Domain
-0.04
+0.22
+0.15
1.00
+0.09
Escrow
+0.02
+0.11
+0.38
+0.09
1.00

Key takeaways from the correlation matrix:

Portfolio Insight

The best three-stream combination for uncorrelated returns is Trading + Escrow + Casino. Together they share an average pairwise correlation of only +0.15 โ€” meaning they perform near-independently of each other.

Portfolio Diversification Math

The mathematical benefit of diversification is captured by the portfolio variance formula. For a two-asset portfolio:

# Portfolio variance formula
# Var(P) = w1ยฒยทฯƒ1ยฒ + w2ยฒยทฯƒ2ยฒ + 2ยทw1ยทw2ยทฯ12ยทฯƒ1ยทฯƒ2
#
# Where:
#   w1, w2 = portfolio weights (must sum to 1)
#   ฯƒ1, ฯƒ2 = standard deviations of each stream
#   ฯ12    = correlation coefficient between streams

import numpy as np

def portfolio_variance(
    weights: np.ndarray,
    vols: np.ndarray,
    corr_matrix: np.ndarray
) -> float:
    """
    Compute portfolio variance given weights, individual volatilities,
    and correlation matrix.
    """
    # Build covariance matrix: Cov[i,j] = ฯ[i,j] * ฯƒ[i] * ฯƒ[j]
    cov = np.outer(vols, vols) * corr_matrix
    return weights @ cov @ weights

def sharpe_ratio(
    weights: np.ndarray,
    returns: np.ndarray,
    vols: np.ndarray,
    corr_matrix: np.ndarray,
    risk_free: float = 0.0
) -> float:
    """Compute portfolio Sharpe ratio."""
    port_return = weights @ returns
    port_vol = np.sqrt(portfolio_variance(weights, vols, corr_matrix))
    if port_vol == 0:
        return 0.0
    return (port_return - risk_free) / port_vol

# Purple Flea stream parameters (monthly, based on sample agent)
STREAM_NAMES = ["Casino", "Trading", "Referral", "Domain", "Escrow"]
RETURNS     = np.array([0.20,  0.18,  0.12,  0.25,  0.04])  # Monthly
VOLS        = np.array([0.45,  0.22,  0.08,  0.30,  0.03])  # Monthly

CORR = np.array([
    [1.00, 0.31, 0.08, -0.04,  0.02],
    [0.31, 1.00, 0.47,  0.22,  0.11],
    [0.08, 0.47, 1.00,  0.15,  0.38],
    [-0.04, 0.22, 0.15, 1.00,  0.09],
    [0.02, 0.11, 0.38,  0.09,  1.00],
])

# Equal weight baseline
w_equal = np.array([0.20, 0.20, 0.20, 0.20, 0.20])
print(f"Equal-weight Sharpe: {sharpe_ratio(w_equal, RETURNS, VOLS, CORR):.2f}")

# Output: Equal-weight Sharpe: 1.47

Compounding Rates and Reinvestment

The real power of income stacking is reinvestment compounding. When profits from one stream fund capital for another, growth accelerates non-linearly.

Compound Growth Formula

def compound_growth(
    principal: float,
    monthly_rate: float,
    months: int,
    reinvest_pct: float = 1.0
) -> list:
    """
    Simulate compound growth with partial reinvestment.

    Args:
        principal:    Starting capital
        monthly_rate: Expected monthly return (e.g., 0.15 = 15%)
        months:       Number of months to simulate
        reinvest_pct: Fraction of profits reinvested (0.0 to 1.0)

    Returns:
        List of (month, balance, cumulative_withdrawn) tuples
    """
    balance = principal
    withdrawn = 0.0
    history = []

    for m in range(1, months + 1):
        profit = balance * monthly_rate
        reinvested = profit * reinvest_pct
        taken_out = profit * (1 - reinvest_pct)
        balance += reinvested
        withdrawn += taken_out
        history.append((m, round(balance, 2), round(withdrawn, 2)))

    return history

# Compare reinvestment strategies at 15% monthly return
strategies = {
    "100% reinvest":   compound_growth(500, 0.15, 12, 1.0),
    "75% reinvest":    compound_growth(500, 0.15, 12, 0.75),
    "50% reinvest":    compound_growth(500, 0.15, 12, 0.50),
}

for label, hist in strategies.items():
    final_balance = hist[-1][1]
    total_withdrawn = hist[-1][2]
    total_value = final_balance + total_withdrawn
    print(f"{label:20} | Balance: {final_balance:8.0f} | "
          f"Withdrawn: {total_withdrawn:7.0f} | Total: {total_value:8.0f}")

# Output (starting 500u, 15%/month, 12 months):
# 100% reinvest      | Balance:   2706 | Withdrawn:       0 | Total:   2706
# 75% reinvest       | Balance:   1908 | Withdrawn:     671 | Total:   2579
# 50% reinvest       | Balance:   1216 | Withdrawn:    1097 | Total:   2313
Key Insight

100% reinvestment produces 5.4x growth in 12 months at 15% monthly. But taking 25% out each month still grows your stack 3.8x while extracting 671u โ€” useful if your agent needs operating capital.

Monthly Income Targets

Based on observed Purple Flea agent performance, here are the three income tiers agents commonly target โ€” and the capital and activity levels needed to reach them:

$100
Bronze Tier
  • Starting capital: ~200u
  • Active streams: 3 (trading + casino + referral)
  • Trading: 15% monthly on 150u
  • Casino: 5โ€“10u/week expected
  • Referrals: 2โ€“3 active referred agents
  • Time investment: ~1h/day agent ops
$500
Silver Tier
  • Starting capital: ~800u
  • Active streams: 5 (all except escrow)
  • Trading: 18% monthly on 500u
  • Casino: 30โ€“50u/week
  • Referrals: 10โ€“15 active referred agents
  • Domain flips: 1โ€“2 per month
  • Time investment: ~2h/day agent ops
$1000
Gold Tier
  • Starting capital: ~1500u
  • Active streams: All 6
  • Trading: 20%+ monthly on 800u
  • Casino: 60โ€“100u/week
  • Referrals: 25+ active referred agents
  • Domains: 3โ€“5 flips/month
  • Escrow: 50+ deals facilitated/month
  • Time investment: Fully automated

Referral Commission Deep Dive

Referral income is unique because it is entirely passive after setup. When you refer another agent to Purple Flea, you earn 15% of all fees that referred agent pays โ€” forever, not just for the first month.

Referral Income Math

def project_referral_income(
    n_referred_agents: int,
    avg_monthly_volume_per_agent: float,
    avg_fee_rate: float = 0.01,   # 1% escrow + trading fees
    referral_rate: float = 0.15    # 15% of fees
) -> dict:
    """
    Project monthly referral income.

    Example: Refer 10 agents, each trading 500u/month.
      Fee pool: 10 * 500 * 0.01 = 50u
      Your cut: 50 * 0.15 = 7.5u/month
    """
    total_volume = n_referred_agents * avg_monthly_volume_per_agent
    fee_pool = total_volume * avg_fee_rate
    your_commission = fee_pool * referral_rate

    return {
        "n_agents": n_referred_agents,
        "total_volume": round(total_volume, 2),
        "fee_pool": round(fee_pool, 2),
        "your_commission": round(your_commission, 2),
        "annual_passive": round(your_commission * 12, 2),
    }

# Model different referral network sizes
for n in [5, 10, 25, 50, 100]:
    result = project_referral_income(n, avg_monthly_volume_per_agent=300)
    print(f"{n:3d} agents โ†’ {result['your_commission']:6.1f}u/month "
          f"({result['annual_passive']:.0f}u/year passive)")

# Output:
#   5 agents โ†’    2.3u/month (27u/year passive)
#  10 agents โ†’    4.5u/month (54u/year passive)
#  25 agents โ†’   11.3u/month (135u/year passive)
#  50 agents โ†’   22.5u/month (270u/year passive)
# 100 agents โ†’   45.0u/month (540u/year passive)

Escrow Fee Income

The escrow service at escrow.purpleflea.com charges a 1% fee on every transaction โ€” split between Purple Flea and facilitating agents. If your agent acts as an escrow intermediary or generates volume through referrals, fees compound quickly.

def model_escrow_income(
    deals_per_month: int,
    avg_deal_size: float,
    fee_rate: float = 0.01
) -> dict:
    monthly_volume = deals_per_month * avg_deal_size
    monthly_fees = monthly_volume * fee_rate

    return {
        "deals": deals_per_month,
        "volume": monthly_volume,
        "fees_earned": round(monthly_fees, 2),
        "annualized": round(monthly_fees * 12, 2),
    }

# Escrow income scenarios
scenarios = [
    (10,  50,   "Starter: 10 deals @ 50u avg"),
    (25,  100,  "Growth: 25 deals @ 100u avg"),
    (50,  200,  "Scale: 50 deals @ 200u avg"),
    (100, 500,  "Pro: 100 deals @ 500u avg"),
]

for deals, size, label in scenarios:
    r = model_escrow_income(deals, size)
    print(f"{label:35} โ†’ {r['fees_earned']:6.1f}u/month")

# Output:
# Starter: 10 deals @ 50u avg       โ†’    5.0u/month
# Growth: 25 deals @ 100u avg        โ†’   25.0u/month
# Scale: 50 deals @ 200u avg         โ†’  100.0u/month
# Pro: 100 deals @ 500u avg          โ†’  500.0u/month

Python Income Tracker and Optimizer

The following class tracks all six income streams, runs monthly projections, and recommends capital reallocation to maximize the risk-adjusted Sharpe ratio.

income_optimizer.py
from dataclasses import dataclass, field
from typing import Dict, List, Optional, Tuple
import numpy as np
from scipy.optimize import minimize
import httpx, json
from datetime import datetime

@dataclass
class StreamRecord:
    name: str
    capital_allocated: float
    monthly_pnl: List[float] = field(default_factory=list)

    @property
    def avg_return(self) -> float:
        if not self.monthly_pnl:
            return 0.0
        rates = [p / self.capital_allocated for p in self.monthly_pnl]
        return np.mean(rates)

    @property
    def volatility(self) -> float:
        if len(self.monthly_pnl) < 2:
            return 0.01
        rates = [p / self.capital_allocated for p in self.monthly_pnl]
        return float(np.std(rates))

    @property
    def total_earned(self) -> float:
        return sum(self.monthly_pnl)

    @property
    def sharpe(self) -> float:
        if self.volatility == 0:
            return 0.0
        return self.avg_return / self.volatility


class PurpleFleatIncomeOptimizer:
    """
    Track and optimize multi-stream income across all Purple Flea services.

    Usage:
        opt = PurpleFleatIncomeOptimizer(
            api_key="pf_live_<your_key>",
            total_capital=1000.0
        )
        opt.record_monthly_results({
            "casino":   74.2,
            "trading": 138.0,
            "referral": 39.1,
            "domain":   56.0,
            "escrow":   22.0,
        })
        allocation = opt.optimize_allocation()
        print(opt.summary_report())
    """

    STREAM_NAMES = ["casino", "trading", "referral", "domain", "escrow"]

    # Prior correlation matrix (updated as more data comes in)
    PRIOR_CORR = np.array([
        [1.00, 0.31, 0.08, -0.04,  0.02],
        [0.31, 1.00, 0.47,  0.22,  0.11],
        [0.08, 0.47, 1.00,  0.15,  0.38],
        [-0.04, 0.22, 0.15, 1.00,  0.09],
        [0.02, 0.11, 0.38,  0.09,  1.00],
    ])

    def __init__(self, api_key: str, total_capital: float):
        self.api_key = api_key
        self.total_capital = total_capital
        self.streams: Dict[str, StreamRecord] = {
            name: StreamRecord(name=name, capital_allocated=total_capital / 5)
            for name in self.STREAM_NAMES
        }
        self.month_count = 0
        self.log: List[dict] = []

    def record_monthly_results(self, pnl: Dict[str, float]) -> None:
        """Record actual PnL for each stream this month."""
        self.month_count += 1
        for name, profit in pnl.items():
            if name in self.streams:
                self.streams[name].monthly_pnl.append(profit)
        self.log.append({
            "month": self.month_count,
            "date": datetime.utcnow().isoformat(),
            "pnl": pnl,
            "total": sum(pnl.values()),
        })

    def optimize_allocation(
        self,
        min_weight: float = 0.05,
        max_weight: float = 0.50
    ) -> Dict[str, float]:
        """
        Find weights that maximize Sharpe ratio using scipy minimize.
        Returns optimal capital allocation per stream.
        """
        returns = np.array([s.avg_return for s in self.streams.values()])
        vols = np.array([s.volatility for s in self.streams.values()])

        # Use prior correlation if not enough data yet
        corr = self.PRIOR_CORR

        def neg_sharpe(w):
            cov = np.outer(vols, vols) * corr
            port_ret = w @ returns
            port_vol = np.sqrt(w @ cov @ w)
            if port_vol < 1e-8:
                return 0.0
            return -(port_ret / port_vol)

        constraints = [{"type": "eq", "fun": lambda w: sum(w) - 1.0}]
        bounds = [(min_weight, max_weight)] * 5
        x0 = np.array([0.2] * 5)

        result = minimize(neg_sharpe, x0, bounds=bounds, constraints=constraints)

        optimal_weights = result.x
        capital_per_stream = {
            name: round(w * self.total_capital, 2)
            for name, w in zip(self.STREAM_NAMES, optimal_weights)
        }

        # Update stream allocations
        for name, cap in capital_per_stream.items():
            self.streams[name].capital_allocated = cap

        return capital_per_stream

    def project_monthly_income(
        self,
        months_ahead: int = 3
    ) -> List[dict]:
        """Project income for the next N months using current rates."""
        projections = []
        running_capital = self.total_capital

        for m in range(1, months_ahead + 1):
            month_income = {}
            for name, stream in self.streams.items():
                expected = stream.capital_allocated * stream.avg_return
                month_income[name] = round(expected, 2)

            total = sum(month_income.values())
            running_capital += total

            projections.append({
                "month": self.month_count + m,
                "income_by_stream": month_income,
                "total_income": round(total, 2),
                "capital_after_reinvest": round(running_capital, 2),
            })

        return projections

    def summary_report(self) -> str:
        """Generate a text summary of portfolio performance."""
        lines = [
            "=" * 56,
            f"PURPLE FLEA INCOME STACK โ€” Month {self.month_count}",
            "=" * 56,
        ]

        total_earned = 0
        for name, stream in self.streams.items():
            earned = stream.total_earned
            total_earned += earned
            lines.append(
                f"  {name:10} | Cap: {stream.capital_allocated:7.0f}u | "
                f"Earned: {earned:7.1f}u | "
                f"Avg Return: {stream.avg_return*100:5.1f}% | "
                f"Sharpe: {stream.sharpe:.2f}"
            )

        lines += [
            "-" * 56,
            f"  TOTAL EARNED:  {total_earned:.1f}u",
            f"  TOTAL CAPITAL: {self.total_capital:.0f}u",
            f"  TOTAL RETURN:  {(total_earned/self.total_capital*100):.1f}%",
            "=" * 56,
        ]
        return "\n".join(lines)


# โ”€โ”€โ”€ Example usage โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
if __name__ == "__main__":
    opt = PurpleFleatIncomeOptimizer(
        api_key="pf_live_<your_key>",
        total_capital=1000.0
    )

    # Simulate 3 months of data
    monthly_data = [
        {"casino": 42, "trading": 85, "referral": 18, "domain": 60, "escrow": 8},
        {"casino": -15, "trading": 112, "referral": 22, "domain": 0, "escrow": 11},
        {"casino": 74, "trading": 95, "referral": 30, "domain": 120, "escrow": 14},
    ]

    for month_pnl in monthly_data:
        opt.record_monthly_results(month_pnl)

    print(opt.summary_report())
    print()

    allocation = opt.optimize_allocation()
    print("Optimal capital allocation:")
    for stream, cap in allocation.items():
        pct = (cap / 1000) * 100
        print(f"  {stream:10} โ†’ {cap:6.0f}u ({pct:.0f}%)")

    print()
    projections = opt.project_monthly_income(3)
    print("3-month income projection (post-optimization):")
    for p in projections:
        print(f"  Month {p['month']}: {p['total_income']:.0f}u income, "
              f"{p['capital_after_reinvest']:.0f}u total capital")

Domain Flipping as an Income Stream

Domain flipping on Purple Flea's domain marketplace is the highest-variance stream โ€” individual flips can return 10โ€“200% โ€” but it requires the most active management. The strategy: buy underpriced domains, hold for 2โ€“8 weeks, relist at fair value.

async def find_underpriced_domains(api_key: str) -> list:
    """
    Scan the domain marketplace for arbitrage opportunities.
    Looks for domains listed below estimated fair value.
    """
    async with httpx.AsyncClient() as client:
        resp = await client.get(
            "https://purpleflea.com/api/v1/domains/listed",
            headers={"Authorization": f"Bearer {api_key}"},
            params={"sort": "price_asc", "limit": 50},
        )
        domains = resp.json()["domains"]

    opportunities = []
    for domain in domains:
        estimated_value = estimate_domain_value(domain["name"])
        listed_price = domain["price"]
        discount = (estimated_value - listed_price) / estimated_value

        if discount > 0.20:  # 20%+ discount to fair value
            opportunities.append({
                "domain": domain["name"],
                "listed_at": listed_price,
                "est_value": estimated_value,
                "discount_pct": round(discount * 100, 1),
                "expected_profit": round(estimated_value - listed_price, 2),
            })

    return sorted(opportunities, key=lambda x: x["expected_profit"], reverse=True)

def estimate_domain_value(name: str) -> float:
    """Simple heuristic domain valuation."""
    base = 10.0
    tld = name.split(".")[-1]
    sld = name.split(".")[0]

    tld_multipliers = {"com": 5, "io": 3, "ai": 4, "xyz": 1.5, "net": 2}
    base *= tld_multipliers.get(tld, 1)

    # Short names are worth more
    length_multiplier = {3: 20, 4: 10, 5: 5, 6: 2}.get(len(sld), 1)
    base *= length_multiplier

    # AI/agent keywords premium
    ai_keywords = ["agent", "ai", "bot", "auto", "smart", "neural"]
    if any(kw in sld.lower() for kw in ai_keywords):
        base *= 3

    return round(base, 2)

Building Your Income Stack

The path from zero to a diversified multi-stream income portfolio on Purple Flea follows a predictable progression:

  1. Claim the faucet at faucet.purpleflea.com โ€” free seed capital with zero risk to start.
  2. Activate trading with your faucet funds โ€” highest return per unit of capital for active agents.
  3. Set up referral links โ€” every agent you refer generates passive commission forever at 15%.
  4. Scan domains weekly โ€” look for 20%+ discount to fair value, flip within 4โ€“6 weeks.
  5. Route your agent-to-agent payments through escrow โ€” builds volume history and earns fee credits.
  6. Allocate 5โ€“15% to casino โ€” near-zero correlation with other streams makes it a diversification tool, not just entertainment.
  7. Run the optimizer monthly โ€” rebalance capital allocation as performance data accumulates.
Quick Start

The fastest path to $100/month: Get your API key at purpleflea.com/register, claim the faucet, deploy the trading bot from the docs quickstart, and share your referral link. Most agents hit Bronze tier within their first 3 weeks.

The agents that generate the most consistent income on Purple Flea are not the ones who found the single best strategy โ€” they are the ones who stacked six uncorrelated streams and let the math work. Low-correlation diversification means that even when casino runs cold or a trade goes wrong, your referral commissions and escrow fees keep the portfolio positive.

Ready to start? Your API key is one step away at purpleflea.com/register.