Created
April 5, 2013 14:23
-
-
Save milktrader/5319653 to your computer and use it in GitHub Desktop.
Experimental TimeSeries look and feel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
julia> spx | |
15914-element TimeSeries Array: | |
1950-01-03 | 16.66 16.66 16.66 16.66 | |
1950-01-04 | 16.85 16.85 16.85 16.85 | |
1950-01-05 | 16.93 16.93 16.93 16.93 | |
1950-01-06 | 16.98 16.98 16.98 16.98 | |
1950-01-09 | 17.08 17.08 17.08 17.08 | |
1950-01-10 | 17.03 17.03 17.03 17.03 | |
1950-01-11 | 17.09 17.09 17.09 17.09 | |
1950-01-12 | 16.76 16.76 16.76 16.76 | |
1950-01-13 | 16.67 16.67 16.67 16.67 | |
1950-01-16 | 16.72 16.72 16.72 16.72 | |
1950-01-17 | 16.86 16.86 16.86 16.86 | |
⋮ | |
2013-03-19 | 1552.10 1557.25 1538.57 1548.34 | |
2013-03-20 | 1548.34 1561.56 1548.34 1558.71 | |
2013-03-21 | 1558.71 1558.71 1543.55 1545.80 | |
2013-03-22 | 1545.90 1557.74 1545.90 1556.89 | |
2013-03-25 | 1556.89 1564.91 1546.22 1551.69 | |
2013-03-26 | 1551.69 1563.95 1551.69 1563.77 | |
2013-03-27 | 1563.75 1564.07 1551.90 1562.85 | |
2013-03-28 | 1562.86 1570.28 1561.08 1569.19 | |
2013-04-01 | 1569.18 1570.57 1558.47 1562.17 | |
2013-04-02 | 1562.17 1573.66 1562.17 1570.25 | |
2013-04-03 | 1570.25 1571.47 1549.80 1553.69 | |
# how quickly can the kurtosis of closing prices be calculated? | |
R> kurtosis(Cl(GSPC)) | |
[1] -0.5264019 | |
R> system.time(kurtosis(Cl(GSPC))) | |
user system elapsed | |
0.084 0.002 0.085 | |
julia> kurtosis(Cl(spx)) | |
-0.526626137822463 | |
julia> timetrial(kurtosis, Cl(spx), 100) / 0.085 # 0.085 is the time it takes R to do this | |
0.04155142270588236 | |
# both Julia and R get a similar result, and Julia is 24x faster | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment