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

.cdm-java.6.0.0-dev.82.source-code.event-position-func.rosetta Maven / Gradle / Ivy

namespace cdm.event.position : <"Position concepts: portfolio and portfolio aggregation.">
version "${project.version}"

import cdm.base.math.*
import cdm.product.template.*
import cdm.event.common.*
import cdm.base.staticdata.party.*

func FxMarkToMarket: <"Representation of sample mark to market calculation provided by a member firm.">
    inputs:
        trade Trade (1..1)
    output:
        value number (1..1)

    alias settlementPayout: <"Alias to the forward pay out.">
        trade -> product -> economicTerms -> payout -> SettlementPayout only-element

    alias quotedCurrency: <"The quoted currency.">
        trade -> tradeLot -> priceQuantity -> price -> unit -> currency
            distinct
            only-element

    alias baseCurrency: <"The base currency.">
        trade -> tradeLot -> priceQuantity -> price -> perUnitOf -> currency
            distinct
            only-element

    alias quantities: <"Quantity list. Only works in the case of a single trade lot.">
        trade -> tradeLot only-element -> priceQuantity -> quantity

    alias quotedQuantity: <"Quoted quantity amount.">
        FilterQuantityByCurrency(quantities, quotedCurrency) only-element -> value

    alias baseQuantity: <"Base quantity amount.">
        FilterQuantityByCurrency(quantities, baseCurrency) only-element -> value

    alias interpolatedRate: InterpolateForwardRate(settlementPayout)

    condition SettlementPayoutExists: <"The settlementPayout on the contract must exist.">
        trade -> product -> economicTerms -> payout -> SettlementPayout exists

    set value: (quotedQuantity / interpolatedRate - baseQuantity) * interpolatedRate

func InterpolateForwardRate:
    inputs:
        settlementPayout SettlementPayout (1..1)
    output:
        result number (1..1)

func EvaluatePortfolioState: <"Function specification to evaluate a portfolio's aggregation parameters and return a new portfolio state containing aggregated positions.">
    inputs:
        portfolio Portfolio (1..1) <"Portfolio containing the aggregation parameters to be used to calculate the new portfolio state.">
    output:
        portfolioState PortfolioState (1..1) <"Portfolio state containing the aggregated positions based on the input aggregation parameters.">

func IsValidPartyRole:
    inputs:
        partyRoles PartyRole (0..*)
        validRoles PartyRoleEnum (1..*)
    output:
        isValid boolean (1..1)
    set isValid:
        partyRoles
            extract (validRoles contains role)
            then all = True




© 2015 - 2025 Weber Informatics LLC | Privacy Policy