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

@flexemarkets/fm-sdk

v0.7.0

Published

Flexemarkets TypeScript SDK

Readme

fm-sdk-typescript

TypeScript / JavaScript SDK for the Flexemarkets API.

⚠️ Alpha software — the API is not stable

fm-sdk is pre-1.0 and under active development. Anything public may be added, renamed, or removed in any release, including in ways that break code that compiles and runs today, and without a deprecation period first. Under semantic versioning a 0.x release carries no compatibility promise, and that is how these versions are used: treat every 0.x bump as potentially breaking.

Pin an exact version rather than a range ("@flexemarkets/fm-sdk": "0.2.0", not ^0.2.0), read the upgrade notes for the release you are moving to, and expect to change code when you move.

Not recommended for production use.

Requirements

  • Node.js 22+ (ES modules)

Install

npm install @flexemarkets/fm-sdk

Configuration

The SDK loads credentials and endpoint from these sources (highest priority first):

  1. Arguments passed to Flexemarkets.connect()
  2. Files ~/.fm/credential and ~/.fm/endpoint (Java .properties format)
  3. Environment variable FM_API_URL (defaults to https://api.flexemarkets.com)

Credential file

Create ~/.fm/credential:

account=myaccount
[email protected]
password=secret

Or use a bearer token:

token=eyJhbGciOiJIUzI1NiJ9...

Endpoint file

Create ~/.fm/endpoint:

endpoint=https://api.flexemarkets.com/api/marketplaces/123

SDK usage

import { Flexemarkets } from "@flexemarkets/fm-sdk";

// connect(null, null, ...) falls back to ~/.fm/credential and ~/.fm/endpoint
const fm = await Flexemarkets.connect(null, null, "my-bot");

// REST API
const marketplaceId = fm.endpointMarketplaceId;
const markets = await fm.markets(marketplaceId);
const session = await fm.session(marketplaceId);
const holding = await fm.holding(marketplaceId);

// Submit orders
const order = await fm.submitLimit(marketplaceId, markets[0].id, "BUY", 1, 950);
await fm.submitCancel(marketplaceId, markets[0].id, order.id);

// Live market data. A desk keeps the books and tapes for you: it seeds them
// over REST, applies deltas, and re-seeds after a sequence gap.
const desk = await fm.desk(marketplaceId);
const marketId = markets[0].id;

desk.onBookChange(marketId, (book) => console.log(book.bestPrice("BUY")));
desk.onSessionChange((s) => console.log(s.state));
desk.onHoldingChange((h) => console.log(h.cash));

const one = desk.book(marketId);          // one market
for (const book of desk.books()) {        // every market in the marketplace
  console.log(book.symbol, book.bestPrice("BUY"));
}

desk.close();

Example: ticker

The SDK includes a ticker example — a live terminal display of order book best bid/ask, spread, and recent trade prices.

npx tsx src/ticker.ts -C ~/.fm/credential -E 123

Options:

| Flag | Description | |------|-------------| | -C, --credential | Credential file path or bearer token | | -E, --endpoint | Marketplace id, endpoint file path, or URL |

Output:

fm-ticker                                              OPEN

  Symbol     Bid     Ask  Spread   Last trades
  ------  ------  ------  ------   -----------
    AAPL  $ 9.50  $10.50  $ 1.00   $9.50  $10.00
     IBM  $ 4.00  $ 5.00  $ 1.00   $4.50

The display refreshes on each order book update. Press Ctrl-C to stop.