MarketData.jl icon indicating copy to clipboard operation
MarketData.jl copied to clipboard

Create constructor for random time series

Open milktrader opened this issue 9 years ago • 1 comments

User supplies the date range and the method uses a RNG to create a random walk time series.

milktrader avatar Aug 29 '16 02:08 milktrader

Some code I'm using in TimeSeriesResampler.jl

idx = DateTime(2010,1,1):Dates.Minute(1):DateTime(2010,4,1)
# or idx = range(DateTime(2010,1,1), length=500, step=Dates.Minute(1))
idx = idx[1:end-1]
N = length(idx)
price = rand(-1.0:0.01:1.0, N)
price_init = rand(1.0:1000.0)
price = price_init .+ cumsum(price)
ta_price = TimeArray(collect(idx), price, ["Price"])

vol = rand(0:0.01:1.0, N)
ta_vol = TimeArray(collect(idx), vol, ["Volume"])

femtotrader avatar Nov 09 '16 19:11 femtotrader