This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Expected exposure is the expected (average) credit exposure conditional on positive market values */ | |
def expectedExposure(marketValues: Seq[Double]): Double = { | |
val exposures = marketValues.filter(_ > 0f) | |
if (exposures.size == 0) 0.0 | |
else exposures.sum / exposures.size | |
} | |
/* A high percentile (95%) of the distribution of exposures at any particular future date. Also called Peak Exposure (PE) */ | |
def potentialFutureExposure(marketValues: Seq[Double], confidenceLevel: Double): Double = { | |
val exposures = marketValues.filter(_ > 0) |