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

teller-js

v10.3.2

Published

A library for identifying trends and future forecasting of bank transactions

Downloads

15

Readme

Teller

Teller provides trend identification and forecasting facilities based on bank transactions. Teller can be used from both Purescript and Javascript/Typescript.

This library is not intended to be a perfect predictor of trends. The aim is for it to be a suggestion engine to provide possible trends to a user who can then correct and modify them as needed.

The sanitised trends can then be fed back into the libraries forecasting function to get accurate predictions of the future state of an account

Installation

Purescript

Documentation is published on Pursuit.

Javascript & Typescript

npm install teller-js

Teller provides its own Typescript definitions

Examples

Trends

// Given some transaction data
import {
  identifyTrends,
  isSpecificWeekdayTrendDescription,
  isEveryWeekdayTrendDescription,
} from "teller-js";

const transactions = [
  {
    accountId: "8Ybo8ppEBrHxJM45p7koSvaKQnM341fyMKQwO",
    timestamp: 1586473200000.0,
    amount: 0.01,
    merchantName: "Asda",
    reference: "Asda",
  },
  ...{
    accountId: "8Ybo8ppEBrHxJM45p7koSvaKQnM341fyMKQwO",
    timestamp: 1586300400000.0,
    amount: -60.0,
    merchantName: "201053 53364402 MOBILE-CHANNEL FT",
    reference: "201053 53364402 MOBILE-CHANNEL FT",
  },
];

// Finding Trends
const result = identifyTrends(t);

result.forEach((tr) => {
  const merchant = tr.merchant;
  const trend = tr.trend;
	
  // Checking the type of a trend
  if (isEveryWeekdayTrendDescription(trend)) {
    console.log(`${merchant} transaction happens every day`);
  }

  if (isSpecificWeekdayTrendDescription(trend)) {
    const days = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"];

    console.log(
      `${merchant} transaction happens every ${days[trend.value0.weekday]}`
    );
  }
});

// Making a forecast based on the trend, returning which
// trend ids will happen on each day
const f = forecast(1603580400000.0)(1604188800000.0)(result);

console.log(JSON.stringify(f, null, 2));

/**
 * {
  "days": [
    {
      "dateTimestampMs": 1603497600000,
      "trendIds": [
        "Weekday_[2,6,7]_Transport for London"
      ]
    },
    ...
    {
      "dateTimestampMs": 1604102400000,
      "trendIds": [
        "MonthDay_31_BILL_A",
        "MonthDay_31_BILL_B",
        "MonthDay_31_BILL_C",
        "MonthDay_31_BILL_D",
        "Weekday_[2,6,7]_Transport for London"
      ]
    },
    {
      "dateTimestampMs": 1604188800000,
      "trendIds": [
        "MonthDay_1_Ocado",
        "Weekday_[2,6,7]_Transport for London"
      ]
    }
  ]
}
 */

Further Work

  1. Surface algorithm confidence as a percentage in the trend description result
  2. Add initial balance as an input to forecasting and predict balance at end of forecast and after each day
  3. Based on a set of trends provide a user with a total spend on fixed costs at end of forecast