#!/usr/bin/env python import sys from risk_helper import RiskEngine risk_engine = RiskEngine(sys.argv[1] if len(sys.argv)>1 else False) risk_engine.print_headline("Run RiskEngine to produce CDS NPV") risk_engine.run("Input/ore.xml") risk_engine.get_times("Output/log.txt")
#!/usr/bin/env python import sys from risk_helper import RiskEngine risk_engine = RiskEngine(sys.argv[1] if len(sys.argv) > 1 else False) risk_engine.print_headline( "Run RiskEngine for Sensitivity Analysis (simulating full volatility surfaces)" ) risk_engine.run("Input/ore_fullSurface.xml") risk_engine.get_times("Output/log_fullSurface.txt") risk_engine.print_headline( "Run RiskEngine for Sensitivity Analysis (simulating volatility atm strikes only)" ) risk_engine.run("Input/ore_atmOnly.xml") risk_engine.get_times("Output/log_atmOnly.txt")
#!/usr/bin/env python import sys import os from risk_helper import RiskEngine risk_engine = RiskEngine(sys.argv[1] if len(sys.argv) > 1 else False) # Portfolio 1 run risk_engine.print_headline( "Run RiskEngine to produce NPV cube and exposures for portfolio 1") risk_engine.run("Input/ore_portfolio_1.xml") risk_engine.get_times("Output/portfolio_1/log.txt") risk_engine.print_headline("Plot results for portfolio 1") risk_engine.setup_plot("portfolio_1") risk_engine.plot(os.path.join("portfolio_1", "exposure_trade_swap_01.csv"), 2, 3, 'b', "EPE Swap") risk_engine.plot(os.path.join("portfolio_1", "exposure_trade_collar_01.csv"), 2, 4, 'r', "ENE Collar") risk_engine.plot(os.path.join("portfolio_1", "exposure_nettingset_CPTY_A.csv"), 2, 4, 'g', "ENE Netting") #risk_engine.plot(os.path.join("portfolio_1", "exposure_nettingset_CPTY_A.csv"), 2, 3, 'g', "EPE Netting") risk_engine.decorate_plot(title="Example 6, Portfolio 1") risk_engine.save_plot_to_file(os.path.join("Output", "portfolio_1")) # Portfolio 2 run risk_engine.print_headline( "Run RiskEngine to produce NPV cube and exposures for portfolio 2") risk_engine.run("Input/ore_portfolio_2.xml")
#!/usr/bin/env python import sys from risk_helper import RiskEngine risk_engine = RiskEngine(sys.argv[1] if len(sys.argv) > 1 else False) risk_engine.print_headline("Run RiskEngine to produce NPV") risk_engine.run("Input/ore.xml") risk_engine.get_times("Output/log.txt") risk_engine.print_headline("Plot results: Simulated exposures") risk_engine.setup_plot("CPI Swap") risk_engine.plot("exposure_trade_CPI_Swap_1.csv", 2, 3, 'b', "EPE CPI Swap") risk_engine.decorate_plot(title="Example 17", ylabel="Exposure") risk_engine.save_plot_to_file() risk_engine.setup_plot("YoY Swap") risk_engine.plot("exposure_trade_YearOnYear_Swap.csv", 2, 3, 'b', "EPE YoY Swap") risk_engine.decorate_plot(title="Example 17", ylabel="Exposure") risk_engine.save_plot_to_file() risk_engine.run("Input/ore_capfloor.xml") risk_engine.get_times("Output/log_capfloor.txt")