Listing & Market Movers
Updated
Browse paginated asset lists with optional filtering, and track what is moving in the market with top gainers, losers, and trending assets.
list(params?)
Returns a paginated list of assets with real-time market data. All parameters are optional -- call with no arguments to get the first page of all asset types.
Parameters:
| Param | Type | Description |
|---|---|---|
page | number | Page number (1-indexed). Defaults to 1. |
limit | number | Results per page. Defaults to server limit. |
assetType | AssetType | Filter by asset class: 'crypto', 'stock', 'etf', etc. |
search | string | Keyword filter applied to name and symbol. |
Returns: AssetListResponse
import { Chaos } from '@chaoslabs/ai-sdk';
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
// Get the first page of crypto assets
const { assets, total, page, limit } = await chaos.assets.list({
assetType: 'crypto',
limit: 20,
});
console.log(`Page ${page} of ${Math.ceil(total / limit)} (${total} total)`);
for (const a of assets) {
const direction = a.change_percent_24h > 0 ? '+' : '';
console.log(`${a.symbol} — $${a.price} (${direction}${a.change_percent_24h}%)`);
}Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
// Filter by keyword within a specific asset type
const { assets } = await chaos.assets.list({
assetType: 'stock',
search: 'tech',
page: 1,
limit: 10,
});
for (const a of assets) {
console.log(`${a.name} (${a.symbol}): $${a.price}`);
}Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
topGainersLosers(assetType?)
Returns the top market movers -- gainers, losers, and trending assets. Pass an AssetType to narrow results to a single asset class, or omit it to get movers across all types.
Parameters:
| Param | Type | Description |
|---|---|---|
assetType | AssetType | Optional. Filter movers to a specific asset class. |
Returns: TopGainersLosersResponse
import { Chaos } from '@chaoslabs/ai-sdk';
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
// Crypto market movers
const { top, top_gainers, top_losers, trending } = await chaos.assets.topGainersLosers('crypto');
console.log('Top Assets:');
for (const a of top) {
console.log(` ${a.symbol}: $${a.price} (mkt cap $${a.market_cap.toLocaleString()})`);
}
console.log('\nTop Gainers:');
for (const a of top_gainers) {
console.log(` ${a.symbol}: +${a.change_percent_24h.toFixed(2)}%`);
}
console.log('\nTop Losers:');
for (const a of top_losers) {
console.log(` ${a.symbol}: ${a.change_percent_24h.toFixed(2)}%`);
}
if (trending?.length) {
console.log('\nTrending:');
for (const a of trending) {
console.log(` ${a.symbol}: $${a.price}`);
}
}Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Was this helpful?