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

wsm-api

v1.0.0

Published

A wrapper for Wall Street Magnate's cryptocurrency api.

Downloads

4

Readme

Wall Street Magnate Crypto API

This is a NodeJS wrapper for virtual/simulated cryptocurrency trading through Wall Street Magnate's platform.

Installation

npm install wsm-api

Quick Start

Prerequisites

You will need: * A Wall Street Magnate account * API keys for your account, which can be found here under the gear tab in top right of the WSM UI.

Create Client object

You need to first create a client object that has access to WSM via an access token. The async createClient() function will set this up for you given your API keys. You must await this function.

let client = await WSM.createClient(MY_API_KEY, MY_API_SECRET)

Making API Calls

All API calls return a promise so you can process the response with any standard promise handling.

let client = await WSM.createClient(MY_API_KEY, MY_API_SECRET)

//Search a symbol using await
let searchResponse = await client.searchSymbol("XRP");
console.log(`WSM's data on XRP: " ${searchResponse});

//Purchase 1 BTC on the account you are logged into with then/catch
client.positionBuy("BTC", 1)
  .then((data) => {
    console.log(data);
  })
  .catch((err) => {
    console.log(err);
  })

Demo script

You can try the include demo script, demo demo.js which will run through every function for you. This will attempt to buy 10 Ripple (~$3) for you and sell it immediately after.

node demo.js YOUR_API_KEY YOUR_API_SECRET

Functions of the WSM class

createClient(key, secret)

** Arguments **

  • key - the API key
  • secret - API secret ** Return ** A fully set up WSM client object that has your access tokens set.

This is a static method of the WSM class and how you will create your client. ** You need to await this function ** as it sets the access token for your client internally. createClient() returns the created client object back to you and all subsequent calls are class functions to this object, so be sure to save the response somewhere.

getPositionsOpen()

** Return ** Array of holdings, each as a JSON.

Returns all the open positions (the crypto you are currently holding).

getPositionsClosed()

** Return ** Array of closed positions, each as a JSON.

Returns all closed positions (sell orders).

positionBuy(symbol, quantity)

** Arguments **

  • Symbol - (string) shortened symbol of the cryptocurrency you intend to buy
  • Quantity - (int) The quantity of this coin you intend to buy ** Return ** JSON containing the information from your order. ** Note **: If you do not have sufficient cash funds in your account to execute this order, you will receive a 400 Error specifying that you do not have the funds to execute this order.

positionSell(symbol, quantity, positionId)

** Arguments **

  • Symbol - (string) shortened symbol of the coin you intend to sell
  • quantity - (int) the quantity of the coin you intend to sell (check note below)
  • positionId - (string) id of the open position you are selling from ** Return ** JSON containing the information from your order. ** Note **: This function sells from a position, so the quantity you sell must be <= the quantity in this position. For example, given 2 positions {id:1, "symbol": "ETH", "quantity": 4} and {id:2, "symbol": ETH, "quantity": 400} you must sell from one one of these positions otherwise you will receive a 400 error. Valid: client.positionSell("ETH", 4, 1), client.positionSell("ETH", 200, 2) Error: client.positionSell("ETH", 200, 1), client.positionSell("ETH", 404, 2) # Neither position holds enough Etherium

searchSymbol(symbol)

** Arguments **

  • Symbol - (string) shortened symbol of the coin you want to search ** Return ** JSON of search info for the coin matching the symbol.

getUsersTotals()

** Return ** JSON of account asset totals.

Reference

Some support currencies and their ticker:

  • Bitcoin - "BTC"
  • Etherium - "ETH"
  • Litecoin - "LTC"
  • Ripple - "XRP"
  • Bitcoin Cash - "BCH"
  • US Dollar - "USD"
  • Bitcoin SV - "BSV"
  • EOS -"EOS"
  • Tezos - "XTZ"
  • Stellar - "XLM"
  • TRON - "TRX"
  • Cosmos - "ATOM"
  • UNUS SED LEO - "LEO"
  • NEO - "NEO"
  • VeChain - "VET"