You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@dxfeed/dxlink-api

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dxfeed/dxlink-api

dxLink API provides access to market data from dxFeed services

0.3.0
latest
Source
npmnpm
Version published
Weekly downloads
2.7K
-15.18%
Maintainers
3
Weekly downloads
 
Created
Source

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
})

Keywords

api

FAQs

Package last updated on 17 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.