Class Portfolio

java.lang.Object
com.quantfinlib.risk.Portfolio

public final class Portfolio extends Object
Multi-asset portfolio of positions with live price updates. Thread-safe: prices may be updated concurrently from a market data feed while analytics read valuations.
  • Constructor Details

    • Portfolio

      public Portfolio()
  • Method Details

    • addPosition

      public Portfolio addPosition(String symbol, double quantity, double price)
    • updatePrice

      public void updatePrice(String symbol, double price)
      Updates the mark price of an existing position (no-op for unknown symbols).
    • totalValue

      public double totalValue()
    • weights

      public Map<String,Double> weights()
      Current weights by symbol (insertion order not guaranteed).
    • position

      public Portfolio.Position position(String symbol)
    • positions

      public Collection<Portfolio.Position> positions()
    • size

      public int size()