Skip to content

Instantly share code, notes, and snippets.

View barbeque's full-sized avatar

Mike barbeque

  • Calgary AB Canada
View GitHub Profile
/* 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)
@barbeque
barbeque / resistor_code.py
Created February 28, 2012 03:55 — forked from shilrobot/resistor_code.py
cleaned up keyboard binding
colors = [
(0,0,0),
(150,75,0),
(255,0,0),
(255,165,0),
(255,255,0),
(154,205,50),
(100,149,237),