Pricing Of A Futures Contract Using Python

Overview:

• A futures contract is a financial derivative instrument. It helps in hedging against risks involved in another investment.
• People who did trading in early days, to cover their risk against price fluctuations designed futures contracts. Futures are one of the most important financial derivatives today.
• Example 1: A company that imports carbon steel plans to import 1 million tonnes of carbon steel at a price of \$765 per ton. If the local currency depreciates against USD the company will be at a loss. To prevent this loss the company enters into a Foreign Exchange Futures Contract, which fixes dollar price to a specific price in local currency. This way, a company whose currency is not USD and imports metals from international market guards itself against the Forex losses.
• Example 2: An investor buys 100 MSFT equity stocks at a price of \$100 per stock. To prevent against the downward price movement of the stock the investor also buys a futures contract to sell MSFT at \$120 per stock one month down the line. In case, if the stock price goes down, the future contract acts as a hedge and save the investor from the losses.
• Remember, the stock price, which is called spot price, and the price of the futures contract will converge on the day of expiry of the futures contract.

Finding the value of a Futures Contract:

The formula to find the value of a futures contract is given by,

Spot Price: Spot Price of the Security

Benefits:     Benefits like dividends earned

Cost:           Financing Costs

r:                 Rate of interest

t:                 Time to expiry of the futures contract

Python example to find the value of an equity futures contract:

 import math   # A python function that calculates the value of a futures contract def FuturePrice(spotPrice, benefit, cost, r, t):     return (spotPrice - benefit + cost)*math.pow(1 + r, t);     spotPrice       = 100;          benefit         = 0;            # No dividend expected miscCharges     = 1; t               = 30;       r               = 0.07; ratePerday      = r/365;   contractPrice   = FuturePrice(spotPrice, benefit, miscCharges, r, t);   print("Spot price of the equity futures contract:%3.2f"%spotPrice); print("Expected benefits like dividend:%3.2f"%benefit); print("Expected costs to be incurred:%3.2f"%miscCharges); print("Time to expiry of the futures contract in days:%d"%t); print("Interest Rate in percent:%2.2f"%(r*100));   print("Price of the futures contract:%3.2f"%contractPrice)

Output:

 Spot price of the equity futures contract:100.00 Expected benefits like dividend:0.00 Expected costs to be incurred:1.00 Time to expiry of the futures contract in days:30 Interest Rate in percent:7.00 Price of the futures contract:768.84