All Downloads are FREE. Search and download functionalities are using the official Maven repository.

.cdm-java.6.0.0-dev.82.source-code.observable-asset-func.rosetta Maven / Gradle / Ivy

namespace cdm.observable.asset : <"Observable concepts applicable to assets: price, reference price, valuation method etc.">
version "${project.version}"

import cdm.base.math.*

func FilterPrice: <"Filter list of prices based on price type.">
    inputs:
        prices PriceSchedule (0..*) <"List of prices to filter.">
        priceType PriceTypeEnum (1..1) <"The price type to filter by: asset price, cash price, exchange rate etc.">
        arithmeticOperators ArithmeticOperationEnum (0..*) <"Optionally filter based on the type of operator, e.g. if price is specified as a spread or a multiplier. Several operators can be passed as arguments (e.g. [ Add, Subtract ]).">
        priceExpression PriceExpressionEnum (0..1) <"Optionally filter by type of price expression: percentage of notional, par value fraction">
    output:
        price PriceSchedule (0..1)

    set price: <"Return as single element rather than a list.">
        prices
            filter item -> priceType = priceType
            then filter
                if arithmeticOperators exists
                then arithmeticOperators contains item -> arithmeticOperator
                else True
            then filter
                if priceExpression exists
                then item -> priceExpression = priceExpression
                else True
            then only-element

func InterestRateObservableCondition: <"Implementation for PriceQuantity.InterestRateObservable condition.">
    inputs:
        pq PriceQuantity (1..1)
    output:
        valid boolean (0..1)

    set valid:
        if pq -> observable -> Index -> FloatingRateIndex exists and pq -> price exists
        then pq -> price
                extract [
                    priceType = PriceTypeEnum -> InterestRate and arithmeticOperator exists
                ] all = True




© 2015 - 2025 Weber Informatics LLC | Privacy Policy