Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
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
  • npm
  • Socket score

Version published
Weekly downloads
337
decreased by-20.52%
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

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc