代写 python Homework for EN 553.753 Commodity Markets and Trade Finance Part I: Energy

Homework for EN 553.753 Commodity Markets and Trade Finance Part I: Energy
First Half of Spring 2019 Term
⃝c 2019 Gary L. Schultz, PhD March 2, 2019
Homework #3: Simulating Gas Curves with Application to Risk Metrics
45 points. Due Friday, March 15.
This homework builds upon the prior homework problem that had you construct a model of the forward gas price curve using principal components.
Your assignment now is to use that model to simulate prices for Henry Hub natural gas futures, to analyze the effect of changing measure to explain gas options market prices, and to use the results to compute risk metrics for a simple portfolio of gas contracts. Please produce a quality report giving insight into the business problems given below. Do not simply run a Jupyter notebook containing the calculations. Instead you should explain the analysis to your readers in a way that makes them understand the situation and your conclusions.
1 Data
Get all of the files from the PC Homework on the course blackboard site. You should have
• ng.csv containing natural gas prices (Henry Hub),
• ln.csv containing natural gas European option prices (Henry Hub), and
• 300 sim.ipynb containing python code to munge data and do computations for simu- lating prices and changing measure.
To keep this exercise relatively simple, use a zero discount rate, i.e., you need not worry about any e−r(T−t0) multipliers.
1

2 Simulate
For the valuation date, use the most recent trading date for which you have data. Note that you have plotted this forward curve in the prior homework. Use the 30 maturity month model (seasonality factors and volatility functions) that you built in the prior homework to simulate 1,000 Monte-Carlo iterations of terminal Henry Hub futures prices for 30 maturities (months).
Plot the simulated mean along with the given forward curve with the forward months on the horizontal axis and price on the vertical axis. How large do these sample errors get in your simulation?
3 Options
Now assemble the option prices at three different strike levels each maturity month. For each forward month T, several strike prices K are given in the dataset. Both puts and calls are provided. Now choose a subset of those options. . .
Define at-the-money options for month T to be call options for the strike K that is closest to the forward price F(t0,T). If there is a tie, choose one arbitrarily, so there is only one at-the-money call per maturity month T . (For at-the-money options, straddles are generally used, but you should use only at-the-money calls to simplify the computation.) How many at-the-money calls do you have in the data?
Define out-of-the-money calls to be call options with strike K where K ≥ 1.4. F (t0,T )
Among the out-of-the-money calls, use only the one for which K is closest to the forward
price F (t0, T ) in each month. How many out-of-the-money calls do you have in the data?
Similarly, define out-of-the-money puts to be the put options with strike K where
F(t0,T) ≥ 1.4. Among the out-of-the-money puts, use only the one for which K is closest to K
the forward price F (t0, T ) in each month. How many out-of-the-money puts do you have in the data?
4 Change of Measure
Now compute a posterior weighting as described and demonstrated in the lecture. Your solution should illustrate how the forward prices and option prices are better approximated using the posterior weights, as compared to the uniform prior weights. You may illustrate this with a plot.
Make sure you trade-off the conflicting objectives of pricing these market contracts correctly with keeping sufficient entropy in the resulting re-weighted simulation. Which regularizing coefficients (called ζ in the lectures and slides) did you use? You began with 1,000 Monte-Carlo scenarios (the equally weighted prior). How many “effective scenarios”
Homework ⃝c 2019 Gary L. Schultz Page 2

do you have after re-weighting? (Recall that effective scenarios is defined for a posterior weighting q as eH(q) where H(q) = − 􏰀i qi ln qi is the entropy.)
5 Risk Metrics
This section defines a very simple portfolio and has you compute a few of the “cash flow at risk” (CFaR) metrics described in class. You will use the prior and posterior price distributions you constructed above to do the analysis.
First of all, define a portfolio Π to have 100 NG futures contracts per month in each month of the year 2020. The NG contract has a notional value of 10,000 MMBtu per month, so the notional volumes in each month is 1 million MMBtu in each month of 2020. (NG are not “flow contracts” that you were instructed to use in the first homework.)
You may choose whether you are going to analyze the long portfolio (you are long 100 contracts per month) or the short portfolio (where you are short 100 contracts per month). Since risk metrics look only at down-side risk, this is equivalent to choosing which tail of the distribution you need to analyze.
To keep the numbers short enough to understand, it may be reasonable to report on cash flow results in millions of dollars. In any event, be clear which units you are using.
For the prior (uniform) weighting, show a histogram plot of the simulated cash flows for your portfolio. Analyze the CFaR at the 5th percentile (95% exceedence probability). Give the mark-to-market valuation (expected cash flow), the cutoff value, CFaR (= expected minus cutoff), and conditional CFaR (= expected minus average worse than cutoff) as described in class.
Now do the same for the posterior weighting. Do the implied market conditions indicate more or less risk to this portfolio than using the simple uniform weighting? Recall that the uniform weights are for a model calibrated with the equivalent of historical volatility.
Homework ⃝c 2019 Gary L. Schultz Page 3