@narumitw/pi-ticker

Pi extension that shows configurable Yahoo Finance quotes above the editor.

Packages

Package details

extension

Install @narumitw/pi-ticker from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@narumitw/pi-ticker
Package
@narumitw/pi-ticker
Version
0.1.0
Published
Aug 29, 2026
Downloads
315/mo · 17/wk
Author
narumitw
License
MIT
Types
extension
Size
191.3 KB
Dependencies
1 dependency · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./dist/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

📈 pi-ticker — Show Market Quotes Above Pi's Editor

npm Pi extension License: MIT

Pi Ticker shows configurable Yahoo Finance quotes in a width-aware widget above Pi's editor.

✨ Features

  • Shows price, daily change, and daily percentage change for up to ten symbols.
  • Starts empty and performs no quote requests until at least one symbol is added.
  • Packs complete ticker entries into rows that fit the current terminal width.
  • Provides searchable TUI and RPC menus for adding, removing, and reordering symbols.
  • Persists widget visibility and the ordered symbol list in user settings.
  • Refreshes every 30 seconds while enabled, keeps successful results, and marks failed symbols' previous quotes stale.
  • Cancels polling, in-flight requests, and active menus during reload, session replacement, and shutdown.

📦 Install

Install from npm:

pi install npm:@narumitw/pi-ticker

Try without installing permanently:

pi -e npm:@narumitw/pi-ticker

Build and load this package from a local checkout:

npm --workspace @narumitw/pi-ticker run build
pi --no-extensions -e ./packages/pi-ticker

The package declares dist/index.ts, so an unbuilt local checkout must run the build before Pi loads the package directory.

Pi loads the generated TypeScript entrypoint through Jiti while menu code remains in lazy JavaScript chunks.

Extensions run with Pi's permissions, so install only trusted packages.

🚀 Quick start

Open the ticker manager in TUI mode:

/ticker

Choose Add custom ticker… and enter a Yahoo Finance symbol such as MSFT, SPY, or BTC-USD.

The widget appears after the settings save and the first quote request completes.

🧭 Ticker manager

/ticker opens Manage tickers in TUI and RPC modes.

In TUI mode, one screen provides search, symbol removal, direct add, widget visibility, and refresh actions.

The configured confirm binding or Space activates the focused row.

When a valid search has no match, the add row changes to Add SYMBOL for direct addition.

Shift+Up and Shift+Down reorder the focused ticker when the search field is empty and those keys do not conflict with configured standard bindings.

RPC mode exposes portable dialogs for choosing and moving a ticker.

Each accepted change saves immediately.

If a save fails, the manager restores the previous displayed and effective value.

Removing the final symbol hides the widget and stops polling.

Escape closes transient TUI flows, and Ctrl+C remains a hard-close path.

💬 Commands

  • /ticker opens the ticker manager.
  • /ticker <SYMBOL ...> replaces the complete ordered symbol list and refreshes quotes.
  • /ticker refresh refreshes quotes immediately when the widget is enabled.
  • /ticker help shows direct-command usage.
  • /ticker reset reports that no default symbol list exists and leaves settings unchanged.

Known routes reject trailing arguments.

All command routes support TUI and RPC modes.

Print and JSON modes reject the command before changing settings.

⚙️ Settings

The canonical user settings file is:

<getAgentDir()>/pi-ticker.json

The normal path is ~/.pi/agent/pi-ticker.json.

Pi's configured agent directory replaces ~/.pi/agent when applicable.

Ticker preferences are user-scoped and apply across projects.

The extension does not read project settings or extension-specific environment-variable overrides.

A missing file uses an empty symbol list, keeps the widget enabled, and does not create the file, its parent directory, or a polling task.

The settings file must contain a JSON object with these optional fields:

Field Accepted values Default Behavior
symbols Zero to ten Yahoo Finance symbol strings [] Controls the ordered quotes shown in the widget.
widgetEnabled boolean true Controls widget visibility and quote polling.

Each symbol may contain up to 15 uppercase letters, digits, ., ^, =, or -.

Lowercase command and menu input is normalized to uppercase.

Example:

{
  "symbols": ["NVDA", "BTC-USD", "ETH-USD"],
  "widgetEnabled": true
}

Unknown JSON fields are preserved during saves.

Malformed or invalid settings use runtime defaults and leave the file unchanged.

Pi shows a warning when UI is available.

Writes are ordered within one Pi process and published through a temporary file plus atomic rename.

Reload and session replacement wait for accepted writes before loading the next settings snapshot.

Separate Pi processes do not share a cross-process lock.

Settings reload on startup and /reload.

🔒 Security and privacy

The extension requests public quote metadata from Yahoo Finance over HTTPS without an API key.

Requested ticker symbols and the host network address are visible to Yahoo Finance.

The user settings file contains only ticker symbols and widget visibility; it stores no credential or secret.

The extension displays ticker symbols and quote data locally without adding them to model context.

🚧 Limitations

Yahoo Finance is an unofficial dependency and may rate-limit, delay, change, or remove the endpoint.

Quotes may be delayed and are not suitable for trading decisions.

Each request times out after 10 seconds, and one symbol failure does not discard successful symbols.

Each Pi session owns its polling queue, and separate Pi processes do not share one.

🗂️ Package layout

packages/pi-ticker/
├── src/
│   ├── index.ts       # Thin source entrypoint for repository loading and runtime builds
│   ├── ticker.ts      # Registration, commands, polling, and lifecycle ownership
│   ├── menu.ts        # Mode dispatch and RPC management flow
│   ├── tui-menu.ts    # Searchable TUI manager and reorder shortcuts
│   ├── settings.ts    # Validation and atomic user-settings persistence
│   ├── quotes.ts      # Yahoo Finance requests and response parsing
│   └── render.ts      # Width-bounded plain and themed widget rendering
├── scripts/
│   └── build-runtime.mjs  # Deterministic runtime builder and boundary validator
├── dist/              # Generated Jiti entrypoint, lazy chunks, and source maps
├── test/              # Deterministic package behavior and generated-runtime tests
├── README.md
├── LICENSE
├── package.json
└── tsconfig.json

🔎 Keywords

Pi extension, market quotes, stock ticker, Yahoo Finance, editor widget, terminal UI, TypeScript.

📄 License

MIT