# macro-analyst

An agent skill for macro / market-regime analysis using pay-per-call x402 APIs (USDC on Base, no account needed).
Provider: Mekong Trade Intelligence — https://api.mekongtradeintel.com/tools/store/

## When to use
User asks about the macro picture: inflation, Fed policy, FX, news flow, search trends, or market sentiment.
Trigger phrases: "macro outlook", "USDVND rate", "what is the market worried about", "trending topics".

## Tools (in recommended call order)
1. **macro** — macro indicators (CPI, Fed rate, unemployment, GDP). GET https://api.mekongtradeintel.com/macro/api/macro?indicator=cpi — $0.002/call
   indicator ∈ {cpi, fed_rate, unemployment, gdp}
2. **fxrates** — FX reference rates. POST https://api.mekongtradeintel.com/fxrates/api/fx — $0.001/call
   Body: `{"pair":"USDVND"}` (daily reference, not real-time)
3. **news** — financial news search. POST https://api.mekongtradeintel.com/news/api/news — $0.001/call
   Body: `{"topic":"Federal Reserve"}`
4. **trendsintel** — Google search-trend intelligence. GET https://api.mekongtradeintel.com/trendsintel?query=recession — $0.10/call
5. **sentiment** — news/social sentiment analysis. POST https://api.mekongtradeintel.com/sentiment — $0.03/call
   Body: `{"text":"<paste headlines>"}` (see /openapi for fields)
6. **aiverdict** — AI verdict combining evidence into a call. POST https://api.mekongtradeintel.com/aiverdict — $0.01/call
   Body: `{"evidence":"<paste findings from steps 1-5>"}`

## Payment (x402 v2, exact scheme, USDC on Base)
1. Send the request UNPAID first. You get HTTP 402 with a `PAYMENT-REQUIRED` header (base64 JSON) describing amount, asset (USDC `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`), payTo, network `eip155:8453`.
2. Sign the payment with the user's wallet (via the x402 client lib — never ask the user to paste a private key).
3. Retry the SAME request with the `X-PAYMENT` (v1) or `PAYMENT-SIGNATURE` (v2) header.
4. A small free daily trial quota applies before payment is required — use it for smoke tests.

## Workflow
- Regime snapshot (cheap): macro (2-3 indicators) → fxrates → news. Total <$0.01.
- Sentiment read: sentiment on the day's headlines → aiverdict for the combined call. Total ~$0.04.
- trendsintel is the expensive one ($0.10) — use it only when the user explicitly wants trend data, or after the cheap snapshot suggests something worth digging into.
- ALWAYS run the cheap tools first and ask the user before spending >$0.10 in one turn.

## Example prompts
- "Macro snapshot: CPI, Fed rate, USDVND, and today's Fed news."
- "What is market sentiment on tech stocks right now? Analyze these headlines and give me a verdict."
- "Is 'recession' trending in search? Then cross-check with the macro data."
