‹ Plugins / Stock Portfolio Tracker
Scheduled

Stock Portfolio Tracker

The Stock Portfolio Tracker plugin pulls live prices for stocks, ETFs, and mutual funds into InfluxDB 3, rolled up into the portfolios and categories you define. It knows market hours, so it skips redundant fetches and carries forward the last price to keep totals accurate between ticks. Query net worth trend, category exposure, or daily P&L in SQL. No spreadsheet, no manual updates.

Configuration

Plugin parameters may be specified as key-value pairs in the --trigger-arguments flag (CLI) or in the trigger_arguments field (API) when creating a trigger. The plugin also supports a TOML configuration file for the full portfolio shape; the trigger-argument form is best for one-off testing.

Plugin metadata

This plugin includes a JSON metadata schema in its docstring that defines the supported trigger type and configuration parameters. This metadata enables the InfluxDB 3 Explorer UI to display and configure the plugin.

Optional parameters

Parameter Type Default Description
database string stocks Target database for writes.
portfolio string AAPL:1|MSFT:1|GOOG:1 Inline holdings: pipe-separated SYMBOL:QUANTITY[:PORTFOLIO_NAME] entries (e.g. AAPL:10:401k|MSFT:5:401k|GOOG:2.5:brokerage). Portfolio defaults to main. When omitted and no TOML config is found, falls back to the default shown.
categories string none Inline category map: pipe-separated PORTFOLIO:CATEGORY entries (e.g. 401k:Retirement|brokerage:Investment).
config_path string stock_plugin.toml Path to the TOML config file, relative to the InfluxDB plugin directory (or absolute). The default file is loaded when it exists; an explicit config_path that does not exist is an error.
write_during_closed_hours boolean true See the TOML table below. Also settable as a trigger argument.
mutual_fund_check_time string 18:00 See the TOML table below. Also settable as a trigger argument.
market_calendar string NYSE See the TOML table below. Also settable as a trigger argument.
market_timezone string America/New_York See the TOML table below. Also settable as a trigger argument.
  • If neither portfolio nor a TOML file with [holdings.name] is provided, the plugin runs with the default holdings AAPL:1|MSFT:1|GOOG:1 in the main portfolio. *

TOML configuration

The TOML file is the recommended way to configure anything more than a handful of holdings. The plugin reads it from config_path (default: /stock_plugin.toml</code>).

Trigger arguments take precedence over TOML keys of the same name, so a TOML file can hold the full portfolio shape while a trigger argument overrides a single setting.

Holdings and categories are the exception, because each is spelled differently per source:

Setting Trigger argument TOML
Holdings portfolio=AAPL:10:401k|MSFT:5:401k [holdings.401k] tables
Categories categories=401k:Retirement [portfolio_categories] table

Each spelling is read only from its own source: a top-level portfolio or categories key in the TOML file is ignored, as is a trigger argument named holdings or portfolio_categories. When both sources are present, the trigger argument replaces the TOML tables entirely rather than merging with them.

Key Type Default Description
database string stocks Target database for writes.
write_during_closed_hours boolean true When false, stocks/ETFs are skipped outside the configured exchange’s regular session (the calendar handles holidays and early closes). Mutual funds always follow their own daily check schedule.
mutual_fund_check_time string "18:00" Time of day in market_timezone after which the plugin fetches mutual fund NAV. Mutual funds are fetched at most once per local calendar day, at the first tick at or after this time. Bootstrap exception: a mutual fund with no cached asset type is fetched on its first tick regardless of time.
market_calendar string "NYSE" Exchange calendar used for the market-hours check. Any name accepted by pandas_market_calendars (e.g. NYSE, LSE, TSX, JPX, XETR, ASX, HKEX).
market_timezone string "America/New_York" IANA timezone for the exchange’s local time. Used for mutual_fund_check_time comparisons and for resolving the “today” date the calendar consults.
[portfolio_categories] table empty Maps portfolio name to category name. Portfolios not listed are uncategorized (omitted from category_totals).
[holdings.]</code> table default holdings Holdings for each portfolio. Each entry is SYMBOL = quantity. Fractional quantities supported; the quantity must be a finite number (inf and nan are rejected). Quote symbols containing dots, for example "VOD.L" = 10. Duplicate same-symbol entries in one portfolio are aggregated. The portfolio name _total is reserved. When no [holdings.*] section is present, the plugin falls back to AAPL:1|MSFT:1|GOOG:1.

The trigger spec is the source of truth for cadence. For example, --trigger-spec "every:15m" runs the plugin every 15 minutes.

Example TOML configuration

stock_plugin.toml.example

Ready to get started?

Download InfluxDB 3 and have Stock Portfolio Tracker running in minutes.