npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@volatility/volatility-ws

v0.5.0

Published

Documentation for Volatility WebSockets API

Downloads

1

Readme

Overview

The Volatility WebSocket API follows similar interface patterns as popular platforms such as Kraken, Coinbase and deribit. This early version of the API only provides realtime data for MFIV 14 day ETH. Additional time periods, assets, methodologies, and historical data coming soon.

Websocket API Servers

| Name | Endpoint | Purpose | |---|---|---| | Production | wss://ws.prd.volatility.com | For production and consumer facing use. |

Getting an API Key

To use our WebSocket API a valid API key is required. Here's how:

  1. Join our Discord.
  2. Go to the #collabland-join channel.
  3. Click "Let's go!".
  4. Click "Connect Wallet".
  5. Choose a wallet connection and connet your wallet.
  6. Click "Sign Message".
  7. Through your wallet, Sign the transaction. You should see a Wallet Connected! message.
  8. Return to Discord.
  9. Under COMMUNITY, you should now see a new channel called #labs-volatility-api. Go to this channel and request an API key.
  10. Someone from our team will DM you an API key within 72 hours.

Quick Start

Our API can be accessed through our npm package server-side or directly using the WebSocket Client API client-side.

If you clone this repository, you can run our example script in node by doing the following:

  1. In your terminal run:
npm install
  1. Add your API key as an environment variable. In your terminal run:
export VOLATILITY_API_KEY=<API_KEY>
  • Replace <API_KEY> with your API key our team provided you.
  1. In your terminal run:
ts-node src/example.ts

You can see the example script source code here.

Server Side Applications

Currently, this package only works on the server-side. A future release will support browser-based client-side applications.

Before you can use this package, you'll need to install it.

Install the package:

npm i @volatility/volatility-ws

After it's installed, import the realtimeVolatility method for use.

Example:

import { realtimeVolatility } from "volatility-api"

const messages = realtimeVolatility({
   methodology: "MFIV"
   timePeriod: "14D",
   asset: "ETH",
   apiKey: "<API_KEY>"
})

// process messages via async iteration:
for await (const message of messages) {
   console.log(message);
}

The realtimeVolatility function includes the following options for managing the websocket interface.

realtimeVolatility({
   idleTimeout: number | undefined,   // default: 10000 - how long to wait for inactivity before giving up
   reconnect: boolean | undefined,    // default: true - reconnect on disconnect
   onError?: (error: Error) => void
})

Future Updates

  • Allow combining of indices.
  • Use of the API with browser-based client-side applications.