quantopian / zipline

Zipline, a Pythonic Algorithmic Trading Library
https://www.zipline.io
Apache License 2.0
17.73k stars 4.74k forks source link

First value generated by RandomWalkSource is always a NaN #487

Open warren-oneill opened 9 years ago

warren-oneill commented 9 years ago

When I run the following code

source = RandomWalkSource(start_prices = {'TEST' : 50}, start=start, end=end)
algo = TradingAlgorithm(initialize=initialize,
                        handle_data=handle_date)
results = algo.run(source)

and record the values generated for 'TEST' then I always get a NaN for the first trading day.

warren-oneill commented 9 years ago

I think this might be due to the fact that record() has nothing to record on the intial day.

devanp92 commented 9 years ago

When is your start date?

warren-oneill commented 9 years ago

@devanp92 can't remember and don't have the code anymore. Why do you ask?