Put-Call Parity in Python Programming Language

Put Call Ratio in Python

Put Call Parity in Python

We talked about Covered Call Strategy and Long Call Butterfly Strategy in our previous articles on the blog. Now, we shall talk about the Put-call Parity.

Put-call parity principle defines the relationship between the price of a European Put option and European Call option, both having the same underlying asset, strike price and expiration date.

If there is a deviation from put-call parity, then it would result in an arbitrage opportunity. Traders would take advantage of this opportunity to make riskless profits till the time the put-call parity is established again.

The put-call parity principle can be used to validate an option pricing model. If the option prices as computed by the model violate the put-call parity rule, such a model can be considered to be incorrect.

Understanding Put Call Parity

To understand put-call parity, consider a portfolio “A” comprising of a call option and cash. The amount of cash held equals the call strike price. Consider another portfolio “B” comprising of a put option and the underlying asset. S0 is the initial price of the underlying asset and ST is its price at expiration. Let “r” be the risk-free rate and “T” be the time for expiration. In time “T” the cash will be worth K (strike price) given the risk-free rate of “r”.

Portfolio A = Call option + Cash

Portfolio B = Put option + Underlying Asset

Put call parity diagram

If the share price is higher than K the call option will be exercised. Else, cash will be retained. Hence, at “T” portfolio A’s worth will be given by max(ST, K).

If the share price is lower than K, the put option will be exercised. Else, the underlying asset will be retained. Hence, at “T”, portfolio B’s worth will be given by max(ST, K).

If the two portfolios are equal at time “T”, then they should be equal at any time. This gives us the put-call parity equation –

C + Ke-rT = P + S0

When put-call parity principle gets violated, traders will try to take advantage of the arbitrage opportunity. An arbitrage trader will go long on the undervalued portfolio and short the overvalued portfolio to make a risk-free profit.

Python codes used for plotting the charts:
Pu call parity codes

 

Next Step

This was a brief explanation of put-call parity wherein we provided the Python code for plotting the constituents of the put-call parity equation. In our future posts we will cover and attempt to illustrate other derivatives concepts using Python. Our Executive Programme in Algorithmic Trading (EPAT) includes dedicated lectures on Python and Derivatives. To know more about EPAT, check the EPAT course page or feel free to contact our team at contact@quantinsti.com for queries on EPAT.

Download Python Code:

  • Put_Call_Parity.rar
    • putcallparity.py

Login to DOWNLOAD these files for FREE!

Existing Users Log In