[julia-users] Re: Time series current state of the art

2015-08-04 Thread Danny Zuko
Le jeudi 23 juillet 2015 15:16:49 UTC+2, Andreas Noack a écrit :
>
> For the example you describe, you can simply use the tools in base, but 
> unfortunately I don't think our reader can handle continental style decimal 
> comma yet. However, that is easy to search/replace with a dot. Something 
> like
>
> cov(diff(log(readdlm("prices.csv", ';'
>
> should then do the job.
>

Let's assume we have a csv file of the following form:

"Dates","ES1 Index","VG1 Index","TY1 Comdty","RX1 Comdty","GC1 Comdty"
"1999-01-04",1391.12,3034.53,66.515625,86.2,441.39
"1999-01-05",1404.86,3072.41,66.3125,86.17,440.63
"1999-01-06",1435.12,3156.59,66.4375,86.32,441.7


readcsv("prices.csv", header=true) does its job.

However, I won't be able to pass it to any function that performs any 
numerical computation as all values in the first column are strings. Hence, 
log(readcsv("prices.csv", header=true)) will return an error.

The read.csv function in R has a handy row.names arguments which - when you 
set it equal to 1 - takes the first column of your csv file as a vector of 
row-names. Hence, if you evaluate log(read.csv("prices.csv", sep = ";", 
row.names=1)) you do not get any error as all values are now numerical + 
each row keeps its own row name.

As of now, the only place where I found this handy feature is the 
readtimearray function in the TimeSeries.jl package. Is there any other way 
in Julia to benefit from this little but handy comfort that I am not yet 
aware of?


[julia-users] Re: Readtimearray function in Julia TimeSeries package

2015-08-04 Thread Danny Zuko
Le lundi 3 août 2015 16:20:19 UTC+2, Ismael VC a écrit :
>
> You should file a bug report here: 
> https://github.com/JuliaStats/TimeSeries.jl/issues
>
I found out it is sufficient to replace the 1st field of the 1st line ("") 
with some non-empty string (e.g. "Dates"). Then it works. For more details, 
see 
http://stackoverflow.com/questions/31786795/readtimearray-function-in-julia-timeseries-package
  


The problem should be at lines 6-8 here: 
https://github.com/JuliaStats/TimeSeries.jl/blob/fbc1b518dfb56bd8daa09a2e8c0432f478c73f79/src/readwrite.jl
 
 


[julia-users] Readtimearray function in Julia TimeSeries package

2015-08-03 Thread Danny Zuko
I would like to read a csv file of the following form with readtimearray:


"","ES1 Index","VG1 Index","TY1 Comdty","RX1 Comdty","GC1 Comdty"
"1999-01-04",1391.12,3034.53,66.515625,86.2,441.39
"1999-01-05",1404.86,3072.41,66.3125,86.17,440.63
"1999-01-06",1435.12,3156.59,66.4375,86.32,441.7
"1999-01-07",1432.32,3106.08,66.25,86.22,447.67
"1999-01-08",1443.81,3093.46,65.859375,86.36,447.06
"1999-01-11",1427.84,3005.07,65.71875,85.74,449.5
"1999-01-12",1402.33,2968.04,65.953125,86.31,442.92
"1999-01-13",1388.88,2871.23,66.21875,86.52,439.4
"1999-01-14",1366.46,2836.72,66.546875,86.73,440.01
 

However, here's what I get when I evaluate readtimearray("myfile.csv")


ERROR: `convert` has no method matching convert(::Type{UTF8String}, ::Float64)
 in push! at array.jl:460
 in readtimearray at /home/juser/.julia/v0.3/TimeSeries/src/readwrite.jl:25
 

What is it that I am not seeing?


[julia-users] Time series current state of the art

2015-07-22 Thread Danny Zuko
I am new to Julia and would like to try it to deal with financial time 
series. I read there has been a good bunch discussions within the Julia 
community about it (for example, some interesting ones on indexing).

As a test, I would like to read some 100MB .csv file containing prices into 
an array (or data-frame?), computing their logarithmic returns and 
eventually compute a covariance matrix. 

Something that in R I might do like:

## Read CSV file and store contents in a dataframe:
## - fields are separated by semicolons,
## - first line contains column names,
## - first column contains row names,
## - decimal separator is a comma.
prices <- read.table ("prices.csv",
  sep = ";", header = TRUE, row.names = 1, dec = ",")

## Convert prices into logarithmic returns by applying the diff function on
## the log of the prices:
returns <- apply (log (prices), 2, diff)

## Compute the covariance matrix for the logarithmic returns:
returns_covariance <- cov (returns, use = "pairwise.complete.obs")

As far as the current state of the art is concerned, which are the latest 
packages that are considered a reference at the moment? Is it TimeSeries.jl?