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

.cdm-java.5.0.1.source-code.observable-event-func.rosetta Maven / Gradle / Ivy

There is a newer version: 6.0.0-dev.89
Show newest version
namespace cdm.observable.event : <"Observable event concepts: extraordinary event, trigger event, disruption event etc.">
version "${project.version}"

import cdm.base.math.*

import cdm.observable.asset.*
import cdm.event.common.*
import cdm.product.template.*

func Create_AssetPayoutTradeStateWithObservations: <"Attaches a set of Observations to a Security Finance Transaction.">
    inputs:
        billingInstruction BillingRecordInstruction (1..1)
    output:
        tradeState TradeState (1..1)

    alias assetPayout:
        billingInstruction -> tradeState -> trade -> tradableProduct -> product -> contractualProduct -> economicTerms -> collateral ->
            collateralPortfolio -> collateralPosition -> product -> contractualProduct -> economicTerms -> payout -> assetPayout only-element

    alias date: billingInstruction -> recordEndDate

    set tradeState: billingInstruction -> tradeState

    add tradeState -> resetHistory:
        Create_AssetReset(assetPayout, billingInstruction -> observation, date)

func Create_AssetReset: <"Defines how to resolve the reset value for an equity payout.">
    inputs:
        assetPayout AssetPayout (1..1) <"Represents the AssetPayout to which the reset will apply.">
        observation Observation (1..*) <"Represents the observations that will be used to compute the reset value.">
        resetDate date (1..1) <"Specifies the date of the reset.">
    output:
        reset Reset (1..1)

    set reset -> resetValue: <"Assigns the observed value to the reset value.">
        ResolveObservationAverage(observation)
    // work out the average as the value to be used in the calculation
    set reset -> resetDate: resetDate

    add reset -> observations: <"Assigns the observation required to compute the rest value as audit.">
        observation

    set reset -> averagingMethodology -> averagingMethod -> calculationMethod:
        AveragingCalculationMethodEnum -> Arithmetic

func ResolveObservationAverage: <"Specifies the interface that should be used by implementors to resolve a single observation when provided many, applying the averaging method, if one is provided.">
    inputs:
        observations Observation (1..*)
    output:
        resetValue Price (1..1)

    alias firstObservedValue: observations -> observedValue first

    condition UnitsMatch:
        observations -> observedValue -> unit all = firstObservedValue -> unit

    set resetValue -> value: observations -> observedValue -> value sum / observations count
    set resetValue -> unit: firstObservedValue -> unit
    set resetValue -> perUnitOf: firstObservedValue -> perUnitOf
    set resetValue -> priceExpression: firstObservedValue -> priceExpression
    set resetValue -> priceType: firstObservedValue -> priceType




© 2015 - 2025 Weber Informatics LLC | Privacy Policy