Assets
NewUpdated
The chaos.assets namespace provides access to asset data across crypto, stocks, ETFs, and other asset classes. List assets with real-time market data, find top gainers and losers, search by name or symbol, fetch historical prices, read news, and run AI-powered analysis sessions.
import { Chaos } from '@chaoslabs/ai-sdk';
const chaos = new Chaos({ apiKey: process.env.CHAOS_API_KEY! });
// List assets with pagination
const { assets, total } = await chaos.assets.list({ assetType: 'crypto', limit: 20 });
// Top gainers and losers
const movers = await chaos.assets.topGainersLosers('crypto');
// Search by name or symbol
const results = await chaos.assets.search('ethereum');
// Advanced search with filters
const filtered = await chaos.assets.searchAdvanced({ market_cap_min: 1_000_000_000 });
// Batch fetch by IDs
const batch = await chaos.assets.byIds('crypto', ['bitcoin', 'ethereum']);
// Full asset details
const detail = await chaos.assets.get('crypto', 'bitcoin');
// Historical price at a specific timestamp
const price = await chaos.assets.historicalPrice('crypto', 'bitcoin', 1704067200);
// Recent news
const news = await chaos.assets.news('crypto', 'ethereum', 10);
// AI analysis session
const session = await chaos.assets.analyse('crypto', 'bitcoin', 'What is the risk profile?');Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Method Reference
| Method | HTTP | Endpoint | Returns |
|---|---|---|---|
list(params?) | GET | /v1/assets/list | AssetListResponse |
topGainersLosers(assetType?) | GET | /v1/assets/top_gainers_losers | TopGainersLosersResponse |
search(query) | GET | /v1/assets/search | AssetSearchResponse |
searchAdvanced(params) | POST | /v1/assets/search | AssetSearchResponse |
byIds(assetType, ids) | GET | /v1/assets/by-ids/{assetType} | AssetsResponse |
get(assetType, assetId, startDate?) | GET | /v1/asset/{assetType}/{assetId} | AssetDetails |
historicalPrice(assetType, assetId, timestamp) | GET | /v1/assets/price/historical/{assetType}/{assetId} | HistoricalPriceResponse |
news(assetType, assetId, limit?) | GET | /v1/asset/{assetType}/{assetId}/news | AssetNews[] |
analyse(assetType, assetId, query?) | POST | /v1/asset/{assetType}/{assetId}/analyse | SessionData |
Core Types
type AssetType = 'crypto' | 'stock' | 'equity' | 'bond' | 'commodity' | 'forex' | 'derivative' | 'etf' | 'index';
interface AssetListParams {
page?: number;
limit?: number;
assetType?: AssetType;
search?: string;
}
interface Asset {
id: string;
name: string;
symbol: string;
icon_url?: string | null;
type: AssetType;
price: number;
change_percent_24h: number;
market_cap: number;
trade_volume_24h?: number;
[key: string]: unknown;
}
interface AssetListResponse {
assets: Asset[];
total: number;
page: number;
limit: number;
asset_type?: AssetType | null;
}
interface TopGainersLosersResponse {
top: Asset[];
top_gainers: Asset[];
top_losers: Asset[];
trending?: Asset[] | null;
}
interface AssetsResponse {
assets: Asset[];
}
interface AssetSearchResponse {
coins?: Array<{ id: string; name: string; symbol: string; [key: string]: unknown }>;
[key: string]: unknown;
}
interface AdvancedSearchParams {
[key: string]: unknown;
}
interface AssetDetails {
id: string;
name: string;
symbol: string;
icon_url?: string | null;
type: AssetType;
price: number;
change_percent_24h: number;
market_cap: number;
[key: string]: unknown;
}
interface HistoricalPriceResponse {
assetId: string;
assetType: string;
requestedDate: string;
nearestTradingDay: string;
close: number;
open?: number | null;
high?: number | null;
low?: number | null;
}
interface AssetNews {
id: string;
title: string;
description: string;
tags: string[];
updated_at: string;
[key: string]: unknown;
}
interface SessionData {
sessionId: string;
userId: string;
createdAt: number;
updatedAt: number;
type: string;
workflowId: string;
workflowName: string;
title: string;
isBookmarked: boolean;
isPublished: boolean;
blocks: unknown[];
agentMessages: unknown[];
}Copy code
Open in Cursor
Open in VS Code
Open in v0
Open in Claude
Open in ChatGPT
Was this helpful?