@dxfeed/dxlink-api

中文文档
0.10.0发布于 2026/11/13MPL-2.0TypeScriptESM + CJS近 30 天下载 2.9万

dxLink API provides access to market data from dxFeed services

原始使用文档
文档目录5 节
  1. Install
  2. Usage
  3. Client
  4. Feed API
  5. Depth Of Market API

@dxfeed/dxlink-api

This package provides access to market data from dxFeed services via dxLink API.

Install

npm install @dxfeed/dxlink-api

Usage

Import client and feed into your project.

import { DXLinkWebSocketClient, DXLinkFeed } from '@dxfeed/dxlink-api'

Client

Create instance of the client.

const client = new DXLinkWebSocketClient()

Connect to the server.

client.connect('wss://demo.dxfeed.com/dxlink-ws')

Provide auth token if required by the server.

client.setAuthToken(token)

Feed API

Create market data feed API with delivery contract AUTO.

const feed = new DXLinkFeed(client, 'AUTO')

Configure created feed.

feed.configure({
  acceptAggregationPeriod: 10,
  acceptDataFormat: FeedDataFormat.COMPACT,
  acceptEventFields: {
    Quote: ['eventSymbol', 'askPrice', 'bidPrice'],
    Candle: ['eventSymbol', 'open', 'close', 'high', 'low', 'volume'],
  },
})

Add subscription to the feed.

const sub1 = {
  type: 'Quote',
  symbol: 'AAPL',
}

feed.addSubscriptions(sub1)

Remove subscription from the feed.

feed.removeSubscriptions(sub1)

Receive data from the channel.

feed.addEventListener((events) => {
  // do something with events
})

Depth Of Market API

Create Depth Of Market API with desired symbol and sources.

const dom = new DXLinkDepthOfMarket(client, { symbol: 'AAPL', sources: ['ntv'] })

Configure created dom.

dom.configure({
  acceptAggregationPeriod: 10,
  acceptDepthLimit: 5,
})

Receive data from the channel.

dom.addSnapshotListener((time, bids, asks) => {
  // do something with snapshot
})

版本与发布记录

@dxfeed/dxlink-api 共发布 16 个版本,首次发布于 2023/11/09;过去 12 个月发布了 7 个版本。

版本发布日期距今
0.10.0latest2026/11/13今天
0.9.02026/06/095 个月前
0.8.12026/05/165 个月前
0.8.02026/04/097 个月前
0.7.02026/03/148 个月前
0.6.12026/02/119 个月前

关于 @dxfeed/dxlink-api 的常见问题

@dxfeed/dxlink-api 是什么?

dxLink API provides access to market data from dxFeed services

如何安装 @dxfeed/dxlink-api?

在项目目录运行 npm install @dxfeed/dxlink-api,或使用 pnpm add / yarn add / bun add。

@dxfeed/dxlink-api 支持 TypeScript 吗?

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

@dxfeed/dxlink-api 支持 ESM 还是 CommonJS?

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

@dxfeed/dxlink-api 可以商用吗?

@dxfeed/dxlink-api 使用 MPL-2.0 许可。弱 Copyleft:可以商用,也可以和闭源代码一起使用;但如果分发时修改了 MPL 授权的文件,这些文件的修改需以 MPL 开源。以上为概括,不构成法律意见,请以许可原文为准。

@dxfeed/dxlink-api 的下载量有多少?

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

@dxfeed/dxlink-api 还在维护吗?

最新版本 0.10.0 发布于 2026/11/13(今天);至今共发布 16 个版本,其中过去 12 个月发布了 7 个;首次发布于 2023/11/09。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。