DEV Community

Pythia Oracle
Pythia Oracle

Posted on

Your AI Agent Needs Market Data On-Chain. Here's How to Get It Without Running a Server.

If you're building an AI agent that trades, manages a vault, or makes any DeFi decision — you've hit this problem: your agent needs market indicators (EMA, RSI, volatility, Bollinger Bands), but computing them means running an off-chain server, managing API keys, and maintaining a data pipeline.

That's infrastructure work, not agent work.

The Problem

Most DeFi agents today do one of two things:

  1. Call an API from off-chain — Your agent fetches data from CoinGecko or similar, computes indicators, then submits a transaction. This works, but your agent now depends on off-chain infrastructure. If your server goes down, your agent stops trading.
  2. Read raw price feeds on-chain — Chainlink gives you ETH/USD. Great. But you need the 20-period EMA, not the spot price. So you're back to computing it off-chain.

Neither option gives you calculated indicators directly on-chain, readable from a smart contract in a single call.

A Different Approach

What if your contract could just read the current RSI or EMA the same way it reads a price feed?

// Request BTC's 20-period EMA on the 1-hour timeframe
function getIndicator() external {
    Chainlink.Request memory req = _buildChainlinkRequest(
        jobId, address(this), this.fulfill.selector
    );
    req._add("feed", "btc_EMA_1H_20");
    _sendChainlinkRequest(req, fee);
}

function fulfill(bytes32 _requestId, int256 _value) public recordChainlinkFulfillment(_requestId) {
    // _value = current EMA value, scaled to 8 decimals
    currentEMA = _value;
}

That's it. No server. No API keys. No data pipeline. Your contract requests btc_EMA_1H_20 and gets the current 20-period hourly EMA for Bitcoin.

What's Available

22 tokens across multiple categories — not just the top 10. Cross-chain coverage including BTC, SOL, TAO, RENDER, ONDO, FET, SUI, INJ, TIA, plus Polygon DeFi tokens.

6 indicator types:

  • EMA (Exponential Moving Average) — trend direction
  • RSI (Relative Strength Index) — overbought/oversold
  • VWAP (Volume Weighted Average Price) — fair value
  • Bollinger Bands — volatility range
  • Volatility Score — risk measurement
  • USD Price — baseline reference

4 timeframes: 5-minute, 1-hour, 1-day, 1-week.

All delivered as standard Chainlink oracle responses. If your contract already uses Chainlink, you already know how to use this.

For MCP / AI Agent Builders

If your agent runs off-chain and uses MCP (Model Context Protocol):

pip install pythia-oracle-mcp

Your agent gets tools to query any indicator for any supported token. No API key needed:

"What's the current RSI for SOL on the 1-hour timeframe?"
→ SOL RSI (1H, 14-period): 62.4 — neutral, trending up

Also available as a LangChain tool:

pip install langchain-pythia

Try It Free

There's a testnet faucet on Polygon Amoy — 5 requests per day, no signup, no API key. Deploy your consumer contract, point it at the oracle, and start reading indicators.

The faucet address: 0x640fC3B9B607E324D7A3d89Fcb62C77Cc0Bd420A

Full examples and Solidity code: github.com/pythia-the-oracle/pythia-oracle-examples

Website: pythia.c3x-solutions.com


Building something that needs on-chain market intelligence? I'd genuinely like to hear what indicators or tokens you need. This is a new project and builder feedback shapes what gets built next.

Top comments (0)