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

spunk

v0.0.4

Published

data processing framework geared towards building trading bots and simulations but can be used for any type of application

Downloads

1

Readme

Spunk

Spunk is a simple yet powerful data processing framework for building trading bots and simulations. It can also be used for any type of data processing application.

Features

  • Create data providers from multiple sources ( Csv, Json, Web-Api ... etc)
  • Add event-listeners to your data providers
  • Pipe your data into data processors
  • Growing library of built-in providers and processors

Examples

Load data from multiple CSV files:

| CSV1.csv | CSV2.csv | | ------------ | ------------ | |date, asset, price 01-01-2018, BTC, 6000 01-02-2018, BTC, 6028 ... | date, asset, price 01-01-2018, ETH, 199 01-02-2018, ETH, 208 ... |

const Spunk = require('spunk');

const csv = Spunk.CSVProvider({ source: ['csv1.csv', 'csv2.csv'] });

csv.init().then(() => {
  csv.reverse();
  console.log(csv.getData());
});


/*
 Console:
 [
   { "date": "01-02-2018", "asset": "ETH", "price": 208 },
   { "date": "01-01-2018", "asset": "ETH", "price": 199 },
   { "date": "01-02-2018", "asset": "BTC", "price": 6028 },
   { "date": "01-01-2018", "asset": "BTC", "price": 6000 },
 ]
*/
csv.add({
  "date": "01-03-2018",
  "asset": "LTC",
  "price": 55
});

console.log(csv.getData());

/*
 Console:
 [
   { "date": "01-02-2018", "asset": "ETH", "price": 208 },
   { "date": "01-01-2018", "asset": "ETH", "price": 199 },
   { "date": "01-02-2018", "asset": "BTC", "price": 6028 },
   { "date": "01-01-2018", "asset": "BTC", "price": 6000 },
   { "date": "01-03-2018", "asset": "LTC", "price": 55 }   <------
 ]
*/
csv.addEventListener('update', (data) => {
  console.log(`Added a new entry for asset: ${data.asset}`);
});

csv.add({
  "date": "01-04-2018",
  "asset": "XLM",
  "price": 0.12
});

/*
 Console: Added a new entry for asset: XLM
*/
const Spunk = require("../spunk");

const prices = Spunk.ArrayProvider({ data: [10,8,9,8,7] });
const MA = Spunk.MovingAverage({ source: prices, size: 5 });

MA.addEventListener('update', (data) => {
  console.log(`Current Moving Average: ${data}`);
});

prices.add(12); // Console:  Current Moving Average: 8.8

prices.add(6); // Console:  Current Moving Average: 8.4

console.log(MA.getData()); // Console: [8.8, 8.4]

console.log(prices.getData()); // Console: [10, 8, 9, 8, 7, 12, 6]

Contribute

👍🎉 First off, thanks for taking the time to contribute! 🎉👍

Spunk is a living project, We would love to see all the new things you add to it.

Pull requests are the best way to propose changes to the codebase (we use Github Flow). We actively welcome your pull requests:

  • Fork the repo and create your branch from master.
  • If you've added code that should be tested, add tests.
  • Ensure the test suite passes.
  • Make sure your code lints.
  • Issue that pull request!

Some ideas for expansion:

  • Create new data providers ( Weighted moving avg , RSI, etc)
  • Create new processors ( Trading strategies, Charting, CSVProducer .. etc)
  • Add more features to the core classes ( DataProvider.js, Processor.js .. etc )
  • Create a reference manual
  • Add more unit tests

The opportunities are limitless. Any feature that has common use will be seriously considered.