The lookback options depend on the paths (history) travelled by the underlying security. Thus, they are called path-dependent exotic options as well. One of them is named floating strikes. The payoff function of a call when the exercise price is the minimum price achieved during the life of the option is given as follows:
The Python code for this lookback option is shown as follows:
def lookback_min_price_as_strike(s,T,r,sigma,n_simulation): n_steps=100. dt=T/n_steps total=0 for j in range(n_simulation): min_price=100000. # a very big number sT=s for i in range(int(n_steps)): e=sp.random.normal() sT*=sp.exp((r-0.5*sigma*sigma)*dt+sigma*e*sp.sqrt(dt)) if sT<min_price: min_price=sT #print 'j=',j,'i=',i,'total=',total total+=p4f.bs_call(s,min_price,T,r,sigma) return total/n_simulation