Price Formula lets you modify the market price of an asset using simple JavaScript-like formulas.

You can modify the formula in the Prices tab of an Asset. It will only be available for assets that use Market prices.

There are three variables available:

  • date - calculated date (as YYYY-mm-dd)

  • price - Market Price from the market data source for the date

  • openDate - date on which this asset sub-position was opened (can be used for fixed-income pricing)

Examples

You can use those to model assets that are not handled by Capitally, but whose prices can be calculated from the Market Price of an actual asset.

  • Offset a market price by certain amount: price - 123

  • Add a split event: date >= "2023-03-01" ? price / 2 : price

  • Shorted asset (or any liability): -price

  • Call option : price - PREMIUM

  • Put option: PREMIUM - price

  • Leverage: 100 * price