Package Exports
- @nepse-toolkit/store
Readme
@nepse-toolkit/store
SQLite storage layer for NEPSE toolkit — local-first persistence for market data and portfolio.
Part of the nepse-toolkit monorepo.
Features
- SQLite database via better-sqlite3 with WAL mode for concurrent reads
- Auto-migrations — schema versioning with automatic upgrades
- OHLCV storage — historical price data with date-range queries
- Portfolio — positions, watchlists, and price alerts
- Local-first — data stored at
~/.nepse-toolkit/nepse.dbfor offline analysis
Install
npm install @nepse-toolkit/storeUsage
import { NepseDatabase } from "@nepse-toolkit/store";
const db = new NepseDatabase();
// Store and query OHLCV data
db.upsertOHLCV("NABIL", ohlcvData);
const history = db.getOHLCV("NABIL", "2024-01-01", "2024-12-31");
// Portfolio management
db.addPosition("NABIL", 100, 850, "2024-06-15");
const positions = db.getPositions();
// Watchlists
db.addToWatchlist("banking", "NABIL");
const watchlist = db.getWatchlist("banking");Note: Uses better-sqlite3 (native addon). Requires Node.js — not compatible with Bun runtime.
License
MIT