hey
trying to work with JuliaDB by example from
just added a first column for the curency market.
month = 1
window = Dates.Hour(1)
# 1) subset data (lazy)
date_range = DateTime(2019, 1):Dates.Millisecond(1):DateTime(2019,12)+Dates.Month(1)-Dates.Millisecond(1)
@time subdata = data[["dukascopy"], ["AUDUSD", "EURUSD", "GBPUSD"], date_range]
# 2) group data
@time compute(groupreduce((bid=:bid=>min, ask=:ask=>max),
subdata,
(:market, :pair, :timestamp => dt -> floor(dt, window))))
using Plots
gr()
function plot_rates(month, window, currency_markets= ["dukascopy"], currency_pairs= ["AUDUSD", "EURUSD", "GBPUSD"])
date_range = DateTime(2019, month):Dates.Millisecond(1):DateTime(2019,month)+Dates.Month(1)-Dates.Millisecond(1)
p = Plots.Plot()
for market in currency_markets
for pair in currency_pairs
subdata = data[market, pair, date_range]
result = collect(groupreduce((bid=:bid=>min, ask=:ask=>max),
subdata, :timestamp => dt -> floor(dt, window)))
plot!(p, keys(result, :timestamp),
values(result, :bid), fillrange=values(result, :ask),
label=pair, market, legend=:bottomleft)
end
end
p
end
plot_rates(1,Dates.Minute(5)) # January, 5-minute intervals ,
Output cell : Cannot convert String to series data for plotting