tickersfeed
v1.1.0
Published
SDK for TickersFeed — pay-per-call stock & crypto data API for AI agents. No API keys, just USDC micropayments on Base.
Maintainers
Readme
tickersfeed
SDK for TickersFeed — pay-per-call stock & crypto data API for AI agents.
No API keys. No subscriptions. Your agent pays a fraction of a cent in USDC per request and gets instant market data.
Install
npm install tickersfeed ethersQuick Start
import { TickersFeed } from 'tickersfeed';
const tf = new TickersFeed({ privateKey: process.env.WALLET_KEY });
const quote = await tf.stock('AAPL');
console.log(`Apple: $${quote.quote.c}`);Prerequisites
- Node.js 18+
- A wallet with USDC on Base (even $1 is enough for hundreds of calls)
- Get testnet USDC from faucet.circle.com to try it free
Endpoints & Pricing
| Method | Cost | Description |
|---|---|---|
| tf.stock('AAPL') | $0.003 | Real-time/delayed stock quote |
| tf.stockEarnings('AAPL') | $0.003 | Last 4 quarters of earnings |
| tf.stockNews('AAPL') | $0.005 | News + sentiment analysis |
| tf.crypto('BTC') | $0.002 | Crypto price data |
| tf.cryptoMarket() | $0.001 | Top crypto by market cap |
| tf.defiYields() | $0.001 | Best DeFi yield opportunities |
| tf.defiProtocols() | $0.001 | Top DeFi protocols by TVL |
| tf.gas() | $0.001 | Ethereum + Base gas prices |
| tf.walletTransfers(addr) | $0.003 | USDC transfer history |
| tf.walletPortfolio(addr) | $0.003 | Multi-token balances |
| tf.chainStats('base') | $0.002 | Daily on-chain stats |
| AI Analysis | | |
| tf.analyzeStock('AAPL') | $0.03 | AI stock analysis (quote + earnings + news) |
| tf.analyzeCrypto('BTC') | $0.02 | AI crypto analysis |
| tf.analyzeMarket() | $0.05 | AI market overview (stocks + crypto + DeFi) |
| tf.compare('AAPL', 'TSLA') | $0.05 | AI head-to-head comparison |
| tf.analyzePortfolio(addr) | $0.08 | AI on-chain portfolio analysis |
Examples
Stock quote
const quote = await tf.stock('TSLA');
console.log(quote.quote);
// { c: 248.50, h: 252.10, l: 245.30, o: 247.00, pc: 246.80, dp: 0.69, t: 1718... }Earnings
const earnings = await tf.stockEarnings('NVDA');
for (const q of earnings.earnings) {
console.log(`${q.period}: actual ${q.actual} vs estimate ${q.estimate} (${q.surprisePercent}%)`);
}Crypto market overview
const market = await tf.cryptoMarket();
console.log(`Total crypto market cap: $${(market.market.total_market_cap_usd / 1e12).toFixed(2)}T`);
for (const coin of market.top.slice(0, 5)) {
console.log(` ${coin.symbol}: $${coin.price_usd.toFixed(2)} (${coin.change_24h > 0 ? '+' : ''}${coin.change_24h.toFixed(1)}%)`);
}DeFi yields
const yields = await tf.defiYields({ chain: 'base', min_tvl: 1000000, limit: 5 });
for (const pool of yields.pools) {
console.log(`${pool.project} ${pool.symbol}: ${pool.apy_total.toFixed(1)}% APY ($${(pool.tvl_usd / 1e6).toFixed(1)}M TVL)`);
}Wallet portfolio
const portfolio = await tf.walletPortfolio('0xYOUR_ADDRESS', { chain: 'base' });
for (const token of portfolio.tokens) {
console.log(`${token.symbol}: ${token.balance}`);
}AI stock analysis
const report = await tf.analyzeStock('AAPL');
console.log(report.analysis.summary);
console.log(`Outlook: ${report.analysis.outlook}`);
console.log(`Risks: ${report.analysis.risks.join(', ')}`);AI asset comparison
const cmp = await tf.compare('AAPL', 'TSLA');
console.log(cmp.analysis.verdict);
for (const diff of cmp.analysis.key_differences) {
console.log(` - ${diff}`);
}AI market overview
const market = await tf.analyzeMarket();
console.log(market.analysis.summary);
console.log(`Outlook: ${market.analysis.outlook}`);On-chain stats
const stats = await tf.chainStats('base', { days: 7 });
for (const day of stats.daily_stats) {
console.log(`${day.date}: ${(day.tx_count / 1e6).toFixed(1)}M txns, ${day.active_addresses.toLocaleString()} addresses`);
}Error Handling
import { TickersFeed, TickersFeedError } from 'tickersfeed';
try {
const quote = await tf.stock('INVALID');
} catch (err) {
if (err instanceof TickersFeedError) {
console.log(`API error ${err.status}: ${err.message}`);
}
}How It Works
Each API call automatically handles the x402 payment protocol:
- Requests the endpoint → receives HTTP 402 with price
- Signs a USDC micropayment on Base using your wallet
- Retries with the payment → receives the data
You never interact with the blockchain directly — the SDK handles everything.
License
MIT
