Agent SkillsNeverSight/learn-skills.dev › bondterminal-x402

bondterminal-x402

GitHub

提供BondTerminal API查询技能,支持阿根廷债券数据、收益率曲线及风险分析。通过x402协议在Base链实现免密钥按次支付(USDC),自动处理签名与重试,适用于金融数据分析场景。

data/skills-md/0juano/agent-skills/bondterminal-x402/SKILL.md NeverSight/learn-skills.dev

Trigger Scenarios

用户查询阿根廷债券价格或现金流 用户获取国家风险评级(riesgo país) 用户查询国债收益率曲线 用户进行债券ISIN或代码查找

Install

npx skills add NeverSight/learn-skills.dev --skill bondterminal-x402 -g -y
More Options

Non-standard path

npx skills add https://github.com/NeverSight/learn-skills.dev/tree/main/data/skills-md/0juano/agent-skills/bondterminal-x402 -g -y

Use without installing

npx skills use NeverSight/learn-skills.dev@bondterminal-x402

指定 Agent (Claude Code)

npx skills add NeverSight/learn-skills.dev --skill bondterminal-x402 -a claude-code -g -y

安装 repo 全部 skill

npx skills add NeverSight/learn-skills.dev --all -g -y

预览 repo 内 skill

npx skills add NeverSight/learn-skills.dev --list

SKILL.md

Frontmatter
{
    "name": "bondterminal-x402",
    "metadata": {
        "author": "0juano",
        "version": "2.1.0"
    },
    "description": "Query BondTerminal API using x402 keyless payments. No API key needed — pay $0.01 USDC per request on Base mainnet. Use when users ask for Argentine bond data, analytics, cashflows, history, riesgo país, or ISIN\/ticker lookups (e.g. AL30, GD30, US040114HS26). Supports automatic 402 → payment → retry.\n"
}

BondTerminal x402

Query the BondTerminal API with x402 pay-per-call auth. No API key, no subscription — just sign and pay per request.

Cost: $0.01 USDC per request on Base mainnet.

API Endpoints

Base URL: https://bondterminal.com/api/v1

Method Endpoint Description Auth
GET /treasury-curve US Treasury yield curve Free
GET /bonds List all bonds (60+) x402
GET /bonds/:id Bond details by ISIN or local ticker x402
GET /bonds/:id/analytics Price, YTM, duration, spreads x402
GET /bonds/:id/cashflows Cashflow schedule x402
GET /bonds/:id/history Historical price/yield/spread x402
POST /calculate Bond analytics from custom price x402
GET /riesgo-pais Current Argentina country risk x402
GET /riesgo-pais/history Historical riesgo país series x402
POST /calculate/batch Batch calculations Bearer only

Identifier formats: ISIN (US040114HS26), local ticker with D/C suffix (AL30D, GD30D).

Full docs: https://bondterminal.com/developers Endpoint reference in this skill: references/endpoints.md

How x402 Works

  1. Call any x402 endpoint without auth → server returns 402 with PAYMENT-REQUIRED header
  2. Decode the header (base64 JSON) to get payment requirements (amount, asset, network, payTo)
  3. Sign an EIP-3009 transferWithAuthorization via the x402 client library
  4. Retry the request with the signed payment in the PAYMENT-SIGNATURE header (v2), with X-PAYMENT as legacy fallback
  5. Server verifies payment via Coinbase facilitator, returns data + PAYMENT-RESPONSE header

Setup

1. Install dependencies

npm install @x402/core @x402/evm viem

Note: The code examples use ES modules. Use .mjs file extension or add "type": "module" to your package.json.

2. Configure a signer

The x402 payment flow requires an EVM signer on Base mainnet with USDC balance. Configure your signer following the x402 EVM documentation.

The signer must implement { address, signTypedData } — any viem-compatible wallet client works (hardware wallet, KMS, injected provider, etc).

See references/signer-setup.md for a complete signer configuration example.

3. Register the x402 client

import { x402Client } from '@x402/core/client';
import { x402HTTPClient } from '@x402/core/http';
import { ExactEvmScheme } from '@x402/evm'; // exact export name

// signer = { address, signTypedData } — see references/signer-setup.md
const scheme = new ExactEvmScheme(signer);
const client = new x402Client();
client.register('eip155:8453', scheme); // Base mainnet
const httpClient = new x402HTTPClient(client);

Fetching Bond Data

async function fetchBT(path) {
  const url = `https://bondterminal.com/api/v1${path}`;
  let res = await fetch(url);

  if (res.status === 402) {
    const paymentRequired = httpClient.getPaymentRequiredResponse(
      (name) => res.headers.get(name),
      await res.json()
    );
    const payload = await httpClient.createPaymentPayload(paymentRequired);

    // Preferred v2 header
    res = await fetch(url, {
      headers: httpClient.encodePaymentSignatureHeader(payload),
    });

    // Legacy fallback for servers still expecting X-PAYMENT
    if (res.status === 402) {
      const encoded = Buffer.from(JSON.stringify(payload)).toString('base64');
      res = await fetch(url, { headers: { 'X-PAYMENT': encoded } });
    }
  }

  if (!res.ok) {
    throw new Error(`BondTerminal request failed (${res.status})`);
  }

  return res.json();
}

