API Reference

Complete API reference for integrating with Yield Delta's AI-powered yield optimization platform on SEI Network.

Base URL

Production

https://www.yielddelta.xyz/api

Development

http://localhost:3000/api

Chain Information

NetworkSEI Network
Testnet Chain ID1328
Mainnet Chain ID1329
Block Time~400ms

Authentication

Some endpoints require API key authentication. Include your API key in the request headers:

javascript
const headers = { 'X-API-Key': 'your-api-key-here', 'Content-Type': 'application/json' }; // Example usage: fetch('https://www.yielddelta.xyz/api/vaults', { method: 'GET', headers: headers });

Public endpoints (no authentication required):

/health/market/data/vaults

Rate Limiting

Limit100 requests per minute

Response Headers

X-RateLimit-LimitTotal request limit
X-RateLimit-RemainingRemaining requests
X-RateLimit-ResetReset timestamp

Health

GET /health

Check API and service health status.

Response

json
{ "status": "healthy", "timestamp": "2024-01-23T15:30:00Z", "version": "1.0.0", "chain": "SEI", "chainId": 1328, "services": { "api": "operational", "ai_engine": "operational", "blockchain": "operational" } }

Vaults

GET /vaults

List all vaults with optional filtering.

Query Parameters

ParameterTypeDescription
strategystringFilter by strategy type
activebooleanFilter by active status
pagenumberPage number (default: 1)
limitnumberItems per page (default: 50, max: 1000)

Response

json
{ "success": true, "data": [ { "address": "0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE", "name": "SEI-USDC Concentrated LP", "strategy": "concentrated_liquidity", "tokenA": "SEI", "tokenB": "USDC", "fee": 0.003, "tickSpacing": 60, "tvl": 1250000, "apy": 0.125, "chainId": 1328, "active": true, "performance": { "totalReturn": 0.087, "sharpeRatio": 1.45, "maxDrawdown": 0.023, "winRate": 0.68 } } ], "count": 1, "chainId": 1328 }

POST /vaults

Create a new vault.

Request Body

json
{ "name": "SEI-USDC Concentrated LP", "strategy": "concentrated_liquidity", "tokenA": "SEI", "tokenB": "USDC", "fee": 0.003, "tickSpacing": 60, "chainId": 1328 }

Strategy Types

concentrated_liquidity

Concentrated liquidity positions

yield_farming

Yield farming strategies

arbitrage

Cross-DEX arbitrage

hedge

Hedging strategies

stable_max

Stablecoin maximizer

sei_hypergrowth

High-risk SEI growth strategy

blue_chip

Blue-chip token strategy

delta_neutral

Delta neutral market making

Response

json
{ "success": true, "data": { "address": "0x1234567890123456789012345678901234567890", "name": "SEI-USDC Concentrated LP", "strategy": "concentrated_liquidity", "tokenA": "SEI", "tokenB": "USDC", "fee": 0.003, "tickSpacing": 60, "tvl": 0, "apy": 0, "chainId": 1328, "active": true }, "message": "Vault created successfully", "chainId": 1328 }

GET /vaults/{address}

Get detailed vault information.

Parameters

address- SEI vault address (required)

Response

json
{ "success": true, "data": { "address": "0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE", "name": "SEI-USDC Concentrated LP", "strategy": "concentrated_liquidity", "tokenA": "SEI", "tokenB": "USDC", "fee": 0.003, "tvl": 1250000, "apy": 0.125, "position": { "lowerTick": -887220, "upperTick": 887220, "liquidity": "1000000000000000000", "tokensOwed0": "50000000", "tokensOwed1": "125000000" }, "risk": { "impermanentLoss": 0.023, "volatility": 0.18 } }, "chainId": 1328 }

AI Predictions

POST /ai/predict

Generate AI-powered liquidity range predictions.

Request Body

json
{ "vaultAddress": "0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE", "marketData": { "currentPrice": 0.485, "volume24h": 15678234, "volatility": 0.25, "liquidity": 125000000 }, "timeframe": "1d", "chainId": 1328 }

Timeframe Options

1h
4h
1d
7d
30d

Response

json
{ "success": true, "data": { "vaultAddress": "0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE", "prediction": { "optimalRange": { "lowerPrice": 0.425, "upperPrice": 0.545, "lowerTick": -12000, "upperTick": 12000, "currentTick": 0, "tickSpacing": 60 }, "confidence": 0.87, "expectedReturn": { "daily": 0.0012, "weekly": 0.0084, "monthly": 0.036 }, "riskMetrics": { "impermanentLossRisk": 0.18, "rebalanceFrequency": "medium", "maxDrawdown": 0.12, "sharpeRatio": 1.45 }, "seiOptimizations": { "gasOptimized": true, "fastFinality": true, "parallelExecution": true, "estimatedGasCost": 0.001, "blockConfirmations": 1 } }, "metadata": { "modelVersion": "2.1.0", "features": [ "price_momentum", "volatility_clustering", "liquidity_depth", "sei_specific_metrics" ], "processingTime": "~500ms", "chainOptimized": "SEI" } }, "timestamp": "2024-01-23T15:30:00Z", "chainId": 1328 }

