👷
This is an Early Access Feature - you need to enable it first
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 (asYYYY-mm-dd)price- Market Price from the market data source for the dateopenDate- date on which this asset sub-position was opened, so a formula can price relative to when the position started
💡 Bonds, deposits and loans do not need a formula. Interest-based pricing carries the coupon schedule, the day-count convention and the accrual, and prices the clean side from a market quote or from prices you enter.
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