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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@furlpay/auto-invest

v0.1.0

Published

Automated dollar-cost averaging (DCA) for FurlPay — schedule recurring stablecoin-funded stock/ETF buys. Zero runtime dependencies.

Downloads

88

Readme

@furlpay/auto-invest

Automated dollar-cost averaging (DCA) for FurlPay"buy $10 of VOO every Monday with USDC." Schedule recurring, stablecoin-funded stock/ETF/crypto buys; a runner decides what's due and places the orders.

  • You own the schedules — create them here or seed from your own database.
  • Deterministic scheduling — pure, UTC-based due logic with catch-up (a slot fires once even if the runner was down, and never double-fires).
  • Clone-and-run — with no API key, orders are simulated so you can watch the DCA loop end-to-end. Zero runtime dependencies (global fetch, Node 18+).

Maintained by FurlPay · MIT licensed.

Install

npm i @furlpay/auto-invest

Usage

import { AutoInvest } from "@furlpay/auto-invest";

const ai = new AutoInvest({ apiKey: process.env.FURLPAY_API_KEY });   // omit key → simulate

ai.add({ symbol: "VOO", amount: 10, frequency: "weekly", dayOfWeek: 1 });   // Mondays
ai.add({ symbol: "BTC", amount: 25, frequency: "monthly", dayOfMonth: 1 }); // 1st of month
ai.add({ symbol: "AAPL", amount: 5, frequency: "daily" });                  // every day

// Run this on a cron (e.g. hourly). It buys everything currently due.
const results = await ai.runDue();
// [{ scheduleId, symbol, amount, currency, status, orderId?, simulated?, ranAt }]

Each due schedule places a fractional market buy for its notional via POST /investing/orders, funded in the schedule's currency (default USDC), and records lastRun so it advances to the next slot.

Scheduling

| Frequency | Fires on | Options (UTC) | | --- | --- | --- | | daily | every day at hour | hour (0–23, default 14) | | weekly | dayOfWeek at hour | dayOfWeek (0=Sun…6=Sat, default 1), hour | | monthly | dayOfMonth at hour | dayOfMonth (1–28, default 1), hour |

The pure helpers are exported if you want to compute times yourself:

import { isDue, nextRun } from "@furlpay/auto-invest";
nextRun(schedule, new Date());   // next UTC fire time
isDue(schedule, new Date());     // should it run now?

API

| Method | Purpose | | --- | --- | | ai.add(input) | Create a schedule (validates amount/day ranges) → Schedule | | ai.list() / ai.get(id) | Read schedules | | ai.pause(id) / ai.resume(id) / ai.remove(id) | Toggle / delete | | ai.nextRunAt(id) | Next UTC fire time for a schedule | | ai.due(now?) | Schedules due at now | | ai.runDue(now?) | Buy everything due; records lastRunOrderResult[] | | ai.runNow(id, now?) | Force one schedule to buy now (ignores due check) | | ai.live | true when an API key is set (else orders simulate) |

Seed from your store and persist after each tick:

const ai = new AutoInvest({ apiKey, schedules: await db.loadSchedules() });
await ai.runDue();
await db.saveSchedules(ai.list());   // persists updated lastRun

Example

npm run example
FURLPAY_API_KEY=fp_live_sk_... npm run example

Test

npm test        # tsc build + node --test (demo mode, no network)

The suite pins the scheduling math (daily/weekly/monthly nextRun, isDue catch-up and no-double-fire), input validation, simulated runs recording lastRun, and the live path (correct POST body to /investing/orders, plus failed orders captured rather than thrown).

Scope

This library orchestrates FurlPay's investing API — it doesn't custody funds or execute trades itself; brokerage (via Alpaca) and settlement happen in the FurlPay API. Point it at your own FurlPay account and it invests on your behalf.

License

MIT