Cross-asset price monitor
Side-by-side snapshot of a stock and a crypto asset: the equity's latest close against a live crypto quote, a trailing-year series for each, and a date-stamped comparison.
5 tools run server-side in one request. You pay once, settle once, and get a single response - no orchestration, no per-step payments, and a partial-success envelope if any step fails. USDC over x402 on any supported chain.
When to use this pack
An agent or analyst wants to compare a traditional equity with a crypto asset - e.g. 'How has AAPL performed versus BTC over the last year?' Running stock-quote and crypto-price individually gives two disconnected numbers; adding historical data from both sides plus a date-format timestamp turns it into a dated comparison card the caller can track over time or feed into a report. Useful for portfolio dashboards, market-update bots, newsletter generators, and any agent that needs a quick cross-asset health check.
Tools in this pack
All 5 run inside the single $0.021 call above. Each is also callable on its own if you only need one part.
- Stock quote GET /api/stock-quote End-of-day US equity quote: last close, day range, previous close and the change between them. US equities only; indices, FX and crypto are not covered (crypto-price serves those). Built from a four-venue consolidation (Databento DBEQ.BASIC), so the prices track the wider market but the volume counts those four venues only and is returned as venueVolume rather than as a total. No 52-week range and no intraday print: for a date range call stock-history.
- Stock historical bars GET /api/stock-history Daily OHLCV bars for a US equity: the last `days` sessions, 1 to 250, default 30. Daily only, no intraday. Built from a four-venue consolidation (Databento DBEQ.BASIC), so each bar's high and low are the extremes across those venues, open and close come from the venue that traded the most that session, and venueVolume sums those four venues rather than the consolidated tape. A flat ascending array ready for charting or backtests.
- Crypto price GET /api/crypto-price Live crypto prices for one or many coins in any vs_currency (usd, eur, btc, eth, etc). Returns last price, 24h change %, 24h volume, and market cap per coin. The simplest crypto price read - for ranked market-cap tables use crypto-market, for candles use crypto-history. Accepts ticker symbols (BTC, ETH, SOL) for the top ~50 by market cap, or canonical CoinGecko ids (e.g. "render-token") for any of the ~15k tracked coins. Batched: up to 25 coins per call. Backed by CoinGecko's API (this server's Demo key when configured, else the shared keyless rate).
- Crypto price history GET /api/crypto-history Historical price, market cap, and volume time series for a coin. Granularity is automatic per CoinGecko: <=1 day = 5-min bars, 2-90 days = hourly, >90 days = daily. Days: 1, 7, 14, 30, 90, 180, 365, or "max". Returns aligned arrays of {time, price, marketCap, volume}.
- Date format GET /api/date-format Parse a datetime from any format (ISO 8601, Unix timestamp in seconds or milliseconds, RFC 2822, or natural date string) and return it in every common format: ISO 8601, Unix (seconds), Unix (ms), RFC 2822, date-only, time-only, day of week, and human-relative (e.g. '3 days ago'). ?datetime=1719100800.
Workflow
- Call date-format with datetime='now' (or the current ISO timestamp) to get a formatted snapshot timestamp - ISO, date-only, and day of week. This anchors the comparison to a specific point in time so the caller can track changes across repeated runs. The unix timestamp is useful as a cache key or filename.
- Call stock-quote with symbol=<ticker> to get the equity's latest close: price, previousClose, changeAbs, changePct, dayHigh, dayLow and venueVolume. This is end-of-day, not an intraday print, and venueVolume counts four venues rather than the whole market - note the timestamp from step 1 so the caller knows which session it is.
- Call stock-history with symbol=<ticker> and days=250 to get a trailing-year price series (250 sessions is the maximum this endpoint serves). Extract the first and last data points to compute the year-over-year return: ((last - first) / first * 100). This is the equity's trailing-12-month performance.
- Call crypto-price with coins=<coin> and currency=usd to get the live crypto price: price, market_cap, 24h_volume, 24h_change. This is the 'right now' read for the crypto side.
- Call crypto-history with coin=<coin>, days=365, and currency=usd to get the 1-year price series. Compute the year-over-year return the same way as step 3. Final payload: { timestamp: <step 1>, stock: { symbol, price, change, changePercent, yearReturn }, crypto: { coin, price, change24h, yearReturn }, comparison: { stockOutperforms: stockYearReturn > cryptoYearReturn, spreadPct: Math.abs(stockYearReturn - cryptoYearReturn) } }.
Call it directly
Any x402 client pays the 402 and gets the whole workflow back in one response:
npx agent402-client call price-monitor {"ticker":"AAPL","coin":"bitcoin"}
Run it in Claude
claude mcp add agent402 -s user -- npx -y agent402-mcp@latest
Then paste this prompt into Claude:
Build a cross-asset price comparison for ticker=AAPL vs coin=bitcoin using Agent402.
(1) date-format with datetime=new Date().toISOString() - returns {iso, date, dayOfWeek, unix}. Save as snapshot timestamp.
(2) stock-quote with symbol=AAPL - returns {price, previousClose, changeAbs, changePct, dayHigh, dayLow, venueVolume}.
(3) stock-history with symbol=AAPL, days=250 - returns {bars: [{day, close}]}. Compute stockYearReturn = ((bars[last].close - bars[0].close) / bars[0].close * 100).toFixed(2).
(4) crypto-price with coins=bitcoin, currency='usd' - returns [{price, market_cap, change_24h}].
(5) crypto-history with coin=bitcoin, days='365', currency='usd' - returns {prices: [[timestamp, price]]}. Compute cryptoYearReturn = ((prices[last][1] - prices[0][1]) / prices[0][1] * 100).toFixed(2).
Final return: {timestamp: {iso: <step 1 iso>, date: <step 1 date>, dayOfWeek: <step 1 dayOfWeek>}, stock: {symbol: 'AAPL', price: <step 2 price>, change: <step 2 change>, changePercent: <step 2 changePercent>, yearReturn: stockYearReturn}, crypto: {coin: 'bitcoin', price: <step 4 price>, change24h: <step 4 change_24h>, yearReturn: cryptoYearReturn}, comparison: {stockOutperforms: parseFloat(stockYearReturn) > parseFloat(cryptoYearReturn), spreadPct: Math.abs(parseFloat(stockYearReturn) - parseFloat(cryptoYearReturn)).toFixed(2)}}. Budget ~$0.005 paid; all 5 tools are wallet-only (external API calls).