I'm new to F# and would like to convert my code below to output a deedle data frame or even convert the output array into a data frame.
let GetDataBitstamp() =
async {
let! csv = sprintf "http://api.bitcoincharts.com/v1/trades.csv?symbol=bitstampUSD" |> fetch
return
[|
for row in csv.Split([|'\n'|], StringSplitOptions.RemoveEmptyEntries) do
match row.Split([|','|]) with
| [|d; p; v |]-> yield (d,p)
| _ -> yield! [||]
|] |> Map.ofArray
} |> Async.RunSynchronously
I found a solution that works for me see code below:
module may =
let simples() =
let time,price =Map.toArray(Bitcharts.GetDataBitstamp())|> Array.unzip
time, price
The next step is to put the time, price arrays into the data series:
let df1 : Frame<int, string> = frame[]
let d,a = may.simples()
df1.AddSeries("ts",d)
df1.AddSeries("price",a)