From 1155b7487e0aff15a5c7ec246fa512339a256ec5 Mon Sep 17 00:00:00 2001 From: Lakshmi Krishnamurthy Date: Sat, 16 Dec 2023 13:54:52 -0500 Subject: [PATCH] Features: Bug Fixes/Re-organization: - R^d Path Vertex Realizations Evolution #1 (1, 2) - R^d Path Vertex Realizations Evolution #2 (3, 4, 5) - R^d Path Vertex Realizations Evolution #3 (6, 7, 8) - State Sequence R^d Path Vertex Annotation (9) - State Sequence Path Vertex Govvie Curve (10, 11, 12) - State Sequence Path Vertex Govvie Constructor (13, 14, 15) - State Sequence Path Vertex Govvie Builder Settings (16, 17) - State Sequence Path Vertex Govvie #1 (18, 19, 20) - State Sequence Path Vertex Govvie #2 (21, 22, 23) - State Sequence Path Vertex Govvie #3 (24, 25) - State Sequence Path Vertex Govvie Standard (26, 27, 28) - State Sequence Path Govvie Constructor (29, 30, 31) - State Sequence Path Govvie Builder Settings (32, 33) - State Sequence Path Govvie Curve (34, 35, 36) - State Sequence Path Govvie (37) - Template IRS AUD (38, 39, 40) - Template IRS CAD (41, 42) - Template IRS CHF (43, 44) - Template IRS CNY (45, 46) - Template IRS DKK (47, 48) - Template IRS EUR (49, 50) - Template IRS GBP (51, 52) - Template IRS HKD (53, 54) - Template IRS INR (55, 56) - Template IRS JPY LIBOR (57, 58) - Template IRS JPY TIBOR (59, 60) Samples: IdeaDRIP: --- ReleaseNotes/01_30_2023.txt | 36 +++ ScheduleSheet.xlsx | Bin 48680 -> 48693 bytes .../org/drip/state/sequence/PathGovvie.java | 111 ++++++---- .../drip/state/sequence/PathVertexGovvie.java | 207 +++++++++++------- src/main/java/org/drip/template/irs/AUD.java | 108 ++++----- src/main/java/org/drip/template/irs/CAD.java | 108 ++++----- src/main/java/org/drip/template/irs/CHF.java | 140 ++++++------ src/main/java/org/drip/template/irs/CNY.java | 108 ++++----- src/main/java/org/drip/template/irs/DKK.java | 140 ++++++------ src/main/java/org/drip/template/irs/EUR.java | 140 ++++++------ src/main/java/org/drip/template/irs/GBP.java | 140 ++++++------ src/main/java/org/drip/template/irs/HKD.java | 140 ++++++------ src/main/java/org/drip/template/irs/INR.java | 140 ++++++------ .../java/org/drip/template/irs/JPYLIBOR.java | 140 ++++++------ .../java/org/drip/template/irs/JPYTIBOR.java | 140 ++++++------ 15 files changed, 1002 insertions(+), 796 deletions(-) create mode 100644 ReleaseNotes/01_30_2023.txt diff --git a/ReleaseNotes/01_30_2023.txt b/ReleaseNotes/01_30_2023.txt new file mode 100644 index 000000000000..01a6acb0fe77 --- /dev/null +++ b/ReleaseNotes/01_30_2023.txt @@ -0,0 +1,36 @@ + +Features: + +Bug Fixes/Re-organization: + + - R^d Path Vertex Realizations Evolution #1 (1, 2) + - R^d Path Vertex Realizations Evolution #2 (3, 4, 5) + - R^d Path Vertex Realizations Evolution #3 (6, 7, 8) + - State Sequence R^d Path Vertex Annotation (9) + - State Sequence Path Vertex Govvie Curve (10, 11, 12) + - State Sequence Path Vertex Govvie Constructor (13, 14, 15) + - State Sequence Path Vertex Govvie Builder Settings (16, 17) + - State Sequence Path Vertex Govvie #1 (18, 19, 20) + - State Sequence Path Vertex Govvie #2 (21, 22, 23) + - State Sequence Path Vertex Govvie #3 (24, 25) + - State Sequence Path Vertex Govvie Standard (26, 27, 28) + - State Sequence Path Govvie Constructor (29, 30, 31) + - State Sequence Path Govvie Builder Settings (32, 33) + - State Sequence Path Govvie Curve (34, 35, 36) + - State Sequence Path Govvie (37) + - Template IRS AUD (38, 39, 40) + - Template IRS CAD (41, 42) + - Template IRS CHF (43, 44) + - Template IRS CNY (45, 46) + - Template IRS DKK (47, 48) + - Template IRS EUR (49, 50) + - Template IRS GBP (51, 52) + - Template IRS HKD (53, 54) + - Template IRS INR (55, 56) + - Template IRS JPY LIBOR (57, 58) + - Template IRS JPY TIBOR (59, 60) + + +Samples: + +IdeaDRIP: diff --git a/ScheduleSheet.xlsx b/ScheduleSheet.xlsx index e7dbbf02f3c9bc70a8b1c9d3c478d3dba8f58757..cc425acc6bdb09687b5167648d7918279d1d7052 100644 GIT binary patch delta 2189 zcmZvdX*ARg8^&kG60#G9G-6O>*Ni-A6yvdu<&BgWMYhn`%98#i*|+AOWoS$?#AJ&J zjdhYG*+-4CyyLMY*&<03Z=Lg=w=eJg>38nyI@g!`ock){!k%+sHJ|zU`U+f^`N4Jm zgMj(O zMef6D5lGpUG@+9Go?360p_Cq}sUdklSyNl%vFDMMWA6p5L(eZTiwZB`FA@t`eu~fvkOjos2jmZG>N7hBaW+GnB_;oe z@yv4=VkIK>U6|rl1&2eJiQ5JINskCM?f6FrE)cQaM`g_qSZMaj^*=5MtIff75>qLu z1+ur0-Sd0<{wCVKp_?vbyjl5P>GKHrcq(GQs&M2fn}Nd{Z9OKVP#SqPa}kb|7Ykmp zHQ(OS``TQdYQo+Gr3+TVjr2N5ukkJfTYUBxYXc?^KH`Al8Q74LH{EqJyLzBx4JQD?kRAV+d_+n)YPVDVL-uM!f6 zGenQQ?~g71Tm|VGTTx?f=ATbH#6ntvuP4wQ-Z}ZfM)ZDyE{POr6h`30To-33sx0x9 ztbE`NaKAQ6eygJfun8xYe$e0O>YG#1;=U)|#d&CxEv??Bb`oL~W&U!1@k2!4$%h~i z&Mr!b1kQYPA=?~3bXsiJONqB>3t3~vrZ4aeh9?$ziB8_}8kl%Riea84*_*gq{ftZ6 z?LPiq@opKg;g`cF@yRJGP-OM#en!5e;Jc+!w|1$A<8}2ryg>RM40IHhu2T@Qh6%Dd z8m!f$ArK`nSopZO|G5vT0Wpm0ec~0Kwm}P2uuk|WtZfdQ5)OmXK_?MgfbFM;@9R*4 zBNvY#%%gTf)-Fk(6#d7jf8iO%{!1qpO|sjcp}0Z|m3{z^+EmvmKB6`i7@)X$w*!ao zQ*?hlsot6DI|cb5kskQ*i{@y%u%`!tT^pM)(pOYv5O+f5pKxst>lZ72_SuEnvDa8Gi#Sq7$_B^wfnN z=kBk@Ymz!Tg9=72lxsp=k~i{}X{5@d%Nal4WrddgTb^3E;btafQa#_DfC|PzC&ss{ zdIWFHJEe17Ls-{R}!6k;Ai!B(QY=MzF9 zaC{?pTz9}gbo58}iJ)t^@g^2OMU{dksQXXnFAUQmI`TVScZ>BfC?ole{|9~+ztVA+ z%|{Y3sH7BoSy747>GHxmA+A2(N(4I`(9=NjqXJ!l2&pbl|I1+-64;su@@yPc4A2#K z<~WfU=d>5q8mR>wVsM-dLr^wq!{;|9%~yBKYlyAU z>ns%W!57WgbwSZl%n$tL)rp$o3aEbOL^%ECa=UDjW5$zi%v?(0b^j&t8Hvh5l_(3~ zuTW3Zk80dyh9J)wG*fhvcV8&j9l5BqUB$;;tFp(41AA{Md)z?;u(Lqf{kg|eCwVtm zkC(|eyH^)aH-G{Kr4e2U^*q@vjdwWa>srVgS6#szWY~BcI;i18(RN-8uJvJ<6$(Ss z*oJvssSGoJEXVgKN{c!*|1qdV!1qW^hCh>b!7KykIo#aX@;cHiDu~lLDk7)OKaKBOV%u&FFljoT+EhC5Gks#lX6YKH0 zMiW&sN)VFv^VLfh*j+c)?cI$k`j-Vxb+UY&JP^_y$czagASw^0C3YM(rn(DLD4fi< zU!Fgex1L-{;nC1%9!0lb3`$WQfA92KIMZi&SHowrw>nzo^vQ?X^_=&XZULoRUD;2B z_fXN-&y|<~5OYq)aBD9%${s;^xBo0Mgc!em4Eb#-e&}_)+M;j4%%@ul^@y^t{Jms< zOJbHS+uK6@hGAhwlC0_QTk delta 2155 zcmZuyX*iUP0-YIS4cV9Bl4OWvH?~59jBQAk?Aa>&GIn`G_T8&c49Tu!>}Cd6xlzg( zYql6ms86!5alh|*?vH-l^Xr`F{5U_(^PJOi0;@iOHT=auKR#hT0|Pf1gaNAGlswPF zl4cQa{ zGCJ?F75!5QFr81&=~wDg4&Y9p1qVHv(CRKBh4C<`kq#Ol_)?^qWT+xy92-6Jb-c#+ zKY_&3im7;}XWaBV9`B_m%XmLT&9huo4e>ydt0Ar*f+|IX%-wk~^7i=-*&ghTVeQ_3 z!K1Go+!aDp%`)G(XU}_u(_!lg5pv%fdt{>BDx2bab=vcd_x?VAU{h%KqvaZE%U}RH1IHn@dk&pz^BDzM#WO@W%I#^h6>5Dr_|Dx$m z+`Bg6a#N5oN$A{B72p~7wg(2pTHnWTWmgn&KM`!{NAu8!*|>{0#r-F(WShjTog2J; z7B7w|^RO!org)s4SSy)x>HZ*ga4~367G(NQ8k`d9icoevVy+%4?b$!f#sc2MMGtU+cB=sjm;uE?+N1>ij^QN7I z_u#{W0wOTdOt>d&>+Fe2_ghXA+!^{Z+o-ra%~5D;f3Ue5Fb(&=Q>)0aMqO zVy>6kBaxFn9j4HA3(B732p&f?H=CpC<39Cg6l2;@DUyrz_2n_T@Uz8dKAE~hT@lIy z=}aNAhK;fNV{!HG_2PCByL`XkE3L0y?>WEghJcNUJWZl3MzC{seXngqA|Vh)0v$+A z6adeY=)oLTK905eX8y4~+t>y$tL61}?A$L&=~un+f1db?quh(p5AZ zwz!_WwX-a1DC5LB za6}HMJ8&!^RW5$q$l}_M@dnzxIF1FoRUA~JqAO1Exdn3w6SkWE?{f&B>21Gh`9USN z(dj;QUw^Y{(g;I|LFD&ojK{-r{b@> zDSYglp0t{x*g#w4eg*S8a}+J5^tn8ODTMpI%L7+SX-@rDA;rCM<>vu84y*ZFg&kl+ zEDtbxs-fP3J<2}R=WV}TIq}4p$b5AT*dqgI=u0jft}7Vd`QPN$m6 zS1Mb$y?1J`MOF=9M7Nr%+l`Y}X}J#~L3A89uzPV$oPp26h0A#xw-g@zt`I3;oy)_^ zI$|nsf_j)&S?$tgVl9w+eZiJNhY)4s@$>MS9%mWLxY9M2sHI+i$F zb)PL$fYX&M?cdwjv(qzZlW4r30=!{2ma!?PSqTc{S5ALq^<|Wf3Z&~vU9dO&Io^Pj z#e8c8{HOd{$_@&m%({w#F+{Bz=>xc%$7>}$Bqxi`ww+<;z>qhAgC z>y4FQ1Xg=WSo>$&-Q!qd`C*9~8%8*{`~q`^C+=x_vW?Ey<gtQBPIy2$Xh;~($8DFzA| diff --git a/src/main/java/org/drip/state/sequence/PathGovvie.java b/src/main/java/org/drip/state/sequence/PathGovvie.java index 177328180a08..6e6cc0544be3 100644 --- a/src/main/java/org/drip/state/sequence/PathGovvie.java +++ b/src/main/java/org/drip/state/sequence/PathGovvie.java @@ -1,11 +1,18 @@ package org.drip.state.sequence; +import org.drip.analytics.date.JulianDate; +import org.drip.state.govvie.GovvieCurve; +import org.drip.state.nonlinear.FlatForwardGovvieCurve; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -80,7 +87,15 @@ /** * PathGovvie exposes the Functionality to generate a Sequence of Govvie Curve Realizations across - * Multiple Paths. + * Multiple Paths. It exposes the following functionality: + * + *

