is there a way to add at the end of the formula of mc_callAsia an else 0??
for j in range (1,10):
for k in range (len(K)) :
mc_callAsia = np.asarray([(i-K[k]) for i in dictimoyennes["moyenneAsia" + str (j)] if (i-K[k])>0])
payoffAsia = (1/(1+r[k])**T)*sum(mc_callAsia)/10000
payoffsAsia = np.append(payoffsAsia, [payoffAsia])
The goal would be to keep all the values so either it's positive or 0. I've tried to do it like this
for j in range (1 ,10):
for k in range (len(K)) :
for i in range (1, 10000):
payoffss= max(dictimoyennes["moyenneAsia" + str (j)][i] - K[k],0)
payoffssAsia = np.append(payoffssAsia, [payoffss])
but it loops forever...
Thank you in advance
Aucun commentaire:
Enregistrer un commentaire