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.0.5

Published

Flexemarkets TypeScript SDK

Downloads

511

Readme

fm-sdk-typescript

TypeScript / JavaScript SDK for the Flexemarkets API.

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, OrderBooks, MarketplaceTrades } from "@flexemarkets/fm-sdk";
import type { FmEvent } 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);

// WebSocket events
const books = new OrderBooks(markets);
const trades = new MarketplaceTrades(markets);

await fm.listen(marketplaceId, (event: FmEvent) => {
  if ("kind" in event && event.kind === "orders-update") {
    books.update(event.orders);
    trades.update(event.orders);
  } else if (!Array.isArray(event) && "state" in event) {
    console.log(event.state); // Session
  } else if ("cash" in event) {
    console.log(event.cash); // Holding
  }
});

// when done
fm.close();

Example: ticker

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

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.