+ *
    + *
  • PathGovvie Constructor
  • + *
  • Retrieve the Govvie Builder Settings Instance
  • + *
  • Generate the Rd Path Govvie Curves using the Ground State Yield
  • + *
+ *

* *

*
    @@ -94,91 +109,105 @@ * @author Lakshmi Krishnamurthy */ -public class PathGovvie extends org.drip.state.sequence.PathRd { - private org.drip.state.sequence.GovvieBuilderSettings _gbs = null; +public class PathGovvie extends PathRd +{ + private GovvieBuilderSettings _govvieBuilderSettings = null; /** * PathGovvie Constructor * - * @param gbs Govvie Builder Settings Instance - * @param dblVolatility Volatility - * @param bLogNormal TRUE - The Generated Random Numbers are Log Normal + * @param govvieBuilderSettings Govvie Builder Settings Instance + * @param volatility Volatility + * @param logNormal TRUE - The Generated Random Numbers are Log Normal * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public PathGovvie ( - final org.drip.state.sequence.GovvieBuilderSettings gbs, - final double dblVolatility, - final boolean bLogNormal) - throws java.lang.Exception + final GovvieBuilderSettings govvieBuilderSettings, + final double volatility, + final boolean logNormal) + throws Exception { - super (gbs.groundForwardYield(), dblVolatility, bLogNormal); + super (govvieBuilderSettings.groundForwardYield(), volatility, logNormal); - if (null == (_gbs = gbs)) throw new java.lang.Exception ("PathGovvie Constructor => Invalid Inputs"); + if (null == (_govvieBuilderSettings = govvieBuilderSettings)) { + throw new Exception ("PathGovvie Constructor => Invalid Inputs"); + } } /** - * Generate the Govvie Builder Settings Instance + * Retrieve the Govvie Builder Settings Instance * * @return The Govvie Builder Settings Instance */ - public org.drip.state.sequence.GovvieBuilderSettings govvieBuilderSettings() + public GovvieBuilderSettings govvieBuilderSettings() { - return _gbs; + return _govvieBuilderSettings; } /** - * Generate the R^d Path Govvie Curves using the Initial R^d and the Evolution Time Width + * Generate the Rd Path Govvie Curves using the Ground State Yield * - * @param iNumPath Number of Paths + * @param pathCount Number of Paths * - * @return The R^d Path//Vertex Govvie Curves + * @return The Rd Path/Vertex Govvie Curves */ - public org.drip.state.govvie.GovvieCurve[] curveSequence ( - final int iNumPath) + public GovvieCurve[] curveSequence ( + final int pathCount) { - java.lang.String strCurrency = _gbs.groundState().currency(); + String currency = _govvieBuilderSettings.groundState().currency(); - org.drip.analytics.date.JulianDate dtSpot = _gbs.spot(); + JulianDate spotDate = _govvieBuilderSettings.spot(); - double[][] aadblPathSequence = sequence (iNumPath); + double[][] pathSequenceGrid = sequence (pathCount); - java.lang.String strTreasuryCode = _gbs.code(); + String treasuryCode = _govvieBuilderSettings.code(); - java.lang.String[] astrTenor = _gbs.tenors(); + String[] tenorArray = _govvieBuilderSettings.tenors(); - if (null == aadblPathSequence) return null; + if (null == pathSequenceGrid) { + return null; + } - int iEpochDate = dtSpot.julian(); + int epochDate = spotDate.julian(); - int iNumTenor = astrTenor.length; - int[] aiDate = new int[iNumTenor]; - org.drip.state.nonlinear.FlatForwardGovvieCurve[] aFFGC = new - org.drip.state.nonlinear.FlatForwardGovvieCurve[iNumPath]; + int tenorCount = tenorArray.length; + int[] tenorDateArray = new int[tenorCount]; + FlatForwardGovvieCurve[] flatForwardGovvieCurveArray = new FlatForwardGovvieCurve[pathCount]; - for (int iTenor = 0; iTenor < iNumTenor; ++iTenor) { - org.drip.analytics.date.JulianDate dtTenor = dtSpot.addTenor (astrTenor[iTenor]); + for (int tenorIndex = 0; tenorIndex < tenorCount; ++tenorIndex) { + JulianDate tenorDate = spotDate.addTenor (tenorArray[tenorIndex]); - if (null == dtTenor) return null; + if (null == tenorDate) { + return null; + } - aiDate[iTenor] = dtTenor.julian(); + tenorDateArray[tenorIndex] = tenorDate.julian(); } - for (int iPath = 0; iPath < iNumPath; ++iPath) { + for (int pathIndex = 0; pathIndex < pathCount; ++pathIndex) { try { - if (null == (aFFGC[iPath] = new org.drip.state.nonlinear.FlatForwardGovvieCurve (iEpochDate, - strTreasuryCode, strCurrency, aiDate, aadblPathSequence[iPath]))) + if (null == ( + flatForwardGovvieCurveArray[pathIndex] = new FlatForwardGovvieCurve ( + epochDate, + treasuryCode, + currency, + tenorDateArray, + pathSequenceGrid[pathIndex] + ) + )) { return null; - } catch (java.lang.Exception e) { + } + } catch (Exception e) { e.printStackTrace(); return null; } } - return aFFGC; + return flatForwardGovvieCurveArray; } } diff --git a/src/main/java/org/drip/state/sequence/PathVertexGovvie.java b/src/main/java/org/drip/state/sequence/PathVertexGovvie.java index c18362086141..07ecb63b84e3 100644 --- a/src/main/java/org/drip/state/sequence/PathVertexGovvie.java +++ b/src/main/java/org/drip/state/sequence/PathVertexGovvie.java @@ -1,11 +1,21 @@ package org.drip.state.sequence; +import org.drip.analytics.date.JulianDate; +import org.drip.analytics.support.Helper; +import org.drip.measure.discrete.CorrelatedPathVertexDimension; +import org.drip.measure.process.DiffusionEvolver; +import org.drip.state.govvie.GovvieCurve; +import org.drip.state.nonlinear.FlatForwardGovvieCurve; + /* * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -79,7 +89,20 @@ */ /** - * PathVertexGovvie exposes the Functionality to generate a Sequence of Path/Vertex Govvie Curves. + * PathVertexGovvie exposes the Functionality to generate a Sequence of Path/Vertex Govvie Curves. It + * exposes the following functionality: + * + *

    + *
      + *
    • PathVertexGovvie Constructor
    • + *
    • Generate the Govvie Builder Settings Instance
    • + *
    • Generate the Rd Path/Vertex Govvie Curves using the Initial Rd and the Evolution Time Increment Array
    • + *
    • Generate the Rd Path/Vertex Govvie Curves using the Initial Rd and a Fixed Evolution Time Width
    • + *
    • Generate the Rd Path/Vertex Govvie Curves using the Initial Rd and the Array of Forward Evolution Tenors
    • + *
    • Generate the Rd Path/Vertex Govvie Curves using the Initial Rd and the Array of Forward Evolution Dates
    • + *
    • Generate a Standard Instance of PathVertexGovvie
    • + *
    + *

    * *

    *
      @@ -93,47 +116,58 @@ * @author Lakshmi Krishnamurthy */ -public class PathVertexGovvie extends org.drip.state.sequence.PathVertexRd { - private org.drip.state.sequence.GovvieBuilderSettings _gbs = null; +public class PathVertexGovvie extends PathVertexRd +{ + private GovvieBuilderSettings _govvieBuilderSettings = null; - private org.drip.state.govvie.GovvieCurve[][] curveVertex ( - final double[][][] aaadblPathForward) + private GovvieCurve[][] curveVertex ( + final double[][][] forwardPathRdVertexRealization) { - if (null == aaadblPathForward) return null; + if (null == forwardPathRdVertexRealization) { + return null; + } - org.drip.measure.discrete.CorrelatedPathVertexDimension cpvd = cpvd(); + CorrelatedPathVertexDimension correlatedPathVertexDimension = cpvd(); - int iNumPath = cpvd.numPath(); + int pathCount = correlatedPathVertexDimension.numPath(); - int iNumVertex = cpvd.numVertex(); + int timeVertexCount = correlatedPathVertexDimension.numVertex(); - java.lang.String[] astrTenor = _gbs.tenors(); + String[] tenorArray = _govvieBuilderSettings.tenors(); - java.lang.String strTreasuryCode = _gbs.code(); + String treasuryCode = _govvieBuilderSettings.code(); - org.drip.analytics.date.JulianDate dtSpot = _gbs.spot(); + JulianDate spotDate = _govvieBuilderSettings.spot(); - java.lang.String strCurrency = _gbs.groundState().currency(); + String currency = _govvieBuilderSettings.groundState().currency(); - org.drip.state.nonlinear.FlatForwardGovvieCurve[][] aaFFGC = new - org.drip.state.nonlinear.FlatForwardGovvieCurve[iNumPath][iNumVertex]; + FlatForwardGovvieCurve[][] flatForwardGovvieCurveGrid = + new FlatForwardGovvieCurve[pathCount][timeVertexCount]; - for (int iTimeVertex = 0; iTimeVertex < iNumVertex; ++iTimeVertex) { - org.drip.analytics.date.JulianDate dtEvent = dtSpot.addYears (iTimeVertex + 1); + for (int timeVertexIndex = 0; timeVertexIndex < timeVertexCount; ++timeVertexIndex) { + JulianDate eventDate = spotDate.addYears (timeVertexIndex + 1); - if (null == dtEvent) return null; + if (null == eventDate) { + return null; + } - int iEventDate = dtEvent.julian(); + int eventDateInteger = eventDate.julian(); - int[] aiDate = org.drip.analytics.support.Helper.TenorToDate (dtEvent, astrTenor); + int[] tenorDateArray = Helper.TenorToDate (eventDate, tenorArray); - for (int iPath = 0; iPath < iNumPath; ++iPath) { + for (int pathIndex = 0; pathIndex < pathCount; ++pathIndex) { try { - if (null == (aaFFGC[iPath][iTimeVertex] = new - org.drip.state.nonlinear.FlatForwardGovvieCurve (iEventDate, strTreasuryCode, - strCurrency, aiDate, aaadblPathForward[iPath][iTimeVertex]))) + if (null == ( + flatForwardGovvieCurveGrid[pathIndex][timeVertexIndex] = new FlatForwardGovvieCurve ( + eventDateInteger, + treasuryCode, + currency, + tenorDateArray, + forwardPathRdVertexRealization[pathIndex][timeVertexIndex] + ))) { return null; - } catch (java.lang.Exception e) { + } + } catch (Exception e) { e.printStackTrace(); return null; @@ -141,37 +175,43 @@ private org.drip.state.govvie.GovvieCurve[][] curveVertex ( } } - return aaFFGC; + return flatForwardGovvieCurveGrid; } /** * Generate a Standard Instance of PathVertexGovvie * - * @param gbs Govvie Builder Settings Instance - * @param cpvd Latent State Evolver CPVD Instance - * @param de The Latent State Diffusion Evolver + * @param govvieBuilderSettings Govvie Builder Settings Instance + * @param correlatedPathVertexDimension Latent State Evolver CPVD Instance + * @param diffusionEvolver The Latent State Diffusion Evolver * * @return Standard Instance of PathVertexGovvie */ public static final PathVertexGovvie Standard ( - final org.drip.state.sequence.GovvieBuilderSettings gbs, - final org.drip.measure.discrete.CorrelatedPathVertexDimension cpvd, - final org.drip.measure.process.DiffusionEvolver de) + final GovvieBuilderSettings govvieBuilderSettings, + final CorrelatedPathVertexDimension correlatedPathVertexDimension, + final DiffusionEvolver diffusionEvolver) { - if (null == cpvd || null == de) return null; + if (null == correlatedPathVertexDimension || null == diffusionEvolver) { + return null; + } - int iNumDimension = cpvd.numDimension(); + int dimension = correlatedPathVertexDimension.numDimension(); - org.drip.measure.process.DiffusionEvolver[] aDE = new - org.drip.measure.process.DiffusionEvolver[iNumDimension]; + DiffusionEvolver[] diffusionEvolverArray = new DiffusionEvolver[dimension]; - for (int iDimension = 0; iDimension < iNumDimension; ++iDimension) - aDE[iDimension] = de; + for (int dimensionIndex = 0; dimensionIndex < dimension; ++dimensionIndex) { + diffusionEvolverArray[dimensionIndex] = diffusionEvolver; + } try { - return new PathVertexGovvie (gbs, cpvd, aDE); - } catch (java.lang.Exception e) { + return new PathVertexGovvie ( + govvieBuilderSettings, + correlatedPathVertexDimension, + diffusionEvolverArray + ); + } catch (Exception e) { e.printStackTrace(); } @@ -181,23 +221,24 @@ public static final PathVertexGovvie Standard ( /** * PathVertexGovvie Constructor * - * @param gbs Govvie Builder Settings - * @param cpvd Latent State Evolver CPVD Instance - * @param aDE Array of the Latent State Diffusion Evolvers + * @param govvieBuilderSettings Govvie Builder Settings + * @param correlatedPathVertexDimension Latent State Evolver CPVD Instance + * @param diffusionEvolverArray Array of the Latent State Diffusion Evolvers * - * @throws java.lang.Exception Thrown if the Inputs are Invalid + * @throws Exception Thrown if the Inputs are Invalid */ public PathVertexGovvie ( - final org.drip.state.sequence.GovvieBuilderSettings gbs, - final org.drip.measure.discrete.CorrelatedPathVertexDimension cpvd, - final org.drip.measure.process.DiffusionEvolver[] aDE) - throws java.lang.Exception + final GovvieBuilderSettings govvieBuilderSettings, + final CorrelatedPathVertexDimension correlatedPathVertexDimension, + final DiffusionEvolver[] diffusionEvolverArray) + throws Exception { - super (cpvd, aDE); + super (correlatedPathVertexDimension, diffusionEvolverArray); - if (null == (_gbs = gbs)) - throw new java.lang.Exception ("PathVertexGovvie Constructor => Invalid Inputs"); + if (null == (_govvieBuilderSettings = govvieBuilderSettings)) { + throw new Exception ("PathVertexGovvie Constructor => Invalid Inputs"); + } } /** @@ -206,64 +247,76 @@ public PathVertexGovvie ( * @return The Govvie Builder Settings Instance */ - public org.drip.state.sequence.GovvieBuilderSettings govvieBuilderSettings() + public GovvieBuilderSettings govvieBuilderSettings() { - return _gbs; + return _govvieBuilderSettings; } /** - * Generate the R^d Path/Vertex Govvie Curves using the Initial R^d and the Evolution Time Width + * Generate the Rd Path/Vertex Govvie Curves using the Initial Rd and the Evolution + * Time Increment Array * - * @param adblTimeIncrement Array of the Evolution Time Widths + * @param timeIncrementArray Array of the Evolution Time Widths * - * @return The R^d Path//Vertex Govvie Curves + * @return The Rd Path//Vertex Govvie Curves */ - public org.drip.state.govvie.GovvieCurve[][] pathVertex ( - final double[] adblTimeIncrement) + public GovvieCurve[][] pathVertex ( + final double[] timeIncrementArray) { - return curveVertex (pathVertex (_gbs.groundForwardYield(), adblTimeIncrement)); + return curveVertex (pathVertex (_govvieBuilderSettings.groundForwardYield(), timeIncrementArray)); } /** - * Generate the R^d Path/Vertex Govvie Curves using the Initial R^d and the Evolution Time Width + * Generate the Rd Path/Vertex Govvie Curves using the Initial Rd and a Fixed + * Evolution Time Width * - * @param dblTimeIncrement The Evolution Time Widths + * @param timeIncrement The Evolution Time Widths * - * @return The R^d Path//Vertex Govvie Curves + * @return The Rd Path//Vertex Govvie Curves */ - public org.drip.state.govvie.GovvieCurve[][] pathVertex ( - final double dblTimeIncrement) + public GovvieCurve[][] pathVertex ( + final double timeIncrement) { - return curveVertex (pathVertex (_gbs.groundForwardYield(), dblTimeIncrement)); + return curveVertex (pathVertex (_govvieBuilderSettings.groundForwardYield(), timeIncrement)); } /** - * Generate the R^d Path/Vertex Govvie Curves using the Initial R^d and the Array of Event Tenors + * Generate the Rd Path/Vertex Govvie Curves using the Initial Rd and the Array of + * Forward Evolution Tenors * - * @param astrEventTenor The Array of Event Tenors + * @param forwardEvolutionTenorArray The Array of Forward Evolution Tenors * - * @return The R^d Path//Vertex Govvie Curves + * @return The Rd Path/Vertex Govvie Curves */ - public org.drip.state.govvie.GovvieCurve[][] pathVertex ( - final java.lang.String[] astrEventTenor) + public GovvieCurve[][] pathVertex ( + final String[] forwardEvolutionTenorArray) { - return curveVertex (pathVertex (_gbs.groundForwardYield(), astrEventTenor)); + return curveVertex ( + pathVertex (_govvieBuilderSettings.groundForwardYield(), forwardEvolutionTenorArray) + ); } /** - * Generate the R^d Path/Vertex Govvie Curves using the Initial R^d and the Array of Event Tenors + * Generate the Rd Path/Vertex Govvie Curves using the Initial Rd and the Array of + * Forward Evolution Dates * - * @param aiEventDate The Array of Event Dates + * @param forwardEventDateArray The Array of Forward Event Dates * - * @return The R^d Path//Vertex Govvie Curves + * @return The Rd Path/Vertex Govvie Curves */ - public org.drip.state.govvie.GovvieCurve[][] pathVertex ( - final int[] aiEventDate) + public GovvieCurve[][] pathVertex ( + final int[] forwardEventDateArray) { - return curveVertex (pathVertex (_gbs.groundForwardYield(), _gbs.spot().julian(), aiEventDate)); + return curveVertex ( + pathVertex ( + _govvieBuilderSettings.groundForwardYield(), + _govvieBuilderSettings.spot().julian(), + forwardEventDateArray + ) + ); } } diff --git a/src/main/java/org/drip/template/irs/AUD.java b/src/main/java/org/drip/template/irs/AUD.java index 291b53c8e990..5ec975f373b4 100644 --- a/src/main/java/org/drip/template/irs/AUD.java +++ b/src/main/java/org/drip/template/irs/AUD.java @@ -17,6 +17,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -106,52 +109,47 @@ * @author Lakshmi Krishnamurthy */ -public class AUD { +public class AUD +{ /** * Entry Point * - * @param args Argument Array + * @param argumentArray Argument Array * * @throws Exception Propagate the Exception encountered */ public static final void main ( - final String[] args) + final String[] argumentArray) throws Exception { EnvManager.InitEnv (""); - JulianDate dtSpot = DateUtil.Today(); + JulianDate spotDate = DateUtil.Today(); - String strCurrency = "AUD"; - String strMaturityTenor = "5Y"; + String currency = "AUD"; + String maturityTenor = "5Y"; FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, + spotDate, + currency, "ALL", - strMaturityTenor, + maturityTenor, "MAIN", 0.0206 ); - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); + CurveSurfaceQuoteContainer marketDataContainer = new CurveSurfaceQuoteContainer(); - csqc.setFundingState ( + marketDataContainer.setFundingState ( LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, + spotDate, + currency, + new String[] {"04D", "07D", "14D", "30D", "60D"}, + new double[] {0.0017, 0.0017, 0.0018, 0.0020, 0.0023}, "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, + new double[] {0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160}, "ForwardRate", new String[] { "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" @@ -163,15 +161,15 @@ public static final void main ( ) ); - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), + Map measureMap = irs.value ( + ValuationParams.Spot (spotDate.julian()), null, - csqc, + marketDataContainer, null ); - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); + for (Map.Entry measureMapEntry : measureMap.entrySet()) + System.out.println ("\t | " + measureMapEntry.getKey() + " => " + measureMapEntry.getValue() + " ||"); System.out.println ("\t |------------------------------||"); @@ -205,19 +203,24 @@ public static final void main ( System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.derivedStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.floaterLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + compositePeriod.floaterLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); @@ -250,18 +253,23 @@ public static final void main ( System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.referenceStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); diff --git a/src/main/java/org/drip/template/irs/CAD.java b/src/main/java/org/drip/template/irs/CAD.java index 0c76eaccc68e..1230ee43bf27 100644 --- a/src/main/java/org/drip/template/irs/CAD.java +++ b/src/main/java/org/drip/template/irs/CAD.java @@ -17,6 +17,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -106,52 +109,47 @@ * @author Lakshmi Krishnamurthy */ -public class CAD { +public class CAD +{ /** * Entry Point * - * @param args Argument Array + * @param argumentArray Argument Array * * @throws Exception Propagate the Exception encountered */ public static final void main ( - final String[] args) + final String[] argumentArray) throws Exception { EnvManager.InitEnv (""); - JulianDate dtSpot = DateUtil.Today(); + JulianDate spotDate = DateUtil.Today(); - String strCurrency = "CAD"; - String strMaturityTenor = "5Y"; + String currency = "CAD"; + String maturityTenor = "5Y"; FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, + spotDate, + currency, "ALL", - strMaturityTenor, + maturityTenor, "MAIN", 0.0206 ); - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); + CurveSurfaceQuoteContainer marketDataContainer = new CurveSurfaceQuoteContainer(); - csqc.setFundingState ( + marketDataContainer.setFundingState ( LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, + spotDate, + currency, + new String[] {"04D", "07D", "14D", "30D", "60D"}, + new double[] {0.0017, 0.0017, 0.0018, 0.0020, 0.0023}, "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, + new double[] {0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160}, "ForwardRate", new String[] { "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" @@ -163,15 +161,15 @@ public static final void main ( ) ); - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), + Map measureMap = irs.value ( + ValuationParams.Spot (spotDate.julian()), null, - csqc, + marketDataContainer, null ); - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); + for (Map.Entry measureMapEntry : measureMap.entrySet()) + System.out.println ("\t | " + measureMapEntry.getKey() + " => " + measureMapEntry.getValue() + " ||"); System.out.println ("\t |------------------------------||"); @@ -205,19 +203,24 @@ public static final void main ( System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.derivedStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.floaterLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + compositePeriod.floaterLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); @@ -250,18 +253,23 @@ public static final void main ( System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.referenceStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); diff --git a/src/main/java/org/drip/template/irs/CHF.java b/src/main/java/org/drip/template/irs/CHF.java index 0799a60a6059..ac93d645f4cf 100644 --- a/src/main/java/org/drip/template/irs/CHF.java +++ b/src/main/java/org/drip/template/irs/CHF.java @@ -17,6 +17,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -106,52 +109,47 @@ * @author Lakshmi Krishnamurthy */ -public class CHF { +public class CHF +{ /** * Entry Point * - * @param args Argument Array + * @param argumentArray Argument Array * * @throws Exception Propagate the Exception encountered */ public static final void main ( - final String[] args) + final String[] argumentArray) throws Exception { EnvManager.InitEnv (""); - JulianDate dtSpot = DateUtil.Today(); + JulianDate spotDate = DateUtil.Today(); - String strCurrency = "CHF"; - String strMaturityTenor = "5Y"; + String currency = "CHF"; + String maturityTenor = "5Y"; FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, + spotDate, + currency, "ALL", - strMaturityTenor, + maturityTenor, "MAIN", 0.0206 ); - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); + CurveSurfaceQuoteContainer marketDataContainer = new CurveSurfaceQuoteContainer(); - csqc.setFundingState ( + marketDataContainer.setFundingState ( LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, + spotDate, + currency, + new String[] {"04D", "07D", "14D", "30D", "60D"}, + new double[] {0.0017, 0.0017, 0.0018, 0.0020, 0.0023}, "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, + new double[] {0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160}, "ForwardRate", new String[] { "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" @@ -163,64 +161,69 @@ public static final void main ( ) ); - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), + Map measureMap = irs.value ( + ValuationParams.Spot (spotDate.julian()), null, - csqc, + marketDataContainer, null ); - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); + for (Map.Entry measureMapEntry : measureMap.entrySet()) + System.out.println ("\t | " + measureMapEntry.getKey() + " => " + measureMapEntry.getValue() + " ||"); System.out.println ("\t |------------------------------||"); - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); + System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); + System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - System.out.println ("\t\t| Start Date ||"); + System.out.println ("\t\t| Start Date ||"); - System.out.println ("\t\t| End Date ||"); + System.out.println ("\t\t| End Date ||"); - System.out.println ("\t\t| Pay Date ||"); + System.out.println ("\t\t| Pay Date ||"); - System.out.println ("\t\t| FX Fixing Date ||"); + System.out.println ("\t\t| FX Fixing Date ||"); - System.out.println ("\t\t| Base Notional ||"); + System.out.println ("\t\t| Base Notional ||"); - System.out.println ("\t\t| Period DCF ||"); + System.out.println ("\t\t| Period DCF ||"); - System.out.println ("\t\t| Tenor ||"); + System.out.println ("\t\t| Tenor ||"); - System.out.println ("\t\t| Funding Label ||"); + System.out.println ("\t\t| Funding Label ||"); - System.out.println ("\t\t| Forward Label ||"); + System.out.println ("\t\t| Forward Label ||"); - System.out.println ("\t\t| Pay Discount Factor ||"); + System.out.println ("\t\t| Pay Discount Factor ||"); - System.out.println ("\t\t| Coupon Rate ||"); + System.out.println ("\t\t| Coupon Rate ||"); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.derivedStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.floaterLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + compositePeriod.floaterLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); @@ -250,18 +253,23 @@ public static final void main ( System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.referenceStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); diff --git a/src/main/java/org/drip/template/irs/CNY.java b/src/main/java/org/drip/template/irs/CNY.java index 6fb6418aa57b..36c7ced1c641 100644 --- a/src/main/java/org/drip/template/irs/CNY.java +++ b/src/main/java/org/drip/template/irs/CNY.java @@ -17,6 +17,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -106,52 +109,47 @@ * @author Lakshmi Krishnamurthy */ -public class CNY { +public class CNY +{ /** * Entry Point * - * @param args Argument Array + * @param argumentArray Argument Array * * @throws Exception Propagate the Exception encountered */ public static final void main ( - final String[] args) + final String[] argumentArray) throws Exception { EnvManager.InitEnv (""); - JulianDate dtSpot = DateUtil.Today(); + JulianDate spotDate = DateUtil.Today(); - String strCurrency = "CNY"; - String strMaturityTenor = "5Y"; + String currency = "CNY"; + String maturityTenor = "5Y"; FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, + spotDate, + currency, "ALL", - strMaturityTenor, + maturityTenor, "MAIN", 0.0206 ); - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); + CurveSurfaceQuoteContainer marketDataContainer = new CurveSurfaceQuoteContainer(); - csqc.setFundingState ( + marketDataContainer.setFundingState ( LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, + spotDate, + currency, + new String[] {"04D", "07D", "14D", "30D", "60D"}, + new double[] {0.0017, 0.0017, 0.0018, 0.0020, 0.0023}, "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, + new double[] {0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160}, "ForwardRate", new String[] { "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" @@ -163,15 +161,15 @@ public static final void main ( ) ); - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), + Map measureMap = irs.value ( + ValuationParams.Spot (spotDate.julian()), null, - csqc, + marketDataContainer, null ); - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); + for (Map.Entry measureMapEntry : measureMap.entrySet()) + System.out.println ("\t | " + measureMapEntry.getKey() + " => " + measureMapEntry.getValue() + " ||"); System.out.println ("\t |------------------------------||"); @@ -205,19 +203,24 @@ public static final void main ( System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.derivedStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.floaterLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + compositePeriod.floaterLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); @@ -250,18 +253,23 @@ public static final void main ( System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.referenceStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); diff --git a/src/main/java/org/drip/template/irs/DKK.java b/src/main/java/org/drip/template/irs/DKK.java index 92ef210ee5a7..bd206aaaa866 100644 --- a/src/main/java/org/drip/template/irs/DKK.java +++ b/src/main/java/org/drip/template/irs/DKK.java @@ -17,6 +17,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -106,52 +109,47 @@ * @author Lakshmi Krishnamurthy */ -public class DKK { +public class DKK +{ /** * Entry Point * - * @param args Argument Array + * @param argumentArray Argument Array * * @throws Exception Propagate the Exception encountered */ public static final void main ( - final String[] args) + final String[] argumentArray) throws Exception { EnvManager.InitEnv (""); - JulianDate dtSpot = DateUtil.Today(); + JulianDate spotDate = DateUtil.Today(); - String strCurrency = "DKK"; - String strMaturityTenor = "5Y"; + String currency = "DKK"; + String maturityTenor = "5Y"; FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, + spotDate, + currency, "ALL", - strMaturityTenor, + maturityTenor, "MAIN", 0.0206 ); - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); + CurveSurfaceQuoteContainer marketDataContainer = new CurveSurfaceQuoteContainer(); - csqc.setFundingState ( + marketDataContainer.setFundingState ( LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, + spotDate, + currency, + new String[] {"04D", "07D", "14D", "30D", "60D"}, + new double[] {0.0017, 0.0017, 0.0018, 0.0020, 0.0023}, "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, + new double[] {0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160}, "ForwardRate", new String[] { "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" @@ -163,64 +161,69 @@ public static final void main ( ) ); - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), + Map measureMap = irs.value ( + ValuationParams.Spot (spotDate.julian()), null, - csqc, + marketDataContainer, null ); - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); + for (Map.Entry measureMapEntry : measureMap.entrySet()) + System.out.println ("\t | " + measureMapEntry.getKey() + " => " + measureMapEntry.getValue() + " ||"); System.out.println ("\t |------------------------------||"); - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); + System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); + System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - System.out.println ("\t\t| Start Date ||"); + System.out.println ("\t\t| Start Date ||"); - System.out.println ("\t\t| End Date ||"); + System.out.println ("\t\t| End Date ||"); - System.out.println ("\t\t| Pay Date ||"); + System.out.println ("\t\t| Pay Date ||"); - System.out.println ("\t\t| FX Fixing Date ||"); + System.out.println ("\t\t| FX Fixing Date ||"); - System.out.println ("\t\t| Base Notional ||"); + System.out.println ("\t\t| Base Notional ||"); - System.out.println ("\t\t| Period DCF ||"); + System.out.println ("\t\t| Period DCF ||"); - System.out.println ("\t\t| Tenor ||"); + System.out.println ("\t\t| Tenor ||"); - System.out.println ("\t\t| Funding Label ||"); + System.out.println ("\t\t| Funding Label ||"); - System.out.println ("\t\t| Forward Label ||"); + System.out.println ("\t\t| Forward Label ||"); - System.out.println ("\t\t| Pay Discount Factor ||"); + System.out.println ("\t\t| Pay Discount Factor ||"); - System.out.println ("\t\t| Coupon Rate ||"); + System.out.println ("\t\t| Coupon Rate ||"); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.derivedStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.floaterLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + compositePeriod.floaterLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); @@ -250,18 +253,23 @@ public static final void main ( System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.referenceStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); diff --git a/src/main/java/org/drip/template/irs/EUR.java b/src/main/java/org/drip/template/irs/EUR.java index 06e94d0ae71a..e1d8811f318d 100644 --- a/src/main/java/org/drip/template/irs/EUR.java +++ b/src/main/java/org/drip/template/irs/EUR.java @@ -17,6 +17,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -106,52 +109,47 @@ * @author Lakshmi Krishnamurthy */ -public class EUR { +public class EUR +{ /** * Entry Point * - * @param args Argument Array + * @param argumentArray Argument Array * * @throws Exception Propagate the Exception encountered */ public static final void main ( - final String[] args) + final String[] argumentArray) throws Exception { EnvManager.InitEnv (""); - JulianDate dtSpot = DateUtil.Today(); + JulianDate spotDate = DateUtil.Today(); - String strCurrency = "EUR"; - String strMaturityTenor = "5Y"; + String currency = "EUR"; + String maturityTenor = "5Y"; FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, + spotDate, + currency, "ALL", - strMaturityTenor, + maturityTenor, "MAIN", 0.0206 ); - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); + CurveSurfaceQuoteContainer marketDataContainer = new CurveSurfaceQuoteContainer(); - csqc.setFundingState ( + marketDataContainer.setFundingState ( LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, + spotDate, + currency, + new String[] {"04D", "07D", "14D", "30D", "60D"}, + new double[] {0.0017, 0.0017, 0.0018, 0.0020, 0.0023}, "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, + new double[] {0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160}, "ForwardRate", new String[] { "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" @@ -163,64 +161,69 @@ public static final void main ( ) ); - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), + Map measureMap = irs.value ( + ValuationParams.Spot (spotDate.julian()), null, - csqc, + marketDataContainer, null ); - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); + for (Map.Entry measureMapEntry : measureMap.entrySet()) + System.out.println ("\t | " + measureMapEntry.getKey() + " => " + measureMapEntry.getValue() + " ||"); System.out.println ("\t |------------------------------||"); - System.out.println ("\n\n\t\t|-------------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); + System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); + System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - System.out.println ("\t\t| Start Date ||"); + System.out.println ("\t\t| Start Date ||"); - System.out.println ("\t\t| End Date ||"); + System.out.println ("\t\t| End Date ||"); - System.out.println ("\t\t| Pay Date ||"); + System.out.println ("\t\t| Pay Date ||"); - System.out.println ("\t\t| FX Fixing Date ||"); + System.out.println ("\t\t| FX Fixing Date ||"); - System.out.println ("\t\t| Base Notional ||"); + System.out.println ("\t\t| Base Notional ||"); - System.out.println ("\t\t| Period DCF ||"); + System.out.println ("\t\t| Period DCF ||"); - System.out.println ("\t\t| Tenor ||"); + System.out.println ("\t\t| Tenor ||"); - System.out.println ("\t\t| Funding Label ||"); + System.out.println ("\t\t| Funding Label ||"); - System.out.println ("\t\t| Forward Label ||"); + System.out.println ("\t\t| Forward Label ||"); - System.out.println ("\t\t| Pay Discount Factor ||"); + System.out.println ("\t\t| Pay Discount Factor ||"); - System.out.println ("\t\t| Coupon Rate ||"); + System.out.println ("\t\t| Coupon Rate ||"); - System.out.println ("\t\t|-------------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.derivedStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.floaterLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + compositePeriod.floaterLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); - System.out.println ("\t\t|-------------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); @@ -250,18 +253,23 @@ public static final void main ( System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.referenceStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); diff --git a/src/main/java/org/drip/template/irs/GBP.java b/src/main/java/org/drip/template/irs/GBP.java index a9472da9ea01..0bc0648f9852 100644 --- a/src/main/java/org/drip/template/irs/GBP.java +++ b/src/main/java/org/drip/template/irs/GBP.java @@ -17,6 +17,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -106,52 +109,47 @@ * @author Lakshmi Krishnamurthy */ -public class GBP { +public class GBP +{ /** * Entry Point * - * @param args Argument Array + * @param argumentArray Argument Array * * @throws Exception Propagate the Exception encountered */ public static final void main ( - final String[] args) + final String[] argumentArray) throws Exception { EnvManager.InitEnv (""); - JulianDate dtSpot = DateUtil.Today(); + JulianDate spotDate = DateUtil.Today(); - String strCurrency = "GBP"; - String strMaturityTenor = "5Y"; + String currency = "GBP"; + String maturityTenor = "5Y"; FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, + spotDate, + currency, "ALL", - strMaturityTenor, + maturityTenor, "MAIN", 0.0206 ); - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); + CurveSurfaceQuoteContainer marketDataContainer = new CurveSurfaceQuoteContainer(); - csqc.setFundingState ( + marketDataContainer.setFundingState ( LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, + spotDate, + currency, + new String[] {"04D", "07D", "14D", "30D", "60D"}, + new double[] {0.0017, 0.0017, 0.0018, 0.0020, 0.0023}, "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, + new double[] {0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160}, "ForwardRate", new String[] { "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" @@ -163,64 +161,69 @@ public static final void main ( ) ); - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), + Map measureMap = irs.value ( + ValuationParams.Spot (spotDate.julian()), null, - csqc, + marketDataContainer, null ); - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); + for (Map.Entry measureMapEntry : measureMap.entrySet()) + System.out.println ("\t | " + measureMapEntry.getKey() + " => " + measureMapEntry.getValue() + " ||"); System.out.println ("\t |------------------------------||"); - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); + System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); + System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - System.out.println ("\t\t| Start Date ||"); + System.out.println ("\t\t| Start Date ||"); - System.out.println ("\t\t| End Date ||"); + System.out.println ("\t\t| End Date ||"); - System.out.println ("\t\t| Pay Date ||"); + System.out.println ("\t\t| Pay Date ||"); - System.out.println ("\t\t| FX Fixing Date ||"); + System.out.println ("\t\t| FX Fixing Date ||"); - System.out.println ("\t\t| Base Notional ||"); + System.out.println ("\t\t| Base Notional ||"); - System.out.println ("\t\t| Period DCF ||"); + System.out.println ("\t\t| Period DCF ||"); - System.out.println ("\t\t| Tenor ||"); + System.out.println ("\t\t| Tenor ||"); - System.out.println ("\t\t| Funding Label ||"); + System.out.println ("\t\t| Funding Label ||"); - System.out.println ("\t\t| Forward Label ||"); + System.out.println ("\t\t| Forward Label ||"); - System.out.println ("\t\t| Pay Discount Factor ||"); + System.out.println ("\t\t| Pay Discount Factor ||"); - System.out.println ("\t\t| Coupon Rate ||"); + System.out.println ("\t\t| Coupon Rate ||"); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.derivedStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.floaterLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + compositePeriod.floaterLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); @@ -250,18 +253,23 @@ public static final void main ( System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.referenceStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); diff --git a/src/main/java/org/drip/template/irs/HKD.java b/src/main/java/org/drip/template/irs/HKD.java index f114d84e0275..60e1eef9641d 100644 --- a/src/main/java/org/drip/template/irs/HKD.java +++ b/src/main/java/org/drip/template/irs/HKD.java @@ -17,6 +17,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -106,52 +109,47 @@ * @author Lakshmi Krishnamurthy */ -public class HKD { +public class HKD +{ /** * Entry Point * - * @param args Argument Array + * @param argumentArray Argument Array * * @throws Exception Propagate the Exception encountered */ public static final void main ( - final String[] args) + final String[] argumentArray) throws Exception { EnvManager.InitEnv (""); - JulianDate dtSpot = DateUtil.Today(); + JulianDate spotDate = DateUtil.Today(); - String strCurrency = "HKD"; - String strMaturityTenor = "5Y"; + String currency = "HKD"; + String maturityTenor = "5Y"; FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, + spotDate, + currency, "ALL", - strMaturityTenor, + maturityTenor, "MAIN", 0.0206 ); - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); + CurveSurfaceQuoteContainer marketDataContainer = new CurveSurfaceQuoteContainer(); - csqc.setFundingState ( + marketDataContainer.setFundingState ( LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, + spotDate, + currency, + new String[] {"04D", "07D", "14D", "30D", "60D"}, + new double[] {0.0017, 0.0017, 0.0018, 0.0020, 0.0023}, "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, + new double[] {0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160}, "ForwardRate", new String[] { "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" @@ -163,64 +161,69 @@ public static final void main ( ) ); - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), + Map measureMap = irs.value ( + ValuationParams.Spot (spotDate.julian()), null, - csqc, + marketDataContainer, null ); - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); + for (Map.Entry measureMapEntry : measureMap.entrySet()) + System.out.println ("\t | " + measureMapEntry.getKey() + " => " + measureMapEntry.getValue() + " ||"); System.out.println ("\t |------------------------------||"); - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); + System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); + System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - System.out.println ("\t\t| Start Date ||"); + System.out.println ("\t\t| Start Date ||"); - System.out.println ("\t\t| End Date ||"); + System.out.println ("\t\t| End Date ||"); - System.out.println ("\t\t| Pay Date ||"); + System.out.println ("\t\t| Pay Date ||"); - System.out.println ("\t\t| FX Fixing Date ||"); + System.out.println ("\t\t| FX Fixing Date ||"); - System.out.println ("\t\t| Base Notional ||"); + System.out.println ("\t\t| Base Notional ||"); - System.out.println ("\t\t| Period DCF ||"); + System.out.println ("\t\t| Period DCF ||"); - System.out.println ("\t\t| Tenor ||"); + System.out.println ("\t\t| Tenor ||"); - System.out.println ("\t\t| Funding Label ||"); + System.out.println ("\t\t| Funding Label ||"); - System.out.println ("\t\t| Forward Label ||"); + System.out.println ("\t\t| Forward Label ||"); - System.out.println ("\t\t| Pay Discount Factor ||"); + System.out.println ("\t\t| Pay Discount Factor ||"); - System.out.println ("\t\t| Coupon Rate ||"); + System.out.println ("\t\t| Coupon Rate ||"); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.derivedStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.floaterLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + compositePeriod.floaterLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); @@ -250,18 +253,23 @@ public static final void main ( System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.referenceStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); diff --git a/src/main/java/org/drip/template/irs/INR.java b/src/main/java/org/drip/template/irs/INR.java index 98d1a72c7f74..220fd8e81108 100644 --- a/src/main/java/org/drip/template/irs/INR.java +++ b/src/main/java/org/drip/template/irs/INR.java @@ -17,6 +17,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -106,52 +109,47 @@ * @author Lakshmi Krishnamurthy */ -public class INR { +public class INR +{ /** * Entry Point * - * @param args Argument Array + * @param argumentArray Argument Array * * @throws Exception Propagate the Exception encountered */ public static final void main ( - final String[] args) + final String[] argumentArray) throws Exception { EnvManager.InitEnv (""); - JulianDate dtSpot = DateUtil.Today(); + JulianDate spotDate = DateUtil.Today(); - String strCurrency = "INR"; - String strMaturityTenor = "5Y"; + String currency = "INR"; + String maturityTenor = "5Y"; FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, + spotDate, + currency, "ALL", - strMaturityTenor, + maturityTenor, "MAIN", 0.0206 ); - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); + CurveSurfaceQuoteContainer marketDataContainer = new CurveSurfaceQuoteContainer(); - csqc.setFundingState ( + marketDataContainer.setFundingState ( LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, + spotDate, + currency, + new String[] {"04D", "07D", "14D", "30D", "60D"}, + new double[] {0.0017, 0.0017, 0.0018, 0.0020, 0.0023}, "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, + new double[] {0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160}, "ForwardRate", new String[] { "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" @@ -163,64 +161,69 @@ public static final void main ( ) ); - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), + Map measureMap = irs.value ( + ValuationParams.Spot (spotDate.julian()), null, - csqc, + marketDataContainer, null ); - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); + for (Map.Entry measureMapEntry : measureMap.entrySet()) + System.out.println ("\t | " + measureMapEntry.getKey() + " => " + measureMapEntry.getValue() + " ||"); System.out.println ("\t |------------------------------||"); - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); + System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); + System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - System.out.println ("\t\t| Start Date ||"); + System.out.println ("\t\t| Start Date ||"); - System.out.println ("\t\t| End Date ||"); + System.out.println ("\t\t| End Date ||"); - System.out.println ("\t\t| Pay Date ||"); + System.out.println ("\t\t| Pay Date ||"); - System.out.println ("\t\t| FX Fixing Date ||"); + System.out.println ("\t\t| FX Fixing Date ||"); - System.out.println ("\t\t| Base Notional ||"); + System.out.println ("\t\t| Base Notional ||"); - System.out.println ("\t\t| Period DCF ||"); + System.out.println ("\t\t| Period DCF ||"); - System.out.println ("\t\t| Tenor ||"); + System.out.println ("\t\t| Tenor ||"); - System.out.println ("\t\t| Funding Label ||"); + System.out.println ("\t\t| Funding Label ||"); - System.out.println ("\t\t| Forward Label ||"); + System.out.println ("\t\t| Forward Label ||"); - System.out.println ("\t\t| Pay Discount Factor ||"); + System.out.println ("\t\t| Pay Discount Factor ||"); - System.out.println ("\t\t| Coupon Rate ||"); + System.out.println ("\t\t| Coupon Rate ||"); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.derivedStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.floaterLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + compositePeriod.floaterLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); @@ -250,18 +253,23 @@ public static final void main ( System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.referenceStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); diff --git a/src/main/java/org/drip/template/irs/JPYLIBOR.java b/src/main/java/org/drip/template/irs/JPYLIBOR.java index 04000222eadd..08c0cd4483cc 100644 --- a/src/main/java/org/drip/template/irs/JPYLIBOR.java +++ b/src/main/java/org/drip/template/irs/JPYLIBOR.java @@ -17,6 +17,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -106,52 +109,47 @@ * @author Lakshmi Krishnamurthy */ -public class JPYLIBOR { +public class JPYLIBOR +{ /** * Entry Point * - * @param args Argument Array + * @param argumentArray Argument Array * * @throws Exception Propagate the Exception encountered */ public static final void main ( - final String[] args) + final String[] argumentArray) throws Exception { EnvManager.InitEnv (""); - JulianDate dtSpot = DateUtil.Today(); + JulianDate spotDate = DateUtil.Today(); - String strCurrency = "JPY"; - String strMaturityTenor = "5Y"; + String currency = "JPY"; + String maturityTenor = "5Y"; FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, + spotDate, + currency, "ALL", - strMaturityTenor, + maturityTenor, "MAIN", 0.0206 ); - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); + CurveSurfaceQuoteContainer marketDataContainer = new CurveSurfaceQuoteContainer(); - csqc.setFundingState ( + marketDataContainer.setFundingState ( LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, + spotDate, + currency, + new String[] {"04D", "07D", "14D", "30D", "60D"}, + new double[] {0.0017, 0.0017, 0.0018, 0.0020, 0.0023}, "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, + new double[] {0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160}, "ForwardRate", new String[] { "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" @@ -163,64 +161,69 @@ public static final void main ( ) ); - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), + Map measureMap = irs.value ( + ValuationParams.Spot (spotDate.julian()), null, - csqc, + marketDataContainer, null ); - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); + for (Map.Entry measureMapEntry : measureMap.entrySet()) + System.out.println ("\t | " + measureMapEntry.getKey() + " => " + measureMapEntry.getValue() + " ||"); System.out.println ("\t |------------------------------||"); - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); + System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); + System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - System.out.println ("\t\t| Start Date ||"); + System.out.println ("\t\t| Start Date ||"); - System.out.println ("\t\t| End Date ||"); + System.out.println ("\t\t| End Date ||"); - System.out.println ("\t\t| Pay Date ||"); + System.out.println ("\t\t| Pay Date ||"); - System.out.println ("\t\t| FX Fixing Date ||"); + System.out.println ("\t\t| FX Fixing Date ||"); - System.out.println ("\t\t| Base Notional ||"); + System.out.println ("\t\t| Base Notional ||"); - System.out.println ("\t\t| Period DCF ||"); + System.out.println ("\t\t| Period DCF ||"); - System.out.println ("\t\t| Tenor ||"); + System.out.println ("\t\t| Tenor ||"); - System.out.println ("\t\t| Funding Label ||"); + System.out.println ("\t\t| Funding Label ||"); - System.out.println ("\t\t| Forward Label ||"); + System.out.println ("\t\t| Forward Label ||"); - System.out.println ("\t\t| Pay Discount Factor ||"); + System.out.println ("\t\t| Pay Discount Factor ||"); - System.out.println ("\t\t| Coupon Rate ||"); + System.out.println ("\t\t| Coupon Rate ||"); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.derivedStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.floaterLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + compositePeriod.floaterLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); @@ -250,18 +253,23 @@ public static final void main ( System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.referenceStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); diff --git a/src/main/java/org/drip/template/irs/JPYTIBOR.java b/src/main/java/org/drip/template/irs/JPYTIBOR.java index 5bae822aa64d..027f3e139839 100644 --- a/src/main/java/org/drip/template/irs/JPYTIBOR.java +++ b/src/main/java/org/drip/template/irs/JPYTIBOR.java @@ -17,6 +17,9 @@ */ /*! + * Copyright (C) 2025 Lakshmi Krishnamurthy + * Copyright (C) 2024 Lakshmi Krishnamurthy + * Copyright (C) 2023 Lakshmi Krishnamurthy * Copyright (C) 2022 Lakshmi Krishnamurthy * Copyright (C) 2021 Lakshmi Krishnamurthy * Copyright (C) 2020 Lakshmi Krishnamurthy @@ -106,52 +109,47 @@ * @author Lakshmi Krishnamurthy */ -public class JPYTIBOR { +public class JPYTIBOR +{ /** * Entry Point * - * @param args Argument Array + * @param argumentArray Argument Array * * @throws Exception Propagate the Exception encountered */ public static final void main ( - final String[] args) + final String[] argumentArray) throws Exception { EnvManager.InitEnv (""); - JulianDate dtSpot = DateUtil.Today(); + JulianDate spotDate = DateUtil.Today(); - String strCurrency = "JPY"; - String strMaturityTenor = "5Y"; + String currency = "JPY"; + String maturityTenor = "5Y"; FixFloatComponent irs = OTCInstrumentBuilder.FixFloatStandard ( - dtSpot, - strCurrency, + spotDate, + currency, "ALL", - strMaturityTenor, + maturityTenor, "TIBOR", 0.0206 ); - CurveSurfaceQuoteContainer csqc = new CurveSurfaceQuoteContainer(); + CurveSurfaceQuoteContainer marketDataContainer = new CurveSurfaceQuoteContainer(); - csqc.setFundingState ( + marketDataContainer.setFundingState ( LatentMarketStateBuilder.SmoothFundingCurve ( - dtSpot, - strCurrency, - new String[] { - "04D", "07D", "14D", "30D", "60D" - }, - new double[] { - 0.0017, 0.0017, 0.0018, 0.0020, 0.0023 - }, + spotDate, + currency, + new String[] {"04D", "07D", "14D", "30D", "60D"}, + new double[] {0.0017, 0.0017, 0.0018, 0.0020, 0.0023}, "ForwardRate", - new double[] { - 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160 - }, + new double[] {0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160}, "ForwardRate", new String[] { "04Y", "05Y", "06Y", "07Y", "08Y", "09Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y" @@ -163,64 +161,69 @@ public static final void main ( ) ); - Map mapOutput = irs.value ( - ValuationParams.Spot (dtSpot.julian()), + Map measureMap = irs.value ( + ValuationParams.Spot (spotDate.julian()), null, - csqc, + marketDataContainer, null ); - for (Map.Entry me : mapOutput.entrySet()) - System.out.println ("\t | " + me.getKey() + " => " + me.getValue() + " ||"); + for (Map.Entry measureMapEntry : measureMap.entrySet()) + System.out.println ("\t | " + measureMapEntry.getKey() + " => " + measureMapEntry.getValue() + " ||"); System.out.println ("\t |------------------------------||"); - System.out.println ("\n\n\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\n\n\t\t|----------------------------------------------------------------------------------------------------------------------||"); - System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); + System.out.println ("\t\t| Floating Stream Cash Flow Details ||"); - System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); + System.out.println ("\t\t| -------- ------ ---- ---- ------- ||"); - System.out.println ("\t\t| Start Date ||"); + System.out.println ("\t\t| Start Date ||"); - System.out.println ("\t\t| End Date ||"); + System.out.println ("\t\t| End Date ||"); - System.out.println ("\t\t| Pay Date ||"); + System.out.println ("\t\t| Pay Date ||"); - System.out.println ("\t\t| FX Fixing Date ||"); + System.out.println ("\t\t| FX Fixing Date ||"); - System.out.println ("\t\t| Base Notional ||"); + System.out.println ("\t\t| Base Notional ||"); - System.out.println ("\t\t| Period DCF ||"); + System.out.println ("\t\t| Period DCF ||"); - System.out.println ("\t\t| Tenor ||"); + System.out.println ("\t\t| Tenor ||"); - System.out.println ("\t\t| Funding Label ||"); + System.out.println ("\t\t| Funding Label ||"); - System.out.println ("\t\t| Forward Label ||"); + System.out.println ("\t\t| Forward Label ||"); - System.out.println ("\t\t| Pay Discount Factor ||"); + System.out.println ("\t\t| Pay Discount Factor ||"); - System.out.println ("\t\t| Coupon Rate ||"); + System.out.println ("\t\t| Coupon Rate ||"); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.derivedStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.derivedStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - cp.floaterLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + compositePeriod.floaterLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); - System.out.println ("\t\t|-----------------------------------------------------------------------------------------------------------------------||"); + System.out.println ("\t\t|----------------------------------------------------------------------------------------------------------------------||"); System.out.println ("\n\n\t\t|--------------------------------------------------------------------------------------------------------||"); @@ -250,18 +253,23 @@ public static final void main ( System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||"); - for (CompositePeriod cp : irs.referenceStream().cashFlowPeriod()) + for (CompositePeriod compositePeriod : irs.referenceStream().cashFlowPeriod()) System.out.println ("\t\t| [" + - new JulianDate (cp.startDate()) + " - " + - new JulianDate (cp.endDate()) + "] => " + - new JulianDate (cp.payDate()) + " | " + - new JulianDate (cp.fxFixingDate()) + " | " + - FormatUtil.FormatDouble (cp.baseNotional(), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponDCF(), 1, 4, 1.) + " | " + - cp.tenor() + " | " + - cp.fundingLabel().fullyQualifiedName() + " | " + - FormatUtil.FormatDouble (cp.df (csqc), 1, 4, 1.) + " | " + - FormatUtil.FormatDouble (cp.couponMetrics (dtSpot.julian(), csqc).rate(), 1, 2, 100.) + "% ||" + new JulianDate (compositePeriod.startDate()) + " - " + + new JulianDate (compositePeriod.endDate()) + "] => " + + new JulianDate (compositePeriod.payDate()) + " | " + + new JulianDate (compositePeriod.fxFixingDate()) + " | " + + FormatUtil.FormatDouble (compositePeriod.baseNotional(), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble (compositePeriod.couponDCF(), 1, 4, 1.) + " | " + + compositePeriod.tenor() + " | " + + compositePeriod.fundingLabel().fullyQualifiedName() + " | " + + FormatUtil.FormatDouble (compositePeriod.df (marketDataContainer), 1, 4, 1.) + " | " + + FormatUtil.FormatDouble ( + compositePeriod.couponMetrics (spotDate.julian(), marketDataContainer).rate(), + 1, + 2, + 100. + ) + "% ||" ); System.out.println ("\t\t|--------------------------------------------------------------------------------------------------------||");