🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@dxfeed/dxlink-api

Package Overview
Dependencies
Maintainers
3
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dxfeed/dxlink-api

dxLink API

Source
npmnpm
Version
0.1.2
Version published
Weekly downloads
6.1K
-14.12%
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 { DXLinkWebSocket, 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

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

Keywords

api

FAQs

Package last updated on 10 Nov 2023

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