The (very last) deadline: 23:59 on Sunday 22nd March 2020 Computational Finance [35 marks:] Please write a C++ programme that performs the pricing of the following structured note. It is a note...

1 answer below »
i have attached the questions and the code file that will be needed for answering the question


The (very last) deadline: 23:59 on Sunday 22nd March 2020 Computational Finance [35 marks:] Please write a C++ programme that performs the pricing of the following structured note. It is a note dependent on two interest rates, IR1 and IR2 (that could correspond to two different points on eg the GBP curve), and an exchange rate (eg EUR/USD) denoted G. The note pays, at the close of its maturity day T: [GT-K]+ . τ/T where τ.360 is the number of days where, at the close, the difference (in absolute value) between IR1 and IR2 is (strictly) lower than: 25% * min{IR1,IR2}. (We follow the convention ACTUAL/360 for time measurement.) You may assume that all three stochastic processes follow geometric Brownian motions. Without loss of generality you may assume that the two IRs have equal initial values. In addition to providing basic pricing, your programme should facilitate sensitivity analysis. Please write a report (and please make it as concise and to-the-point as possible, and please make it use itemising/enumerating whenever possible) that: [35 marks:] Part One: 0) Starts by a brief introduction focusing in particular on any differences/divergences from the in- class approach; and then 1) Presents a decent illustration of the effect on the price of both: o The correlation between the two IR rates; and o The volatilities of the IR rates And please comment on the intuition behind your findings. 2) Lists, and briefly explains, the (top three) value-adding elements (eg in providing extra sophistication/accuracy) of your code, compared to the in-class programme; 3) Lists, and briefly explains, the main (say, three) approximations to (or simplifications of) reality, that you have resorted to; 4) Lists, and briefly explains, the main (say, three) opportunities for future work that remain. [30 marks:] Part Two: Then please answer the following questions. They touch on the broad area you have worked on above. Please give succinct (rather than lengthy) answers. a) In your coding above, have you identified a shortcut, that provides a great efficiency compared to a brute force method? If so, what is it? b) What are the main disadvantages of using geometric Brownian motion to model interest rates? c) Can you mention a related note (to the one above) that happens to have the opposite correlation profile? (Please give the corresponding payoff.) For the remaining questions, please indicate whether True or False. (Importantly, please include a convincing and targeted explanation of why.) d) If your implementation of the explicit scheme of finite difference methods is currently stable, it then follows if you halve your time step (delta_t), your scheme will definitely remain stable. e) If you double the number of paths (simulations) in your (pseudorandom number) Monte Carlo, you have halved the likely Monte Carlo error (ie you have doubled the accuracy). f) Let Z1 and Z2 be two independent N(0,1) random variables. It then follows that 2Z1–3Z2 and 3Z1+2Z2 are identically distributed. (Remember that notation N(a, b) means normal with mean a and variance b.) NB: - Please submit both the code (source file) and the report (the latter should preferably be in Word format) plus any spreadsheet you used. You should also include the code (source file) from your C++ project as an appendix (preserving the default C++ Editor colours) to your report. - In your report’s answers, please use the same numbering used in the questions above. - Please make sure that any (academic or other) sources are properly referenced. - [To be confirmed:] Please note that the Keats submission facility is likely to permit you to submit only a maximum of three files. - And finally: Please submit well ahead of the deadline. (Problems that arose for late submitters in the past include, among many other incidents, discovering that their login/password had expired. It only took them a few minutes to revive them, but because they left it so close to the deadline, they ended up missing the cut-off time. There are plenty of other incidents reported by later submitters – an unexpected loss of internet connection, etc, etc – so please do not treat the deadline as a target. Rather, it is a cliff edge to stay well clear of.) The (very last) deadline: 23:59 on Sunday 22nd March 2020 Financial Engineering [35 marks:] Please build a spreadsheet, equipped with a VBA programme, that performs and illustrates the calculation of the CVA arising from a portfolio (a netting set) consisting of: (A) a forward contract that is long the underlying, and (B) a forward contract that is short the underlying. The two underlyings are different, but the two forwards have the same maturity. The notional of (A) should be greater than the notional of (B). As many of the calculations as possible should be placed in the VBA module(s). In addition to providing central estimates, your tool should facilitate a prudential-valuation analysis. Please write a report (and please make it as concise and to-the-point as possible, and please make it use itemising/enumerating whenever possible) that: [35 marks:] Part One: 0) Starts by a brief introduction focusing in particular on any differences/divergences from the in- class approach; and then 1) Presents a decent illustration of the exposure profile(s) generated by the tool, and briefly comments on the intuition behind them. 2) Lists, and briefly explains, the (top three) value-adding elements (eg in providing extra sophistication/accuracy) of your tool, compared to the in-class spreadsheet; 3) Lists, and briefly explains, the main (say, three) approximations to (or simplifications of) reality, that you have resorted to; 4) Lists, and briefly explains, the main (say, three) opportunities for future work that remain. [30 marks:] Part Two: Then please answer the following questions. They touch on the broad area you have worked on above. Please give succinct (rather than lengthy) answers. a) Assume that the discount rate is exactly 0 (and the following monetary values are in $million). Picking a time horizon, T, you are told that (as calculated at time zero), for a particular portfolio, the EPE is 3 and the ENE is 9 (both corresponding to T). Is this enough to deduce the expected exposure / valuation (again measured at time 0) of that portfolio, corresponding to time horizon T? If so, what is it? b) (Without loss of generality assume that the expected/maximal exposures mentioned here correspond to a single time point in future, T.) Bank A uses for economic capital (EC) a measure equal to: 1.4 * EPE. Bank B, instead, uses the weighted average: 80% * EPE + 20% * ME. How small does the ME (maximal exposure) need to be, relative to the EPE, for Bank A to end up putting aside (for this specific EC aspect) more EC than Bank B? c) Write a piece of VBA code, a macro called readAndPrint, that reads the contents of cells A1 to (horizontally) J1 of sheet “readFrom”, and then prints to cell A1 of sheet “printTo” the individual cell contents (that have been read) separated by commas, with that whole result enclosed in brackets. For example, if the cell content of A1 to J1 of sheet “readFrom” is: a B 50 6 t 5 6 8 8 0 the macro then prints into A1 of sheet “printTo” the following string: (a,b,50,6,t,5,6,8,8,0) NB: Please make sure you use an iteration loop when iterating through the input cells (rather than doing the iterating manually). For the remaining questions, please indicate whether True or False. (Importantly, please include a convincing and targeted explanation of why.) d) If the presumed recovery on a reference entity goes up (and assuming all other market variables of relevance are unchanged), then the implied default probability goes down. e) Take two counterparties with identical exposure profiles, but they differ in their credit qualities: A has a low credit spread, and B has a high credit spread. It then follows that a stress test that bumps credit spreads up by 100bp will result in a higher CVA increase for A than for B. f) (Assume the discount rate to be zero in this question). For a stock, that is now worth $100, and that makes between now and 1 year time two (discrete) dividend payments: $5 (in 1 month time) and $10 (in 9 months time), it then follows that the (continuous-compounding quoted) dividend yield (up to 1 year) is exactly equal to 15%. NB: - Please submit both the spreadsheet and the report (the latter should preferably be in Word format). You should also include the code from your module(s) as an appendix (preserving the default VBA Editor colours) to your report. - In your report’s answers, please use the same numbering used in the questions above. - Please make sure that any (academic or other) sources are properly referenced. - [To be confirmed:] Please note that the Keats submission facility is likely to permit you to submit only a maximum of three files. - And finally: Please submit well ahead of the deadline. (Problems that arose for late submitters in the past include, among many other incidents, discovering that their login/password had expired. It only took them a few minutes to revive them, but because they left it so close to the deadline, they ended up missing the cut-off time. There are plenty of other incidents reported by later submitters – an unexpected loss of internet connection, etc, etc – so please do not treat the deadline as a target. Rather, it is a cliff edge to stay well clear of.)
Answered Same DayMar 19, 2021

