dimanche 22 novembre 2015

How to generate a pseudo random number based on previous number in Python

Am attempting to run a monte carlo simulation using numpy like so:

from numpy import random

btcpremiummean = -2.61
btcpremiumsd = 1.63
trialsize = 1000000

for x in range(trialsize):
    btcpremium = random.normal(btcpremiummean, btcpremiumsd)
    ...

I derived the mean and standard deviations from backtests and am using them to generate random figures.

However, though the data fits within this normal distribution, the real-life btcpremium is not truly random; rather it's usually equal to or close to the previous btcpremium.

I can't think of how to how to change my code so that btcpremium values fit within the normal distribution currently used while being affected by previous data.

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire