Quantitative Finance with Python

 Hedging

    Hedging has its advantages compared to just buying or selling a put. It gives you better odds whenever something unexpected happens in the market. Greatly limits your losses on potential trades when trading Stock, Futures or Options. Hedging is mainly a risk-management strategy to reduce risk of your cash investments.

An example would be to Long a Put of Tesla, perhaps later the company had some sort of catastrophe and you expect the stock value to fall. So, you would need to Short a Put to combat your potential losses from your initial Long you placed.

You protect your cash investments when using this combination and could still come out profitable depending on your premiums. In the example below, the initial Long was less profitable than the short to receive a final profit of around $300.


Plot of the example:


Implementation of different Differential Equations to determine Option pricing

Here I have implemented a Mass Matrix of [M+1, M+1] to determine the price of a European call option with the following parameters. The result of this will return a vector with the given probabilities/outputs of the call option.

Description of parameters:

So: Current Stock Price
K: Option Strike Price
r: Risk-free interest rate
T: Time
M: Matrix time frame parameters
sigma: Volatility of the relative price change of the underlying stock




Algorithm:







I obtained a chart with the current price starting at 8.08940 then as M increases the price rose about 3-4 cents until the price seemed stagnant and ending at 8.12685046115.

Now, Implementing the same parameters I have also calculated this using American put options.




Stochastic ODE with EM and Milstein method.





Here we can identify the errors when using these two methods and determine best case uses for when implementing them in option pricing and modeling. I was able to back track and derive the Stochastic ODE when implementing the algorithm. As it required me to understand the general and exact solution to implement. Also, I could see how the code works by running different paths and times M & N as well as changing seeds to see the different patterns the points will take and graphs made. Observing the error as time changes throughout the code. Lastly, see the relations, errors and perhaps strengths in a solution from observing the exact, numerical and expected results.

I was also able to see some comparisons with the EM and Milstein method. Such as I believe the simpler of the two would be the EM method, as far as solving for SDE goes.






When using the Milstein method I think this was and is mostly used for specific Stochastic ODE’s. as the type where we implement variables such as a, and b or how coded them was by implementing gamma and mu.



















Comments