JSPM

bluechips

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q21728F
  • License ISC

A package to simulate your own stock market

Package Exports

  • bluechips

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bluechips) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

BlueChips

📈💰 A node package to simulate your own stock market

Install

You can install the package from NPM by doing:

$ npm i bluechips

Usage

You can see a usage example in example.js but otherwise here is a guide to using the package

let Market = require('bluechips') // Require the package

let market = new Market(); // Create a new market

// Set are market updating, it will update every 10ms
market.start(10);

// This will pause and unpause the updating
market.pause();
market.pause();

// This adds a new asset to the market
market.newAsset({
  'name'          : "Stock Name",
  'price'         : 200, // The starting price
  'volatility'    : 100, // 0 - 1000
  'historyLimit'  : 100, // How much history we store
  'momentumBound' : 0.8  // Max price move each update
});

// Alter the history limit once it is set
market.setHistoryLimit(200);

// Finds an asset from the market given a name
let asset = market.getAssetByName("Stock Name");
// asset => now the asset
// null if not found