POST /ai/rebalance

Trigger or schedule vault rebalancing.

Request Body

json
{ "vaultAddress": "0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE", "strategy": "threshold_based", "parameters": { "newLowerTick": -15000, "newUpperTick": 15000, "slippageTolerance": 0.005, "maxGasPrice": 0.001, "deadline": 1706023800 }, "chainId": 1328 }

Strategy Options

immediate

Execute rebalance immediately

scheduled

Schedule for future execution

threshold_based

Execute when thresholds are met

Response

json
{ "success": true, "data": { "transactionHash": "0xabc123...", "status": "pending", "gasUsed": "0.001", "executionTime": "450ms", "newPosition": { "lowerTick": -15000, "upperTick": 15000, "liquidity": "1050000000000000000" } }, "timestamp": "2024-01-23T15:30:00Z", "chainId": 1328 }

Market Data

GET /market/data

Get current market data for SEI ecosystem tokens.

Query Parameters

ParameterTypeDescription
symbolsstringComma-separated symbols (e.g., "SEI-USDC,ATOM-SEI")
timeframestringData timeframe (1m, 5m, 15m, 1h, 4h, 1d)

Response

json
{ "success": true, "data": [ { "symbol": "SEI-USDC", "price": 0.485, "change24h": 0.023, "changePercent24h": 4.98, "volume24h": "14.2M", "volumeUSD24h": 14200000, "high24h": 0.492, "low24h": 0.467, "liquidity": { "totalLocked": 125000000, "sei": 257732474, "usdc": 125000000 }, "seiMetrics": { "blockTime": 0.4, "tps": 5000, "gasPrice": 0.000001, "validators": 100 }, "timestamp": "2024-01-23T15:30:00Z", "source": "SEI_DEX_AGGREGATOR" } ], "timestamp": "2024-01-23T15:30:00Z", "chainId": 1328 }

GET /market/arbitrage

Scan for arbitrage opportunities across SEI DEXes.

Response

json
{ "success": true, "data": [ { "path": ["SEI", "USDC", "SEI"], "exchanges": ["DragonSwap", "SeiSwap"], "profit": 0.0125, "profitUSD": 156.25, "confidence": 0.92, "gasEstimate": 0.002, "netProfit": 0.0105, "execution": { "optimal": true, "urgency": "medium", "estimatedTime": "800ms" } } ], "scan": { "totalOpportunities": 1, "avgProfit": 0.0125, "timestamp": "2024-01-23T15:30:00Z" }, "chainId": 1328 }

Code Examples

Fetching Vault Data

javascript
const response = await fetch('https://www.yielddelta.xyz/api/vaults', { method: 'GET', headers: { 'Content-Type': 'application/json', }, }); const { data } = await response.json(); console.log('Vaults:', data);

Creating a Vault

javascript
const response = await fetch('https://www.yielddelta.xyz/api/vaults', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': 'your-api-key', }, body: JSON.stringify({ name: 'My SEI Vault', strategy: 'concentrated_liquidity', tokenA: 'SEI', tokenB: 'USDC', fee: 0.003, tickSpacing: 60, chainId: 1328, }), }); const { data } = await response.json(); console.log('Created vault:', data.address);

Getting AI Predictions

javascript
const response = await fetch('https://www.yielddelta.xyz/api/ai/predict', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': 'your-api-key', }, body: JSON.stringify({ vaultAddress: '0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE', marketData: { currentPrice: 0.485, volume24h: 15678234, volatility: 0.25, liquidity: 125000000, }, timeframe: '1d', chainId: 1328, }), }); const { data } = await response.json(); console.log('AI Prediction:', data.prediction);

Interacting with Smart Contracts

javascript
import { ethers } from 'ethers'; const provider = new ethers.JsonRpcProvider('https://evm-rpc-arctic-1.sei-apis.com'); const signer = new ethers.Wallet(privateKey, provider); const vaultABI = [...]; // Your vault ABI const vaultAddress = '0xf6A791e4773A60083AA29aaCCDc3bA5E900974fE'; const vault = new ethers.Contract(vaultAddress, vaultABI, signer); // Deposit into vault const amount0 = ethers.parseEther('10'); // 10 SEI const amount1 = ethers.parseUnits('5', 6); // 5 USDC const tx = await vault.deposit(amount0, amount1, signer.address); await tx.wait(); console.log('Deposited successfully!');

Error Codes

CodeDescription
400Bad Request - Invalid request data
401Unauthorized - Invalid or missing API key
404Not Found - Resource not found
429Too Many Requests - Rate limit exceeded
500Internal Server Error - Server error

Need help? Join our Discord or check the documentation.