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

@bytewaveco/public

v1.2.0

Published

A TypeScript compatible library for interacting with the Public API.

Readme

Public API for TypeScript

An unofficial, fully typed TypeScript client for the Public investing API.

This package is not affiliated with Public. API requests use your live Public account, and order methods can execute real trades. Review every order before submitting it.

Install

pnpm add @bytewaveco/public
npm install @bytewaveco/public

Quickstart

Create a personal API secret in your Public account settings, then create a client:

import { createClient } from '@bytewaveco/public'

const publicClient = createClient(process.env.PUBLIC_API_SECRET!)

const result = await publicClient.accounts.listAccounts()

if (result.error) {
  throw result.error
}

console.log(result.data.accounts)

Every request returns a discriminated result:

type Result<T> = { data: T; error: null } | { data: null; error: Error }

HTTP errors are returned as PublicApiError, which includes the response status and parsed body.

Client options

const publicClient = createClient(process.env.PUBLIC_API_SECRET!, {
  accessTokenValidityInMinutes: 15,
  headers: {
    'X-Application': 'portfolio-tools',
  },
})

| Option | Description | | ------------------------------ | ------------------------------------------------------------------ | | accessTokenValidityInMinutes | Access-token lifetime from 5 through 1440 minutes. Defaults to 15. | | baseUrl | Override Public's API base URL. | | fetch | Supply a custom Fetch API implementation. | | headers | Add headers to authenticated API requests. |

Access tokens are cached per client and refreshed shortly before expiry. Concurrent requests share the same token refresh.

API surface

Accounts

publicClient.accounts.listAccounts()
publicClient.accounts.getAccount(accountId)
publicClient.accounts.getAccountHistory(accountId, options)

Instruments

publicClient.instruments.getInstruments(options)
publicClient.instruments.getInstrument(symbol, type)

Instrument filters, trading states, crypto precision, bond details, shorting availability, exchanges, and option price increments are typed.

Market data

publicClient.marketData.getQuotes(accountId, instruments)
publicClient.marketData.getBars(symbol, period, options)

Options

publicClient.options.getOptionGreeks(accountId, osiSymbols)
publicClient.options.getOptionExpirations(accountId, instrument)
publicClient.options.getOptionChain(accountId, instrument, expirationDate)
publicClient.options.getStrategyQuote(accountId, strategy)

Orders

const orderId = publicClient.orders.createOrderId()

await publicClient.orders.preflightSingleLeg(accountId, order)
await publicClient.orders.preflightMultiLeg(accountId, order)
await publicClient.orders.placeOrder(accountId, { ...order, orderId })
await publicClient.orders.placeOrderMultiLeg(accountId, { ...order, orderId })
await publicClient.orders.replaceOrder(accountId, replacement)
await publicClient.orders.getOrder(accountId, orderId)
await publicClient.orders.cancelOrder(accountId, orderId)

Order placement and cancellation are asynchronous. Use getOrder() to verify the resulting status. Current order types include 24/5 equity sessions, margin controls, short-sale position intent, stop-limit orders, and hypothetical preflight validation.

Current coverage

Version 1.2.0 reflects Public's documentation reviewed on July 10, 2026, including historical bars, replace-order, multi-leg strategy quotes, portfolio strategies, option-chain Greeks, and current order controls.

Development

pnpm install
pnpm check
pnpm typecheck
pnpm test
pnpm build
  • pnpm check verifies Oxlint and Oxfmt.
  • pnpm lint applies formatting and safe lint fixes.
  • pnpm test runs the mocked transport tests. Tests do not contact Public or place live orders.

License

MIT