Premium Calculations (Legacy)

Warning

The functionality described in this topic is deprecated. Socotra recommends using the JavaScript-based Rating Plugin for pricing and commission calculations.

Socotra’s pricing engine uses a syntax called Liquid, created by Shopify. For more information see the Liquid Language Reference.

Socotra also supports a set of custom functions in Liquid, documented here: Socotra Liquid Filters

Usage

Every peril must have a premium calculation defined in [peril_name].premium.liquid, stored in the folder policy/exposures/[myExposureName]/perils/. At the end of a calculation, use set_month_premium or set_year_premium to store the result. Technical premium and commissions may be set similarly in this file.

Socotra will automatically scale all amounts set in premium calculation files to match the duration of coverage, with straight-line proration for partial months or years, respectively.

Warning

Within a product, peril names should be unique and not duplicated across exposures. While the perils are deployed within a configuration file as a hierarchical structure, they are flattened upon deployment and only one file, such as my_peril_name.premium.liquid will be used for all premium calculations for that peril name, even if you deploy different calculation files for each exposure’s peril.

Example

{% assign rate = "vehicle_rate_table" | lookup: data.exposure_characteristics.field_values.vehicle_type %}
{% assign premium = premium | times: rate | round %}

{{ premium | set_year_premium }}

Data available in premium calculations

Premium calculations have access to a data object containing information on the policy, exposure, and peril in question. In addition, data for the entire policy, including other exposures and perils, is provided in the policy object, as described in the Document Templates. page.

Structure of the “data” object

"data": {
  "policy": {},
  "policy_characteristics": {},
  "exposure_characteristics": {},
  "peril_characteristics": {},
  "operation": "new_business" | "endorsement" | "renewal"
}

data.policy_characteristics

{
  "locator": string,
  "policy_start_timestamp": long,
  "policy_end_timestamp": long,
  "gross_premium": number,
  "gross_premium_currency": string,
  "gross_taxes": string,
  "gross_taxes_currency": string,
  "issued_timestamp": long,
  "field_values": ValuesMap,
  "field_groups_by_locator": map<String, ValuesMap>,
  "policyholder_locator": string,
  "product_locator": string,
  "created_timestamp": long,
  "tax_groups": [
    {
      "name": string,
      "amount": number,
      "amount_currency": string
    }
  ]
}

data.exposure_characteristics

{
  "locator": string,
  "field_values": ValuesMap,
  "field_groups_by_locator": map<String, ValuesMap>,
  "created_timestamp": long,
  "updated_timestamp": long,
  "policy_locator": string,
  "policyholder_locator": string,
  "product_locator": string
}

data.peril_characteristics

{
  "locator": string,
  "issued_timestamp": long,
  "exposure_characteristics_locator": string,
  "policy_characteristics_locator": string,
  "indemnity_per_item": number,
  "indemnity_per_event": number,
  "indemnity_in_aggregate": number,
  "lump_sum_payment": number,
  "deductible": number,
  "premium": number,
  "coverage_start_timestamp": long,
  "coverage_end_timestamp": long,
  "original_coverage_end_timestamp": long,
  "field_values": ValuesMap,
  "field_groups_by_locator": map<String, ValuesMap>,
  "end_change_bound": long,
  "policy_modification_locator": string,
  "policyholder_locator": string,
  "policy_locator": string,
  "created_timestamp": long,
  "updated_timestamp": long
}