Premium

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.

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": BigDecimal,
    "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": BigDecimal,
        "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": BigDecimal,
    "indemnity_per_event": BigDecimal,
    "indemnity_in_aggregate": BigDecimal,
    "lump_sum_payment": BigDecimal,
    "deductible": BigDecimal,
    "premium": BigDecimal,
    "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,
}