Asset Analysis
NewUpdated
The Assets namespace gives you access to real-time and historical market data, news, and AI analysis for crypto, stocks, and other asset classes.
In this guide you'll learn how to:
- Search and list assets
- Track top market movers
- Fetch historical prices
- Read asset news
- Run AI-powered analysis
Find Assets
Search by name or symbol to find assets, then fetch detailed data.
import { Chaos } from '@chaoslabs/ai-sdk';
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
// Search by name
const { coins } = await chaos.assets.search('uniswap');
console.log(`Found: ${coins?.map(c => c.symbol).join(', ')}`);
// Get full details
const eth = await chaos.assets.get('crypto', 'ethereum');
console.log(`${eth.name}: $${eth.price} (${eth.change_percent_24h > 0 ? '+' : ''}${eth.change_percent_24h}%)`);Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Market Movers
Track what's moving ā top gainers, losers, and trending assets.
const { top_gainers, top_losers } = await chaos.assets.topGainersLosers('crypto');
console.log('š¢ Top Gainers:');
for (const a of top_gainers.slice(0, 5)) {
console.log(` ${a.symbol}: +${a.change_percent_24h.toFixed(1)}%`);
}
console.log('\nš“ Top Losers:');
for (const a of top_losers.slice(0, 5)) {
console.log(` ${a.symbol}: ${a.change_percent_24h.toFixed(1)}%`);
}Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Historical Prices
Look up asset prices at any point in time using Unix timestamps.
// BTC price on Jan 1, 2024
const price = await chaos.assets.historicalPrice('crypto', 'bitcoin', 1704067200);
console.log(`Date: ${price.nearestTradingDay}`);
console.log(`Close: $${price.close}`);
console.log(`Range: $${price.low} ā $${price.high}`);Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
News & AI Analysis
Read recent news and then ask the AI to analyze an asset.
// Get recent news
const news = await chaos.assets.news('crypto', 'ethereum', 5);
for (const article of news) {
console.log(`š° ${article.title}`);
}
// Run AI analysis
const session = await chaos.assets.analyse(
'crypto',
'ethereum',
'Summarize the key risks and opportunities'
);
console.log(`\nAnalysis session: ${session.sessionId}`);
console.log(`Title: ${session.title}`);Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Was this helpful?