# @defillama/api 中文文档

规范地址：https://npmcn.com/package/%40defillama/api/

版本：0\.1\.5
npm 元数据更新时间：2026-11-04T15:57:55.040Z
中文译文更新时间：2026-11-11T20:56:45.909Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40defillama/api
原文对照：https://npmcn.com/package/%40defillama/api/?lang=original

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：554 kB，8 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=18\.0\.0
- 运行依赖：0 个
- 首次发布：2026-01-19T12:19:47.375Z
- 最新版本发布：2026-11-04T15:57:54.845Z
- 近 30 天下载量：3569（2026-10-12 至 2026-11-10，npm 官方下载统计）
- 已发布版本数：5（近 12 个月 5 个）

## 中文简介

DefiLlama API 的脚本 SDK 类型

## 安装

```sh
npm install @defillama/api
```

也可以使用：`pnpm add @defillama/api`、`yarn add @defillama/api`、`bun add @defillama/api`

## README

# 德菲拉玛 SDK

正式类型SDK [DefiLlama API (英语)](https://api-docs.defillama.com/)。访问DeFi协议数据,包括TVL、价格、产量、数量、费用、桥梁等等.

## 安装

```bash
npm install @defillama/api
```

```bash
yarn add @defillama/api
```

```bash
pnpm add @defillama/api
```

## 快速启动

```typescript
import { DefiLlama } from "@defillama/api";

// Free tier
const client = new DefiLlama();

// Pro tier (required for premium endpoints)
const proClient = new DefiLlama({
  apiKey: "your-api-key",
});

// Get all protocols
const protocols = await client.tvl.getProtocols();

// Get current token prices
const prices = await client.prices.getCurrentPrices([
  "ethereum:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "coingecko:bitcoin",
]);
```

## 配置

```typescript
interface DefiLlamaConfig {
  apiKey?: string; // API key from https://defillama.com/subscription (requires API plan)
  timeout?: number; // Request timeout in ms (default: 30000)
}
```

## 模块

-   [TVL 电视剧](https://npmcn.com/package/%40defillama/api/#readme-tvl) - 总价值锁定数据
-   [价格](https://npmcn.com/package/%40defillama/api/#readme-prices) - 托肯价格数据
-   [稳定币](https://npmcn.com/package/%40defillama/api/#readme-stablecoins) - 稳定币市场数据
-   [也门](https://npmcn.com/package/%40defillama/api/#readme-yields) - 平均耕作和贷款利率
-   [音量](https://npmcn.com/package/%40defillama/api/#readme-volumes) - DEX和衍生物体积
-   [收费](https://npmcn.com/package/%40defillama/api/#readme-fees) - 礼宾费和收入
-   [排放量](https://npmcn.com/package/%40defillama/api/#readme-emissions) - Token 解锁时间表
-   [桥梁](https://npmcn.com/package/%40defillama/api/#readme-bridges) - 跨链桥数据
-   [生态系统](https://npmcn.com/package/%40defillama/api/#readme-ecosystem) - 类别、甲骨文、国库
-   [电子信托基金](https://npmcn.com/package/%40defillama/api/#readme-etfs) - Bitcoin & Ethereum ETF 数据
-   [数字](https://npmcn.com/package/%40defillama/api/#readme-dat) - 数字资产库数据
-   [账户](https://npmcn.com/package/%40defillama/api/#readme-account) - API使用管理

\= 需要Pro API 密钥

* * *

## TVL 电视剧

协议和链条的总值锁定数据 .

### 获取协议

用当前 TVL 获取所有协议 .

```typescript
const protocols = await client.tvl.getProtocols();
// Returns: Protocol[]
```

### 获取协议

获得详细的协议信息,包括历史TVL.

```typescript
const aave = await client.tvl.getProtocol("aave");
// Returns: ProtocolDetails
```

### 获取Tvl

只获取当前 TVL 协议 .

```typescript
const tvl = await client.tvl.getTvl("uniswap");
// Returns: number
```

### 获取钱

获取当前 TVL 所有链条.

```typescript
const chains = await client.tvl.getChains();
// Returns: Chain[]
```

### 获取历史 ChainTvl

获取历史TVL数据.

```typescript
// All chains combined
const allHistory = await client.tvl.getHistoricalChainTvl();

// Specific chain
const ethHistory = await client.tvl.getHistoricalChainTvl("Ethereum");
```

### 获取托肯协议 {}

获取持有特定标志的协议 .

```typescript
const holders = await proClient.tvl.getTokenProtocols("ETH");
// Returns: TokenProtocolHolding[]
```

### 获得流入量QQ

在时间戳之间取得象征性的流入/流出.

```typescript
const inflows = await proClient.tvl.getInflows(
  "lido",
  1704067200, // start timestamp
  1704153600, // end timestamp
  "ETH,USDC" // optional tokens to exclude
);
```

### 获取 ChanAssets 键

所有连锁店都要分解资产.

```typescript
const assets = await proClient.tvl.getChainAssets();
// Returns: ChainAssetsResponse
```

* * *

## 价格

Token价格数据和历史图表.

### 获取当前价格

获得多个符的当前价格 .

```typescript
const prices = await client.prices.getCurrentPrices([
  "ethereum:0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
  "coingecko:bitcoin",
  "solana:So11111111111111111111111111111111111111112", // SOL
]);
// Returns: CoinPricesResponse
```

### 获取历史属性

以特定时间标价.

```typescript
const prices = await client.prices.getHistoricalPrices(1704067200, [
  "ethereum:0xdac17f958d2ee523a2206206994597c13d831ec7",
]);
```

### 获得历史属性

在一个请求中获取多个历史价格点.

```typescript
const prices = await client.prices.getBatchHistoricalPrices({
  "ethereum:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48": [
    1704067200, 1704153600, 1704240000,
  ],
});
```

### 获取图表

定期获取价格图表数据.

```typescript
const chart = await client.prices.getChart(["coingecko:ethereum"], {
  start: 1704067200,
  period: "1d",
  span: 30,
});
```

**选项 :**

| 参数 | 类型 | 说明 |
| --- | --- | --- |
| 开始 | 编号 | 最早数据点的解九时间戳 |
| 结束 | 编号 | 最新数据点的解九时间戳 |
| 间距 | 编号 | 返回的数据点数 |
| 期间 | 字符串 | 点之间(如"4h","1d","1W"等)的期限 |
| 搜索窗口 | 字符串 | 搜索的时间范围 |

### 获取百分比变化

获得一段时间内的百分比价格变化.

```typescript
const change = await client.prices.getPercentageChange(["coingecko:bitcoin"], {
  period: "24h",
});
```

### 获取第一价格

获得最早的征兆记录价格.

```typescript
const first = await client.prices.getFirstPrices([
  "ethereum:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
]);
```

### 获得 Block 时间戳

获取最接近给定的时间戳.

```typescript
const block = await client.prices.getBlockAtTimestamp("ethereum", 1704067200);
// Returns: { height: number; timestamp: number }
```

* * *

## 稳定币

稳定币市场上限和支配地位数据.

### 获得稳定币

得到所有马厩的市场封顶.

```typescript
const stables = await client.stablecoins.getStablecoins(true); // include prices
// Returns: StablecoinsResponse
```

### 获取全部图表

获得所有马来币的历史市场封顶.

```typescript
const charts = await client.stablecoins.getAllCharts();
// Returns: StablecoinChartDataPoint[]
```

### 获取图表ByChain

在一个特定的链上为马来币获得历史市场封顶.

```typescript
const ethCharts = await client.stablecoins.getChartsByChain("Ethereum");
```

### 获得稳定币

获取详细稳定币信息.

```typescript
const usdt = await client.stablecoins.getStablecoin("1"); // USDT
const usdc = await client.stablecoins.getStablecoin("2"); // USDC
```

### 获取钱

获得所有链条的当前稳定币市场封顶.

```typescript
const chains = await client.stablecoins.getChains();
// Returns: StablecoinChainMcap[]
```

### 获取价格

获得所有马厩币的历史价格.

```typescript
const prices = await client.stablecoins.getPrices();
```

### 获得主 {}

获取一个链条的稳定币主导数据.

```typescript
const dominance = await proClient.stablecoins.getDominance("ethereum", 1);
```

* * *

## 义尔兹

农业、贷款、抵押和长期供资率. **所有端点都需要 Pro API 密钥.**

### 获取Earn

获得所有收入池(提供至少一万元的池).

```typescript
const { as_of, data } = await proClient.yields.getEarn();
// Returns: { as_of?: string; data: EarnPool[] }
const pool = data[0];
pool.protocol; // "Aave V3" (display name, not a slug)
pool.apy.current.total; // also apy.avg_7d / apy.avg_30d, each { base, reward, total }
pool.underlying_tokens; // [{ address, symbol, decimals }]
```

### 查询

过滤器和相接器 赚取池服务器侧. `chain` 财务报告和审定财务报表 `protocol` 是sults(每行最多20个值);行由TVL下行排序.

```typescript
const { data, pagination } = await proClient.yields.queryEarn({
  chain: ["ethereum", "arbitrum"],
  protocol: "aave-v3",
  stablecoin: true, // also single_asset_exposure, impermanent_loss_risk
  min_tvl: 1_000_000,
  limit: 100, // 1-300, default 100
  page: 1,
});
// Returns: { data: EarnPool[]; pagination: { total; page; limit } }
```

### 获取Earn历史

获得每日TVL/APY历史 收入池. `range` 实值 `"30d"`, (中文(简体) ), `"90d"` 或者说 `"max"` (默认).

```typescript
const { data } = await proClient.yields.getEarnHistory("747c1d2a-c668-4682-b9f9-296708a3dd90", "30d");
// Returns: { data: EarnHistoryPoint[] } — { date, tvl_usd, apy: { avg_1d, avg_7d, avg_30d }, ... }
```

### 获取 Borrow 市场

得到所有借款市场 供应APY,借款成本,LTV,和流动性.

```typescript
const { data } = await proClient.yields.getBorrowMarkets();
// Returns: { as_of?: string; data: BorrowMarket[] }
```

### 获取 Borrow 市场历史

为市场获得日常借方历史. `range` 实值 `"30d"`, (中文(简体) ), `"90d"` 或者说 `"max"` (默认).

```typescript
const { data } = await proClient.yields.getBorrowMarketHistory("e880e828-ca59-4ec6-8d4f-27182a4dc23d", "90d");
// Returns: { data: BorrowMarketHistoryPoint[] }
```

### 获取伯普供资

获得永久期货融资利率,公开利息和指数价格(Binance and OKX).

```typescript
const perps = await proClient.yields.getPerpFundingRates();
// Returns: { status: string; data: PerpPool[] }
```

### 获取 LstRates 数据

得到流动证券汇率.

```typescript
const lstRates = await proClient.yields.getLstRates();
// Returns: LsdRate[]
```

* * *

## 音量

DEX,期权,和衍生产品交易量数据.

### 获取 Dex 概览

获得所有DEX卷数据的总览.

```typescript
const overview = await client.volumes.getDexOverview();

// With options
const overview = await client.volumes.getDexOverview({
  excludeTotalDataChart: true,
  dataType: "dailyVolume",
});
```

### 获取 Dex 概览ByChain

获取特定链的 DEX 音量 .

```typescript
const ethVolume = await client.volumes.getDexOverviewByChain("Ethereum");
```

### 获取Dex 概要

获取特定DEX协议的摘要 .

```typescript
const uniswap = await client.volumes.getDexSummary("uniswap");
```

### 获取选项概览

获取选项量数据概览 .

```typescript
const options = await client.volumes.getOptionsOverview();
```

### 获取选项概览ByChain

获取特定链条的选项量 .

```typescript
const ethOptions = await client.volumes.getOptionsOverviewByChain("Ethereum");
```

### 获取选项摘要

获取特定选项协议的摘要 .

```typescript
const derive = await client.volumes.getOptionsSummary("derive");
```

### 概况

获得衍生物体积数据综述.

```typescript
const derivatives = await proClient.volumes.getDerivativesOverview();
```

### 简表

获取特定衍生物协议的摘要.

```typescript
const gmx = await proClient.volumes.getDerivativesSummary("gmx");
```

### 获取 Dex 度量衡QQ

获得协议列表中的DEX 度量衡摘要(无图表).

```typescript
const metrics = await proClient.volumes.getDexMetrics();

// With data type
const metrics = await proClient.volumes.getDexMetrics({
  dataType: "dailyVolume",
});
```

### 获得“按协议计量” {}

为特定协议获取 DEX 度量衡 .

```typescript
const uniswap = await proClient.volumes.getDexMetricsByProtocol("uniswap");
```

### 数据

获得带有协议列表(无图表)的衍生工具度量衡摘要.

```typescript
const metrics = await proClient.volumes.getDerivativesMetrics();
```

### 按协议计算

获得特定协议的衍生工具度量.

```typescript
const hyperliquid = await proClient.volumes.getDerivativesMetricsByProtocol(
  "hyperliquid"
);
```

### 获得可选量度QQ

获得带有协议列表(无图表)的选项参数摘要.

```typescript
const metrics = await proClient.volumes.getOptionsMetrics();
```

### 获得可选计量协议

获取特定协议的选项参数 .

```typescript
const hegic = await proClient.volumes.getOptionsMetricsByProtocol("hegic");
```

* * *

## 收费

礼宾费和收入数据.

### 收费数据类型

```typescript
import { FeeDataType } from "@defillama/api";

FeeDataType.DAILY_FEES; // "dailyFees"
FeeDataType.DAILY_REVENUE; // "dailyRevenue"
FeeDataType.DAILY_USER_FEES; // "dailyUserFees"
FeeDataType.DAILY_HOLDERS_REVENUE; // "dailyHoldersRevenue"
FeeDataType.DAILY_CREATOR_REVENUE; // "dailyCreatorRevenue"
FeeDataType.DAILY_SUPPLY_SIDE_REVENUE; // "dailySupplySideRevenue"
FeeDataType.DAILY_PROTOCOL_REVENUE; // "dailyProtocolRevenue"
FeeDataType.DAILY_BRIBES_REVENUE; // "dailyBribesRevenue"
FeeDataType.DAILY_TOKEN_TAXES; // "dailyTokenTaxes"
FeeDataType.DAILY_APP_FEES; // "dailyAppFees"
FeeDataType.DAILY_APP_REVENUE; // "dailyAppRevenue"
```

### 获取概览

获取所有协议的收费概况 .

```typescript
const fees = await client.fees.getOverview();

// With data type
const revenue = await client.fees.getOverview({
  dataType: FeeDataType.DAILY_REVENUE,
});
```

### 获取概览

获取特定链条的收费概况 .

```typescript
const ethFees = await client.fees.getOverviewByChain("Ethereum");
```

### 获取摘要

获取特定协议的费用汇总.

```typescript
const uniswapFees = await client.fees.getSummary("uniswap");
```

### 获取图表QQ

获取历史收费图表.

```typescript
const chart = await proClient.fees.getChart();

// For specific chain
const ethChart = await proClient.fees.getChartByChain("Ethereum");

// For specific protocol
const protocolChart = await proClient.fees.getChartByProtocol("aave");
```

### 获取图集协议

在协议内按环节分类收费.

```typescript
const breakdown = await proClient.fees.getChartByProtocolChainBreakdown("aave");
```

### 获取图谱

在协议中按版本列出费用细目.

```typescript
const breakdown = await proClient.fees.getChartByProtocolVersionBreakdown(
  "uniswap"
);
```

### 获取图表ByChain 协议

在一个链条中按协议分类收费.

```typescript
const breakdown = await proClient.fees.getChartByChainProtocolBreakdown(
  "Ethereum"
);
```

### 获取图ChartChain 分类

在所有协议中按链条分列费用.

```typescript
const breakdown = await proClient.fees.getChartChainBreakdown();
```

### 获取量表QQ

获取收费标准.

```typescript
const metrics = await proClient.fees.getMetrics();
const chainMetrics = await proClient.fees.getMetricsByChain("Ethereum");
const protocolMetrics = await proClient.fees.getMetricsByProtocol("aave");
```

* * *

## A. 排放量

Token解锁时刻表并保存数据. **所有端点都需要 Pro API 密钥.**

### 获取全部

获得所有带有解锁时间表的标志.

```typescript
const emissions = await proClient.emissions.getAll();
// Returns: EmissionToken[]
```

每种标志包括:

-   排放事件和时间表
-   循环供应指标
-   下一次解锁事件
-   每日解锁率
-   市场上限数据

### ưμ㼯A

获得一个特定协议的详细背书时间表.

```typescript
const arbitrum = await proClient.emissions.getByProtocol("arbitrum");
// Returns: EmissionDetailResponse
```

答复包括:

-   `documentedData` - 排放时间表和分类细目
-   `metadata` - 来源、事件、说明
-   `supplyMetrics` - 最大供应量,调整供应量
-   `categories` - 分配类别和款次
-   `unlockUsdChart` - 历史解锁值(美元)

* * *

## 桥 桥

跨链桥量和交易数据. **所有端点都需要 Pro API 密钥.**

### 获取全部

把所有的桥 与体积数据.

```typescript
const bridges = await proClient.bridges.getAll();

// Include chain breakdown
const bridges = await proClient.bridges.getAll({ includeChains: true });
```

### 获取比德

获取详细的桥梁信息.

```typescript
const bridge = await proClient.bridges.getById(1);
// Returns: BridgeDetail with volume breakdown, tx counts, chain breakdown
```

### 获得沃尔姆比钱

获得特定链条的桥体积.

```typescript
const volume = await proClient.bridges.getVolumeByChain("Ethereum");
// Returns: BridgeVolumeDataPoint[]
```

### 获取 DayStats

获取特定链条上桥梁的日统计.

```typescript
const stats = await proClient.bridges.getDayStats(1704067200, "Ethereum");
// Returns token and address statistics
```

### 获取交易

得到桥交易.

```typescript
const txs = await proClient.bridges.getTransactions(1, {
  limit: 100,
  startTimestamp: 1704067200,
  endTimestamp: 1704153600,
  sourceChain: "Ethereum",
  address: "0x...",
});
```

* * *

## 生态系统

生态系统一级的数据. **所有端点都需要 Pro API 密钥.**

### 获取类别

获取 TVL 按协议类别分组 .

```typescript
const categories = await proClient.ecosystem.getCategories();
// Returns historical chart, category mappings, market share percentages
```

### 获取叉

获取协议分叉关系和TVL.

```typescript
const forks = await proClient.ecosystem.getForks();
// Returns forks list with parent protocol mappings
```

### 获取甲骨文

通过协议获取甲骨文使用数据 .

```typescript
const oracles = await proClient.ecosystem.getOracles();
// Returns oracle TVL, protocol counts, dominance metrics
```

### 获取实体

获取公司/价值链/基金金库和持有量数据.

```typescript
const entities = await proClient.ecosystem.getEntities();
// Returns: Entity[]
```

### 获取国库

获取协议金库余额.

```typescript
const treasuries = await proClient.ecosystem.getTreasuries();
// Returns: Treasury[]
```

### 获取包

获取安全事件和利用数据库.

```typescript
const hacks = await proClient.ecosystem.getHacks();
// Returns: Hack[] with date, amount, technique, classification
```

### 获取光线

获取资金周期数据库.

```typescript
const raises = await proClient.ecosystem.getRaises();
// Returns: { raises: Raise[] }
```

* * *

## 紧急信托基金

比特币和Ethereum ETF数据. **所有端点都需要 Pro API 密钥.**

### 获取概览

获得比特币ETF概览.

```typescript
const btcEtfs = await proClient.etfs.getOverview();
// Returns: EtfOverviewItem[]
```

### 获取概览

获取 Ethereum ETF 概览 .

```typescript
const ethEtfs = await proClient.etfs.getOverviewEth();
```

### 获取历史

获取 Bitcoin ETF 流历史 .

```typescript
const history = await proClient.etfs.getHistory();
// Returns: EtfHistoryItem[]
```

### 获取历史

获取 Ethereum ETF 流历史 .

```typescript
const history = await proClient.etfs.getHistoryEth();
```

### 获取Fdv绩效

获取FDV性能数据.

```typescript
const perf = await proClient.etfs.getFdvPerformance("30");
// period: "7" | "30" | "ytd" | "365"
```

* * *

## DAT 翻译:

数字资产库数据与机构持有. **所有端点都需要 Pro API 密钥.**

### 获取机构

为所有机构获取全面的DAT数据.

```typescript
const data = await proClient.dat.getInstitutions();
// Returns metadata, holdings by asset, mNAV data
```

### 获取机构

获取特定机构的详细DAT数据.

```typescript
const mstr = await proClient.dat.getInstitution("MSTR");
// Returns holdings, flows, mNAV, stats, OHLCV, transactions
```

* * *

## 账户 QQ

API账户管理. **需要 Pro API 密钥 .**

### 获取用户

获取 API 使用统计 .

```typescript
const usage = await proClient.account.getUsage();
// Returns: { creditsLeft: number }
```

* * *

## 处理错误

SDK为不同的情景提供自定义错误分类:

```typescript
import {
  DefiLlamaError,
  ApiKeyRequiredError,
  RateLimitError,
  NotFoundError,
  ApiError,
} from "@defillama/api";

try {
  const data = await client.yields.getEarn();
} catch (error) {
  if (error instanceof ApiKeyRequiredError) {
    console.log("Pro API key required for this endpoint");
  } else if (error instanceof RateLimitError) {
    console.log(`Rate limited. Retry after ${error.retryAfter} seconds`);
  } else if (error instanceof NotFoundError) {
    console.log("Resource not found");
  } else if (error instanceof ApiError) {
    console.log(`API error: ${error.statusCode} - ${error.message}`);
  }
}
```

* * *

## 类型出口

从主包导出所有类型 :

```typescript
import type {
  // TVL
  Protocol,
  ProtocolDetails,
  Chain,
  TokenProtocolHolding,

  // Prices
  CoinPrice,
  CoinPricesResponse,
  ChartOptions,

  // Stablecoins
  Stablecoin,
  StablecoinDetails,

  // Yields
  EarnPool,
  EarnHistoryPoint,
  EarnQueryParams,
  BorrowMarket,
  BorrowMarketHistoryPoint,
  PerpPool,
  LsdRate,
  YieldPool, // deprecated (v1)
  BorrowPool, // deprecated (v1)

  // Volumes
  DexOverviewResponse,
  DexSummaryResponse,
  DexMetricsResponse,
  DexMetricsByProtocolResponse,
  DerivativesMetricsResponse,
  DerivativesMetricsByProtocolResponse,
  OptionsMetricsResponse,
  OptionsMetricsByProtocolResponse,

  // Fees
  FeesOverviewResponse,
  FeesSummaryResponse,

  // Emissions
  EmissionToken,
  EmissionDetailResponse,

  // Bridges
  BridgeSummary,
  BridgeDetail,
  BridgeTransaction,

  // Ecosystem
  Entity,
  Treasury,
  Hack,
  Raise,

  // ETFs
  EtfOverviewItem,
  EtfHistoryItem,

  // DAT
  DatInstitutionsResponse,
  DatInstitutionResponse,

  // Config
  DefiLlamaConfig,
} from "@defillama/api";
```

* * *

## 常数

```typescript
import { AdapterType, FeeDataType, VolumeDataType } from "@defillama/api";

// Adapter Types
AdapterType.DEXS; // "dexs"
AdapterType.FEES; // "fees"
AdapterType.AGGREGATORS; // "aggregators"
AdapterType.DERIVATIVES; // "derivatives"
AdapterType.AGGREGATOR_DERIVATIVES; // "aggregator-derivatives"
AdapterType.OPTIONS; // "options"
AdapterType.BRIDGE_AGGREGATORS; // "bridge-aggregators"
AdapterType.OPEN_INTEREST; // "open-interest"

// Volume Data Types
VolumeDataType.DAILY_VOLUME; // "dailyVolume"
VolumeDataType.DAILY_NOTIONAL_VOLUME; // "dailyNotionalVolume"
VolumeDataType.DAILY_PREMIUM_VOLUME; // "dailyPremiumVolume"
VolumeDataType.DAILY_BRIDGE_VOLUME; // "dailyBridgeVolume"
VolumeDataType.OPEN_INTEREST_AT_END; // "openInterestAtEnd"
VolumeDataType.SHORT_OPEN_INTEREST_AT_END; // "shortOpenInterestAtEnd"
VolumeDataType.LONG_OPEN_INTEREST_AT_END; // "longOpenInterestAtEnd"
```

* * *

## 所需资源

-   节点.js 18.0.0
-   类型脚本 5.x (用于类型脚本用户)

## 许可证

麻省理工学院

## 常见问题

### @defillama/api 是什么？

DefiLlama API 的脚本 SDK 类型

### 如何安装 @defillama/api？

在项目目录运行 npm install @defillama/api，或使用 pnpm add / yarn add / bun add。

### @defillama/api 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @defillama/api 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @defillama/api 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=18\.0\.0。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @defillama/api 可以商用吗？

@defillama/api 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @defillama/api 的下载量有多少？

根据 npm 官方下载统计，@defillama/api 在 2026/10/12 – 2026/11/10 这 30 天内被下载 3,569 次，日均约 119 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @defillama/api 还在维护吗？

最新版本 0\.1\.5 发布于 2026/11/04（7 天前）；至今共发布 5 个版本，其中过去 12 个月发布了 5 个；首次发布于 2026/01/19。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

