samedi 29 avril 2017

Basic Python Q - calculating averages of columns in an array (valuation European options)

Pretty new to Python but am really enjoying learning how to code option values.

Pretty easy to calculate this in excel but want to learn how to properly do this in Python. If I want to solve the arithmetic mean of values over the course of N time-steps, am I thinking about the calculation correctly? I should theoretically, get one value (the average value) of each column in the array.

S=S0+cumsum(S0*r*dt+sigma*S0*math.sqrt(dt)*random.standard_normal((Days+1,I)),axis=0)
S[0]=S0
S=S.mean()
print(S)




Aucun commentaire:

Enregistrer un commentaire