Code to automatically calculate next weekly Expiry date (not current week) and monthly expiry date.
Change Line Number 12 TH(2) to TH(1) to get current week expiry date...
import nextexpiry
import json
f = open("data/expiry.json","r")
expiry = json.load(f)
expirydate = expiry["expirydate"]
long_ce = "NIFTY"+str(expirydate)+str(14000)+"CE"