Answer To: The (very last) deadline: 23:59 on Sunday 22nd March 2020 Computational Finance [35 marks:] Please...

Shikha answered on Mar 24 2021
118 Votes
#include
#include
#include
#include//for writing to a file
using namespace std;
double maxim(double a, double b){
    return (a > b) ? a : b;
}
double minim(double a, double b){
    return (a
< b) ? a : b;
}
double Phi(double x);//declaration
double PhiInverse2(double p);//declaration; the inverse of the N(0,1) CDF
double phi(double x);//declaration
double PhiInverse(double p);//declaration; the inverse of the N(0,1) CDF
double cwRngAccrualPricer(double g0 /*spot for the FX*/,
    double k, double r /*the discount rate*/,
    double volG /*FX vol*/, int daysUntilT,
    double ir10 /*spot for IR1*/, double vol1 /*IR1's vol*/,
    double ir20 /*spot for IR2*/, double vol2 /*IR2's vol*/,
    double muG /*drift for the FX (ie G)*/,
    double mu1 /*IR1's drift*/, double mu2 /*IR2's drift*/,
    double corrIRs /*correlation between the two IRs*/);
int main(){
    ofstream fout;
    int i,t;
double money,a;
    //The following test causes the Note (being priced) to collapse into a simple (european) call option on gT:
    srand(0);
    cout << "Test price is " << cwRngAccrualPricer(100, 100,
    0.05, 0.2, 360, 1, 0.0, 1, 0.0, 0.05, 0, 0, 0)<    cout << "Please enter amount of money and maturity day \n";
    cin >> money>>t ;
    cin.ignore();
    double converted_money,G;
    G = money / 129.521;
    cout << "Your amount converted to Euro is: " << converted_money << " Euros.\n";
a=    (G*t-1) + t*360/t;
    
    //That price is a CAP on the price of the Note being priced! (as you cause the ratio tau/T to vary)
    
    srand(0);
    cout << "Test price (for an indep case) is " << cwRngAccrualPricer(100, 100,
        0.05, 0.2, 360, 1, 0.2, 1, 0.2, 0.05, 0, 0, 0) << endl;
    
    
srand(0);//reseeding to the exact same seed above (because this is for sensitivity analysis):
    cout << "Test price (for a correlated case) is " << cwRngAccrualPricer(100, 100,
        0.05, 0.2, 360, 1, 0.2, 1, 0.2, 0.05, 0, 0, 0.5) << endl;
    
    
    fout.open("N:\\cppProjs\\cf1920\\cfSession4Sunday\\cfSession4Sunday\\outputSunday.xls");
    fout << "Analysing the impact of FX vol." << endl;
    fout << "FX vol" << '\t' << "Note price" << endl;
    for (i = 1; i < 10; i++){
        srand(0);
        fout << i*0.1 <<
            '\t' << cwRngAccrualPricer(100, 100,
            0.05, i*0.1, 360, 1, 0.0, 1, 0.0, 0.05, 0, 0, 0) <<...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here