#173easyOptions & Derivatives
Put Price from Parity
Time Limit: 2sMemory: 256MB
Problem
Given the price of a European call option, compute the price of the corresponding European put option using put-call parity.
Given:
C— European call priceS— current spot priceK— strike priceT— time to expiry (years)r— continuously compounded risk-free rate
Put-Call Parity
Rearranging:
Input Format
Five space-separated floats: C S K T r
Output Format
The European put price rounded to 4 decimal places.
Examples
Example 1
Input(Five space-separated floats: C S K T r)
10.4506 100.0 100.0 1.0 0.05
Output
5.5735
ATM option: C=10.4506, S=K=100, T=1, r=5% -> P=5.5735.
Example 2
Input(Five space-separated floats: C S K T r)
3.8986 100.0 110.0 0.5 0.03
Output
12.2609
OTM call / ITM put: the put is more expensive.
Constraints
- •0.0 <= C <= 100000.0
- •1.0 <= S <= 10000.0
- •1.0 <= K <= 10000.0
- •0.01 <= T <= 10.0
- •0.0 <= r <= 0.5
- •Output put price to 4 decimal places
Loading interactive editor…