A Production-Grade Quantitative Pricing Engine, Fair-Value Arbitrage Scanner, and Point Yield Modeler for Pendle Finance v2
YT_Token is an institutional-grade quantitative analytics framework and interactive dashboard engineered for decentralized fixed-income and yield tokenization markets on Pendle Finance.
The suite provides real-time fair value curves, implied vs. underlying yield spreads, point farming leverage simulations, dynamic pool discovery, and historical execution backtesting across major EVM chains (Ethereum, Arbitrum, Mantle, Base, Optimism, BSC).
flowchart TD
A[Pendle v2 Core API] -->|Dynamic Markets, APYs, OHLCV| B[Resilient Client & Connection Pool]
B --> C[Streamlit Cache Layer @st.cache_data]
C --> D[Quantitative Pricing & Fair Value Engine]
C --> E[Technical Analysis Engine: RSI, MACD, Volatility]
D --> F[Valuation Spread & Arbitrage Identifier]
D --> G[Point Farming & Leverage Simulator]
D --> H[Limit Order Payoff Model]
E --> I[Interactive Plotly Visualizations]
F --> I
G --> I
H --> I
I --> J[Modern Streamlit Dashboard UI]
- β‘ Live Active Pool Discovery: Dynamically queries active market pools per network sorted by TVL/Liquidity, auto-filling contracts without manual copy-pasting.
- π Quantitative Fair Value Pricing: Continuous volume-weighted discounting model identifying overvalued and undervalued Yield Tokens relative to historical market benchmarks.
- πΎ Point Farming Leverage & Cost Analysis: Compute real-time point accrual rates, effective leverage multipliers (including protocol boosts), and the exact cost per point in underlying currency.
- π Long Yield vs. Implied APY Spread: Annualized yield differential modeling to assess the expected return of holding Yield Tokens to maturity.
- π¬ Technical Indicator Engine: Built-in multi-timeframe Moving Averages (20/50/200), Relative Strength Index (RSI), MACD with Signal & Histogram, and Rolling Volatility.
- π― Scenario & Limit Order Simulators:
- Historical Purchase Evaluator: Interpolates exact entry price and percentile performance ranking against all market participants.
- Limit Order Modeler: Projects yield, leverage, and points at target implied APYs.
- β‘ High-Performance Architecture:
- Resilient HTTP client with connection pooling, exponential backoff retries, and strict 10s timeouts.
- Granular Streamlit
@st.cache_datacaching for zero-latency parameter adjustments. - Complete type safety with Python dataclasses and Mypy annotations.
- 100% test coverage with automated AST timeout verification and quantitative test suites.
In the Pendle protocol, a Yield Token grants ownership of all variable yields and points generated by the underlying asset until maturity
To determine whether a Yield Token is mispriced relative to market depth, we compute the volume-weighted average implied APY (
The theoretical Fair Value Decay Trajectory
The Valuation Spread
-
$\Delta(t) > 0$ : Undervalued (YT trading below historical fair yield)$\rightarrow$ Favorable Buy / Long Yield. -
$\Delta(t) < 0$ : Overvalued (YT trading above historical fair yield)$\rightarrow$ Favorable Sell / Take Profit.
The annualized rate of return achieved by going "Long Yield" (buying YT when underlying yield exceeds implied yield) is formulated as:
When investing
where
YT_Token/
βββ src/
β βββ yt_token/
β βββ __init__.py # Package exports and versioning
β βββ config.py # Chain IDs, API endpoints, and market presets
β βββ models.py # Typed dataclasses (Asset, DiscoveredMarket, SimulationResult)
β βββ client.py # PendleApiClient with dynamic pool discovery & caching
β βββ analytics.py # Pure quantitative finance math and simulation models
β βββ indicators.py # Technical indicators (RSI, MACD, MAs, Volatility)
β βββ plotting.py # Interactive Plotly figures with dark/light themes
β βββ ui/
β βββ __init__.py # UI component package
β βββ sidebar.py # Dynamic pool dropdown, validation, simulator controls
β βββ components.py # Metric cards, tabbed views, tables, and data exports
βββ tests/
β βββ conftest.py # Shared fixtures and mock HTTP responses
β βββ test_client.py # API client, dynamic market fetching, retry strategy tests
β βββ test_analytics.py # Pricing math, fair value, and simulation tests
β βββ test_indicators.py # Technical indicator verification
β βββ test_plotting.py # Plotly figure and annotation tests
βββ app.py # Modern Streamlit application entrypoint
βββ ytTok.py # Backward-compatible legacy interface
βββ pyproject.toml # PEP 621 packaging and tool configuration
βββ requirements.txt # Production dependency specifications
βββ requirements-dev.txt # Developer tooling dependencies
βββ Makefile # Standard developer commands (run, test, lint, format)
βββ README.md # Comprehensive documentation
- Python 3.10+ (tested through Python 3.14)
uv(recommended) or standardpip/venv
Using uv:
# Clone the repository
git clone https://github.com/DPRC137/YT_Token.git
cd YT_Token
# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"Using pip:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt# Run via modern entrypoint
streamlit run app.py
# Or run via legacy entrypoint
streamlit run ytTok.py
# Or via Makefile
make runThe web dashboard will launch at http://localhost:8501.
Run the complete test suite (51 tests covering quantitative models, API resilience, and technical indicators):
# Run pytest with timing metrics
pytest -v
# Or via Makefile
make test# Run Ruff linter
ruff check .
# Run Mypy static type analysis
mypy src
# Or run both via Makefile
make lintIf you find this quantitative Yield Token valuation scanner helpful for your DeFi analysis and trading strategies, consider supporting future development:
Distributed under the MIT License. See LICENSE for details.
This software is developed for informational and quantitative analytical purposes only. It does not constitute financial, investment, or trading advice. Yield token markets carry structural risks including smart contract risk, interest rate volatility, and liquidity constraints.