December 2018
Beginner to intermediate
500 pages
12h 10m
English
The when method allows for aggregating elements from a TimeArray into specific time periods. For instance, we can use this function to pick the Wednesdays in our dataset in a more concise fashion:
julia> when(MarketData.ohlc[1:70], Dates.dayname, "Wednesday")
14x4 TimeArray{Float64,2,Date,Array{Float64,2}} 2000-01-05 to 2000-04-05
# output truncated
We are not limited to just Dates.dayname; we can use many of the Dates functions we covered in the previous section—day, dayname, week, month, monthname, year, dayofweek, dayofweekofmonth, dayofyear, quarterofyear, and dayofquarter:
julia> when(MarketData.ohlc, Dates.monthname, "August") 46x4 TimeArray{Float64,2,Date,Array{Float64,2}} 2000-08-01 to 2001-08-31 # output truncated ...Read now
Unlock full access