Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

data-monitor-javascript-sdk

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

data-monitor-javascript-sdk

This package is the browser based javascript SDK for the FactSet Data Monitor API.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
2
Weekly downloads
 
Created
Source

Data Monitor Javascript SDK

This package is the browser based javascript SDK for the FactSet Data Monitor API.

Data Monitor is an SDK that provides access to the same, trusted, information available within FactSet's Workstation and Web offerings. Our Javascript SDK enables you to receive market data, fundamentals, and other financial data on a streaming or point in time frequency.

An overview of the SDK is available on the FactSet Developer Portal

Installation

yarn: yarn add data-monitor-javascript-sdk

npm: npm install data-monitor-javascript-sdk

Contributing

See CONTRIBUTING.md

Example

import {init, on} from 'data-monitor-javascript-sdk';

let subscriptionCollection;

const myCompanyIdpid = 'asda34-asd123-asdasd123';
subscribe(['FDS-USA', 'AAPL-USA', 'VOD-LON'], ['COMPANY_NAME', 'LAST_PRICE', 'LAST_TIME', 'LAST_DATE']);

async function subscribe(symbols, fields) {
  // initialize the sdk
  await init({idpid: myCompanyIdpid});
  if (subscriptionCollection) {
    cancel();
  }

  // make data subscriptions
  subscriptionCollection = on({
    symbols,
    fields,
    options: {
      britishCurrencyInPence: true,
      currency: 'LOCAL',
      timezone: 'America/Los_Angeles'
    },
    success: (message, subscription) => {
      console.log(message, subscription);
    }
  });
}

// pause/resume realtime data updates based on page visibility
document.addEventListener('visibilitychange', () => {
  if (!subscriptionCollection) return;

  if (document.visibilityState === 'visible') {
    subscriptionCollection.resume();
  } else {
    subscriptionCollection.pause();
  }
});

function updateCurrency(newOutputCurrencyISO = 'USD') {
  if (subscriptionCollection) {
    subscriptionCollection.update({currency: newOutputCurrencyISO});
  }
}

function cancel() {
  if (subscriptionCollection) {
    subscriptionCollection.cancel();
    subscriptionCollection = null;
  }
}

FAQs

Package last updated on 17 Jun 2022

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