Cannot convert String to series data for plotting

quantiota
Wed, 07 Apr 2021 15:12:38 +0000
New to Julia

hey
trying to work with JuliaDB by example from

GitHub

GitHub - JuliaComputing/TrueFX: JuliaDB demonstration using TrueFX data

JuliaDB demonstration using TrueFX data. Contribute to JuliaComputing/TrueFX development by creating an account on GitHub.

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

1 post - 1 participant