Skip to main content
Version: v4

InfluxDB data model

SuiviBourse writes everything — live scrapes and backfilled history — to a single InfluxDB 3 Core measurement: portfolio_metrics. Data is written with second precision.

Tags

Tags identify the series and are used to filter/group in Grafana.

TagDescriptionExample
share_nameDisplay nameApple
share_symbolYahoo! Finance tickerAAPL
accountAccount bucket (default unless accounts are declared)PEA, default
share_currencyCurrencyUSD
share_exchangeExchangeNMS, PAR
quote_typeInstrument typeEQUITY, ETF
note

share_name and share_symbol are always set. The currency/exchange/quote-type tags are only written when the ticker info was successfully fetched, so that historical and live points share the same series identity.

The account tag is on v4.1+ writes only, not on history

The account tag is carried by 100% of the points written from v4.1 onwardsnot by points written before the upgrade, which have no tag and are exposed as NULL. Always read it with COALESCE(account, 'default') and never with a bare WHERE account = '…' (which would silently drop the pre-v4.1 points). See Upgrading to accounts for the full picture.

Fields

FieldDescription
share_priceCurrent or historical price (Close)
price_openOpen price (OHLC, for candlestick panels)
price_highHigh price (OHLC)
price_lowLow price (OHLC)
purchased_quantityQuantity bought
purchased_priceWeighted average cost price
purchased_feeTotal fees
owned_quantityQuantity currently owned
received_dividendTotal dividends received
dividend_yieldDividend yield (percentage)
pe_ratioPrice-to-Earnings ratio
market_capMarket capitalization
volumeTrading volume
note

Market fields such as dividend_yield, pe_ratio and market_cap may be missing for some instruments (e.g. ETFs or crypto). Fields are only written when a value is available.

Account measurements

For opt-in accounts, SuiviBourse also writes two daily measurements: account_metrics (tags account / account_type / account_currency; fields cash_balance, holdings_value, total_value, net_contributed, xirr, gain_absolu, twr_index) and portfolio_totals — the same performance fields at the global level, written with no tag (a synthetic account tag would double every SUM()), only when all accounts share one currency.

Querying with SQL

InfluxDB 3 is queried with SQL. Grafana uses its InfluxDB datasource in SQL query mode (POST, database suivi_bourse). A simple query:

SELECT time, share_price
FROM portfolio_metrics
WHERE share_symbol = 'AAPL'
ORDER BY time

Compute the current market value of a position:

SELECT time, share_price * owned_quantity AS position_value
FROM portfolio_metrics
WHERE share_symbol = 'AAPL'
ORDER BY time

Connection

The writer is configured through environment variables:

VariableDefaultDescription
INFLUXDB_HOSThttp://influxdb:8181InfluxDB 3 host URL
INFLUXDB_TOKEN(required)InfluxDB API token
INFLUXDB_DATABASEsuivi_bourseDatabase name

In the Docker Compose stack, the database is created automatically by influxdb3-init.sh and the token is provisioned into both InfluxDB and the Grafana datasource.

Development token

The provisioned token is a development value shipped for zero-config local use. Change it before any non-local deployment — see the token note in the Docker Compose guide.

Long-running deployments & Parquet files

InfluxDB 3 Core does not auto-compact: every write batch lands new Parquet files that are never merged. SuiviBourse keeps this in check by writing the account performance series incrementally — a steady scrape cycle rewrites only today's point instead of the whole daily history — so file growth stays bounded in normal operation.

If a query still hits Core's per-query file cap (default 432), for example after a very long uptime or a large backfill, you'll see errors like:

Query would scan N Parquet files, exceeding the file limit.

Raise the cap on the InfluxDB container:

environment:
- INFLUXDB3_QUERY_FILE_LIMIT=20000 # default is 432

For heavy, always-on workloads, InfluxDB 3 Enterprise adds automatic compaction, which removes the fragmentation entirely.