-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Andersen Pykhtin Sokol Lag Aggressive (1) - Andersen Pykhtin Sokol Lag Conservative (2) - Andersen Pykhtin Sokol Lag Shell (3, 4) - Last Client Margin Flow Date (5) - Last Dealer Margin Flow Date (6) - Last Client Trade Flow Date (7) - Last Dealer Trade Flow Date (8) - Spot/ETD Event Observation Date (9, 10) - Margin Period Collateral Valuation Date (11) - Last Flow Dates - Constructor/Annotation (12, 13, 14) - Last Flow Dates - Spot Standard #1 (15, 16) - Last Flow Dates - Spot Standard #2 (17, 18) - Event Sequence Last Cash Flows (19, 20) - Last Cash Flows - Valuation Date (21, 22) - Position Group Numeraire Trade Flow (39) - Holdings Fix Float Basel Duration (40) - Single Stream DV01 Numeraire Shell (41, 42) - Trim Off Trade Flows Array (43) - Single Stream DV01 Effective Date (44) - Single Stream DV01 Maturity Date (45) - Single Stream DV01 Pay Frequency (46) - Stream DV01 XVA Holdings #1 (47, 48) - Stream DV01 XVA Holdings #2 (49, 50) - Stream DV01 XVA Holdings #3 (51, 52) Bug Fixes/Clean-up: Samples: - Andersen Pykhtin Sokol Dates Shell (23, 24) - Andersen Pykhtin Sokol Dates #1 (25, 26) - Andersen Pykhtin Sokol Dates #2 (27, 28) - Andersen Pykhtin Sokol Dates #3 (29, 30) - Andersen Pykhtin Sokol Dates #4 (31, 32) - Andersen Pykhtin Sokol Dates #5 (33, 34) - Andersen Pykhtin Sokol Dates #6 (35) - Andersen Pykhtin Sokol Dates Format (36, 37, 38)
- Loading branch information
1 parent
cf567ad
commit 15142c3
Showing
12 changed files
with
711 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
Features: | ||
|
||
- Andersen Pykhtin Sokol Lag Aggressive (1) | ||
- Andersen Pykhtin Sokol Lag Conservative (2) | ||
- Andersen Pykhtin Sokol Lag Shell (3, 4) | ||
- Last Client Margin Flow Date (5) | ||
- Last Dealer Margin Flow Date (6) | ||
- Last Client Trade Flow Date (7) | ||
- Last Dealer Trade Flow Date (8) | ||
- Spot/ETD Event Observation Date (9, 10) | ||
- Margin Period Collateral Valuation Date (11) | ||
- Last Flow Dates - Constructor/Annotation (12, 13, 14) | ||
- Last Flow Dates - Spot Standard #1 (15, 16) | ||
- Last Flow Dates - Spot Standard #2 (17, 18) | ||
- Event Sequence Last Cash Flows (19, 20) | ||
- Last Cash Flows - Valuation Date (21, 22) | ||
- Position Group Numeraire Trade Flow (39) | ||
- Holdings Fix Float Basel Duration (40) | ||
- Single Stream DV01 Numeraire Shell (41, 42) | ||
- Trim Off Trade Flows Array (43) | ||
- Single Stream DV01 Effective Date (44) | ||
- Single Stream DV01 Maturity Date (45) | ||
- Single Stream DV01 Pay Frequency (46) | ||
- Stream DV01 XVA Holdings #1 (47, 48) | ||
- Stream DV01 XVA Holdings #2 (49, 50) | ||
- Stream DV01 XVA Holdings #3 (51, 52) | ||
|
||
|
||
Bug Fixes/Clean-up: | ||
|
||
Samples: | ||
|
||
- Andersen Pykhtin Sokol Dates Shell (23, 24) | ||
- Andersen Pykhtin Sokol Dates #1 (25, 26) | ||
- Andersen Pykhtin Sokol Dates #2 (27, 28) | ||
- Andersen Pykhtin Sokol Dates #3 (29, 30) | ||
- Andersen Pykhtin Sokol Dates #4 (31, 32) | ||
- Andersen Pykhtin Sokol Dates #5 (33, 34) | ||
- Andersen Pykhtin Sokol Dates #6 (35) | ||
- Andersen Pykhtin Sokol Dates Format (36, 37, 38) |
237 changes: 237 additions & 0 deletions
237
src/main/java/org/drip/sample/csaevents/AndersenPykhtinSokolDates.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,237 @@ | ||
|
||
package org.drip.sample.csaevents; | ||
|
||
import org.drip.analytics.date.DateUtil; | ||
import org.drip.analytics.date.JulianDate; | ||
import org.drip.service.env.EnvManager; | ||
import org.drip.xva.csatimeline.AndersenPykhtinSokolLag; | ||
import org.drip.xva.csatimeline.LastFlowDates; | ||
|
||
/* | ||
* -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- | ||
*/ | ||
|
||
/*! | ||
* Copyright (C) 2018 Lakshmi Krishnamurthy | ||
* | ||
* This file is part of DRIP, a free-software/open-source library for buy/side financial/trading model | ||
* libraries targeting analysts and developers | ||
* https://lakshmidrip.github.io/DRIP/ | ||
* | ||
* DRIP is composed of four main libraries: | ||
* | ||
* - DRIP Fixed Income - https://lakshmidrip.github.io/DRIP-Fixed-Income/ | ||
* - DRIP Asset Allocation - https://lakshmidrip.github.io/DRIP-Asset-Allocation/ | ||
* - DRIP Numerical Optimizer - https://lakshmidrip.github.io/DRIP-Numerical-Optimizer/ | ||
* - DRIP Statistical Learning - https://lakshmidrip.github.io/DRIP-Statistical-Learning/ | ||
* | ||
* - DRIP Fixed Income: Library for Instrument/Trading Conventions, Treasury Futures/Options, | ||
* Funding/Forward/Overnight Curves, Multi-Curve Construction/Valuation, Collateral Valuation and XVA | ||
* Metric Generation, Calibration and Hedge Attributions, Statistical Curve Construction, Bond RV | ||
* Metrics, Stochastic Evolution and Option Pricing, Interest Rate Dynamics and Option Pricing, LMM | ||
* Extensions/Calibrations/Greeks, Algorithmic Differentiation, and Asset Backed Models and Analytics. | ||
* | ||
* - DRIP Asset Allocation: Library for model libraries for MPT framework, Black Litterman Strategy | ||
* Incorporator, Holdings Constraint, and Transaction Costs. | ||
* | ||
* - DRIP Numerical Optimizer: Library for Numerical Optimization and Spline Functionality. | ||
* | ||
* - DRIP Statistical Learning: Library for Statistical Evaluation and Machine Learning. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* AndersenPykhtinSokolDates generates the Intra-Period Dates inside a Margin. Flow Dates are generated for | ||
* the Classical+, Classical-, "Aggressive", and "Conservative" Timeline Schemes. The References are: | ||
* | ||
* - Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Re-thinking Margin Period of Risk, | ||
* https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2902737, eSSRN. | ||
* | ||
* - Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Credit Exposure in the Presence of Initial Margin, | ||
* https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2806156, eSSRN. | ||
* | ||
* - Anfuso, F., D. Aziz, P. Giltinan, and K Loukopoulus (2017): A Sound Modeling and Back-testing Framework | ||
* for Forecasting Initial Margin Requirements, | ||
* https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2716279, eSSRN. | ||
* | ||
* - BCBS (2015): Margin Requirements for Non-centrally Cleared Derivatives, | ||
* https://www.bis.org/bcbs/publ/d317.pdf. | ||
* | ||
* - Pykhtin, M. (2009): Modeling Credit Exposure for Collateralized Counter-parties, Journal of Credit | ||
* Risk, 5 (4) 3-27. | ||
* | ||
* @author Lakshmi Krishnamurthy | ||
*/ | ||
|
||
public class AndersenPykhtinSokolDates | ||
{ | ||
|
||
public static final void main ( | ||
final String[] args) | ||
throws Exception | ||
{ | ||
EnvManager.InitEnv (""); | ||
|
||
JulianDate spot = DateUtil.CreateFromYMD ( | ||
2018, | ||
DateUtil.APRIL, | ||
16 | ||
); | ||
|
||
String calendar = "USD"; | ||
|
||
LastFlowDates csaFlowDatesClassicalPlus = LastFlowDates.SpotStandard ( | ||
spot, | ||
AndersenPykhtinSokolLag.ClassicalPlus(), | ||
calendar | ||
); | ||
|
||
LastFlowDates csaFlowDatesClassicalMinus = LastFlowDates.SpotStandard ( | ||
spot, | ||
AndersenPykhtinSokolLag.ClassicalMinus(), | ||
calendar | ||
); | ||
|
||
LastFlowDates csaFlowDatesAggressive = LastFlowDates.SpotStandard ( | ||
spot, | ||
AndersenPykhtinSokolLag.Aggressive(), | ||
calendar | ||
); | ||
|
||
LastFlowDates csaFlowDatesConservative = LastFlowDates.SpotStandard ( | ||
spot, | ||
AndersenPykhtinSokolLag.Conservative(), | ||
calendar | ||
); | ||
|
||
System.out.println ( | ||
"\t|------------------------------------------------------------------------------------------------||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| INTRA-MARGIN CSA EVENT DATE GENERATION USING ANDERSEN PYKHTIN SOKOL PARAMETRIZATION ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t|------------------------------------------------------------------------------------------------||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| L -> R: ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| - CSA Event Date ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| - CSA Event Type ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| - Classical- Scheme ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| - Classical+ Scheme ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| - Aggressive Scheme ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| - Conservative Scheme ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t|------------------------------------------------------------------------------------------------||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| Margin Valuation Date => SETTLEMENT | " + | ||
csaFlowDatesClassicalPlus.valuation() + " | " + | ||
csaFlowDatesClassicalMinus.valuation() + " | " + | ||
csaFlowDatesAggressive.valuation() + " | " + | ||
csaFlowDatesConservative.valuation() + " ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| Client Margin Flow Date => OBSERVATION | " + | ||
csaFlowDatesClassicalPlus.clientMargin() + " | " + | ||
csaFlowDatesClassicalMinus.clientMargin() + " | " + | ||
csaFlowDatesAggressive.clientMargin() + " | " + | ||
csaFlowDatesConservative.clientMargin() + " ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| Dealer Margin Flow Date => OBSERVATION | " + | ||
csaFlowDatesClassicalPlus.dealerMargin() + " | " + | ||
csaFlowDatesClassicalMinus.dealerMargin() + " | " + | ||
csaFlowDatesAggressive.dealerMargin() + " | " + | ||
csaFlowDatesConservative.dealerMargin() + " ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| Client Trade Flow Date => SETTLEMENT | " + | ||
csaFlowDatesClassicalPlus.clientTrade() + " | " + | ||
csaFlowDatesClassicalMinus.clientTrade() + " | " + | ||
csaFlowDatesAggressive.clientTrade() + " | " + | ||
csaFlowDatesConservative.clientTrade() + " ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| Dealer Trade Flow Date => SETTLEMENT | " + | ||
csaFlowDatesClassicalPlus.dealerTrade() + " | " + | ||
csaFlowDatesClassicalMinus.dealerTrade() + " | " + | ||
csaFlowDatesAggressive.dealerTrade() + " | " + | ||
csaFlowDatesConservative.dealerTrade() + " ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| Early Termination Date => OBSERVATION | " + | ||
csaFlowDatesClassicalPlus.spot() + " | " + | ||
csaFlowDatesClassicalMinus.spot() + " | " + | ||
csaFlowDatesAggressive.spot() + " | " + | ||
csaFlowDatesConservative.spot() + " ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t| Spot Date => OBSERVATION | " + | ||
csaFlowDatesClassicalPlus.spot() + " | " + | ||
csaFlowDatesClassicalMinus.spot() + " | " + | ||
csaFlowDatesAggressive.spot() + " | " + | ||
csaFlowDatesConservative.spot() + " ||" | ||
); | ||
|
||
System.out.println ( | ||
"\t|------------------------------------------------------------------------------------------------||" | ||
); | ||
|
||
EnvManager.TerminateEnv(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.