Price Feeds API
Base URL: /api/defi/prices
Real-time price feeds for all supported assets with historical data.
Overview
The Price Feeds API provides real-time and historical price data for all assets on YaniPay. Prices are aggregated from multiple sources including our DEX, major exchanges, and oracle networks.
Update Frequency
Every 5 seconds
REST API polling
WebSocket
Real-time
Sub-second updates
History
365 days
1m, 5m, 1h, 1d intervals
YaniChain Oracles
Les prix sont alimentés par le réseau d'oracles décentralisé de YaniChain, garantissant des données fiables et résistantes à la manipulation. Les oracles agrègent les prix de multiples sources pour une précision maximale.
Y.A.N.I. Analyse les Marchés
Endpoints
GET /api/defi/prices
Get current prices for all supported assets.
curl -X GET "https://api.yanipay.com/api/defi/prices"Response
{
"prices": [
{
"symbol": "YANI",
"name": "YaniCoin",
"price": "0.5025",
"priceUsd": "0.5025",
"priceEur": "0.4650",
"change24h": "+2.45",
"change7d": "+8.12",
"volume24h": "12500000.00",
"marketCap": "3517500000.00",
"circulatingSupply": "7000000000",
"high24h": "0.5150",
"low24h": "0.4850",
"lastUpdated": "2026-01-25T10:30:00Z"
},
{
"symbol": "ETH",
"name": "Ethereum",
"price": "3250.50",
"priceUsd": "3250.50",
"priceEur": "3006.71",
"change24h": "+1.25",
"change7d": "+5.80",
"volume24h": "15000000000.00",
"marketCap": "390000000000.00",
"circulatingSupply": "120000000",
"high24h": "3300.00",
"low24h": "3180.00",
"lastUpdated": "2026-01-25T10:30:00Z"
}
],
"lastUpdated": "2026-01-25T10:30:00Z"
}GET /api/defi/prices/:symbol
Get detailed price information for a specific asset.
curl -X GET "https://api.yanipay.com/api/defi/prices/YANI"Response
{
"symbol": "YANI",
"name": "YaniCoin",
"price": "0.5025",
"priceUsd": "0.5025",
"priceEur": "0.4650",
"priceBtc": "0.00000502",
"priceEth": "0.000155",
"change1h": "+0.15",
"change24h": "+2.45",
"change7d": "+8.12",
"change30d": "+15.50",
"volume24h": "12500000.00",
"volumeChange24h": "+5.20",
"marketCap": "3517500000.00",
"fullyDilutedValuation": "3517500000.00",
"circulatingSupply": "7000000000",
"totalSupply": "7000000000",
"maxSupply": "7000000000",
"high24h": "0.5150",
"low24h": "0.4850",
"allTimeHigh": "0.8500",
"allTimeHighDate": "2025-12-15T00:00:00Z",
"allTimeLow": "0.1200",
"allTimeLowDate": "2025-06-01T00:00:00Z",
"lastUpdated": "2026-01-25T10:30:00Z"
}GET /api/defi/prices/:symbol/history
Get historical price data for charting and analysis.
curl -X GET "https://api.yanipay.com/api/defi/prices/YANI/history?interval=1h&from=2026-01-20&to=2026-01-25"Query Parameters
| Parameter | Type | Description |
|---|---|---|
interval | string | 1m, 5m, 15m, 1h, 4h, 1d |
from | string | Start date (ISO 8601) |
to | string | End date (ISO 8601) |
Response
{
"symbol": "YANI",
"interval": "1h",
"from": "2026-01-20T00:00:00Z",
"to": "2026-01-25T10:00:00Z",
"data": [
{
"timestamp": "2026-01-20T00:00:00Z",
"open": "0.4500",
"high": "0.4550",
"low": "0.4480",
"close": "0.4525",
"volume": "500000.00"
},
{
"timestamp": "2026-01-20T01:00:00Z",
"open": "0.4525",
"high": "0.4600",
"low": "0.4510",
"close": "0.4580",
"volume": "650000.00"
}
]
}WebSocket API
For real-time price updates, connect to our WebSocket endpoint. This provides sub-second price updates without polling.
1 // Connect to WebSocket 2 const ws = new WebSocket('wss://api.yanipay.com/ws/prices'); 3 4 // Subscribe to specific symbols 5 ws.onopen = () => { 6 ws.send(JSON.stringify({ 7 action: 'subscribe', 8 symbols: ['YANI', 'ETH', 'BTC'] 9 })); 10 }; 11 12 // Handle price updates 13 ws.onmessage = (event) => { 14 const data = JSON.parse(event.data); 15 16 if (data.type === 'price_update') { 17 console.log(`${data.symbol}: $${data.price}`); 18 // Update your UI here 19 } 20 }; 21 22 // Unsubscribe when done 23 ws.send(JSON.stringify({ 24 action: 'unsubscribe', 25 symbols: ['YANI'] 26 }));
WebSocket Message Types
// Price update message
interface PriceUpdate {
type: 'price_update';
symbol: string;
price: string;
change24h: string;
volume24h: string;
timestamp: string;
}
// Subscription confirmation
interface SubscriptionConfirm {
type: 'subscribed';
symbols: string[];
}
// Error message
interface ErrorMessage {
type: 'error';
code: string;
message: string;
}TypeScript Types
1 export interface AssetPrice { 2 symbol: string; 3 name: string; 4 price: string; 5 priceUsd: string; 6 priceEur: string; 7 change24h: string; 8 change7d: string; 9 volume24h: string; 10 marketCap: string; 11 circulatingSupply: string; 12 high24h: string; 13 low24h: string; 14 lastUpdated: string; 15 } 16 17 export interface DetailedAssetPrice extends AssetPrice { 18 priceBtc: string; 19 priceEth: string; 20 change1h: string; 21 change30d: string; 22 volumeChange24h: string; 23 fullyDilutedValuation: string; 24 totalSupply: string; 25 maxSupply: string; 26 allTimeHigh: string; 27 allTimeHighDate: string; 28 allTimeLow: string; 29 allTimeLowDate: string; 30 } 31 32 export interface PriceCandle { 33 timestamp: string; 34 open: string; 35 high: string; 36 low: string; 37 close: string; 38 volume: string; 39 } 40 41 export interface PriceHistory { 42 symbol: string; 43 interval: '1m' | '5m' | '15m' | '1h' | '4h' | '1d'; 44 from: string; 45 to: string; 46 data: PriceCandle[]; 47 } 48 49 export interface PricesResponse { 50 prices: AssetPrice[]; 51 lastUpdated: string; 52 } 53 54 export interface HistoryParams { 55 interval: '1m' | '5m' | '15m' | '1h' | '4h' | '1d'; 56 from: string; 57 to: string; 58 }
Rate Limits
| Endpoint | Rate Limit | Window |
|---|---|---|
GET /prices | 100 requests | Per minute |
GET /prices/:symbol | 200 requests | Per minute |
GET /prices/:symbol/history | 60 requests | Per minute |
WebSocket | 5 connections | Per API key |
Rate Limit Headers
All responses include X-RateLimit-Remaining and X-RateLimit-Resetheaders to help you manage your request budget.