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 is offered only while the asset's Pricing method is Market. The Market prices section inside interest-based pricing is a different control and does not enable formulas.

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, so a formula can price relative to when the position started

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
  • Unit conversion (a 100 g gold bar priced from XAU, quoted per troy ounce): price * 3.2151 - see Tracking Precious Metals