Plugins
PnlTracker has a plugin system that allows you to extend its features without modifying the application's source code. Plugins are developed in the plugins-dev/ folder and compiled into .zip format to be imported into the application. This is very convenient for adding custom features while keeping a clean codebase.
Prerequisites
- Node.js ≥ 20
- pnpm installed
Compile a plugin
Replace hello-plugin with your plugin's name:
PLUGIN=hello-plugin npx vite build --config plugins-dev/vite.config.plugin.ts
Examples with included plugins:
PLUGIN=trade-stats-plugin npx vite build --config plugins-dev/vite.config.plugin.ts
PLUGIN=file-processor-plugin npx vite build --config plugins-dev/vite.config.plugin.ts
PLUGIN=instrument-type-fixer npx vite build --config plugins-dev/vite.config.plugin.ts
Included examples
The plugins-dev/ folder contains several example plugins you can use as a starting point:
| Plugin | Description |
|---|---|
hello-plugin | Demonstration plugin showing modals, toasts, and page slots on the dashboard, trades, calendar, and daily views. |
trade-stats-plugin | Displays a quick summary of recent trading performance in a modal. |
file-processor-plugin | Upload, process, and download files directly in the browser. |
instrument-type-fixer | Bulk-fix the instrument type for all trades of an account. |
tradingview-converter | Converts TradingView exports (backtests) to PnlTracker's Standard CSV format. |
Compile a release version
The release version is optimized and minified. It is intended for distribution.
PLUGIN=hello-plugin RELEASE=true npx vite build --config plugins-dev/vite.config.plugin.ts
Installation in PnlTracker
- Go to Settings > Plugins.
- Click Import plugin and select the generated
.zipfile. - Enable the plugin, then click Run.
plugins-dev/ folder. See the README files and examples to create your own extensions.Page slots
Plugins can inject content into existing pages via slots. Each slot is identified by an ID. Available slots:
| Slot | Page | Description |
|---|---|---|
page-daily | Daily view | Injection into the Daily page |
page-calendar | Calendar | Injection into the Calendar page |
trade-filters | Trade filters | Injection into the TradeFilters component |
UI components
Plugins have access to ready-to-use UI components:
UIButton: buttonUIInput: input fieldUISelect: dropdown select
SDK
The SDK exposes calculation functions (P&L, APPT, winrate, profit factor, recovery factor, Sharpe ratio, etc.), API access (get/post/put/delete), toast notifications, theme detection, and i18n locale.