// Examples
const bonds = await fetchBT('/bonds');
const analytics = await fetchBT('/bonds/AL30D/analytics');
const riesgo = await fetchBT('/riesgo-pais');

Quick Test

Validate both free and paid flows:

await fetchBT('/treasury-curve'); // free route (no payment)
await fetchBT('/riesgo-pais');    // paid route (triggers x402 flow)

Wallet Requirements

The signing wallet needs:

  • USDC on Base — for the $0.01 payment per request

No ETH for gas is required — x402 uses EIP-3009 (off-chain signature), not on-chain transactions.

Notes

  • POST /calculate/batch requires a Bearer API key subscription — not available via x402
  • Local tickers require D/C suffix: AL30D (USD), AL30C (ARS) — not AL30
  • Settlement is on-chain: each paid call produces a verifiable transaction hash
  • The PAYMENT-RESPONSE header contains settlement metadata (payer, tx hash, network)

Version History

  • e0220ca Current 2026-07-05 20:29

Same Skill Collection

data/skills-md/00prabalk00/claude-skills/knowledge-base-gap-finder/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-agile/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-auth/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-issues/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-project-management/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-projects/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-safe/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-search/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-spaces/SKILL.md
data/skills-md/01000001-01001110/agent-jira-skills/jira-transitions/SKILL.md
data/skills-md/0731coderlee-sudo/wechat-publisher/wechat-publisher/SKILL.md
data/skills-md/0froq/skills/conventionalcommits/SKILL.md
data/skills-md/0froq/skills/nuxt/SKILL.md
data/skills-md/0froq/skills/oq/SKILL.md
data/skills-md/0froq/skills/pinia/SKILL.md
data/skills-md/0froq/skills/pnpm/SKILL.md
data/skills-md/0froq/skills/slidev/SKILL.md
data/skills-md/0froq/skills/tsdown/SKILL.md
data/skills-md/0froq/skills/turborepo/SKILL.md
data/skills-md/0froq/skills/unocss/SKILL.md
data/skills-md/0froq/skills/vitepress/SKILL.md
data/skills-md/0froq/skills/vitest/SKILL.md
data/skills-md/0froq/skills/vue-best-practices/SKILL.md
data/skills-md/0froq/skills/vue-router-best-practices/SKILL.md
data/skills-md/0froq/skills/vue-testing-best-practices/SKILL.md
data/skills-md/0froq/skills/vue/SKILL.md
data/skills-md/0froq/skills/vueuse-functions/SKILL.md
data/skills-md/0froq/skills/web-design-guidelines/SKILL.md
data/skills-md/0juano/agent-skills/edgeone-pages-deploy/SKILL.md
data/skills-md/0juano/agent-skills/ley-ar/SKILL.md
data/skills-md/0juano/agent-skills/ticktick/SKILL.md
data/skills-md/0juano/agent-skills/x-image-cards/SKILL.md
data/skills-md/0juano/x-image-cards/x-image-cards/SKILL.md
data/skills-md/0x0funky/agent-sprite-forge/generate2dsprite/SKILL.md
data/skills-md/0x0funky/agent-sprite-forge/video2dsprite/SKILL.md
data/skills-md/0x2e/superpowers/brainstorming/SKILL.md
data/skills-md/0x2e/superpowers/dispatching-parallel-agents/SKILL.md
data/skills-md/0x2e/superpowers/executing-plans/SKILL.md
data/skills-md/0x2e/superpowers/finishing-a-development-branch/SKILL.md
data/skills-md/0x2e/superpowers/receiving-code-review/SKILL.md
data/skills-md/0x2e/superpowers/requesting-code-review/SKILL.md
data/skills-md/0x2e/superpowers/subagent-driven-development/SKILL.md
data/skills-md/0x2e/superpowers/systematic-debugging/SKILL.md
data/skills-md/0x2e/superpowers/test-driven-development/SKILL.md
data/skills-md/0x2e/superpowers/using-git-worktrees/SKILL.md
data/skills-md/0x2e/superpowers/using-superpowers/SKILL.md
data/skills-md/0x2e/superpowers/verification-before-completion/SKILL.md
data/skills-md/0x2e/superpowers/writing-plans/SKILL.md
data/skills-md/0x2e/superpowers/writing-skills/SKILL.md

Metadata

Files
0
Version
e4a0f95
Hash
513786fa
Indexed
2026-07-05 20:29

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-03 23:09
浙ICP备14020137号-1 $Гость$