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> using TradingInstrument | |
julia> GLD = yahoo("GLD"); | |
julia> DurableGoods = fred("DGORDER", "Durable Goods"); | |
julia> head(merge(GLD, DurableGoods)) | |
6x8 DataFrame: | |
Date Open High Low Close Vol Adj Durable Goods | |
[1,] 2010-03-01 109.48 109.9 108.97 109.43 12830900 109.43 181812.0 |
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> @timeseries | |
Running tests: | |
** test/returns.jl | |
** test/lag.jl | |
** test/moving.jl | |
** test/upto.jl | |
** test/indexdate.jl | |
macro in testtimeseries.jl |
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> foo = ["AMZN", "SPY", "TLT", "SLV", "TWO"]; | |
julia> bar = stock_returns(foo); minvarport(bar) | |
1x5 DataFrame: | |
1 2 3 4 5 | |
[1,] 0.365124 0.181558 -0.0579279 0.34096 0.170285 |
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> head(df,2) #past 60 months log returns | |
2x4 DataFrame: | |
spy tlt gld aapl | |
[1,] 0.0 0.0 0.0 0.0 | |
[2,] -0.0262318 -0.00458016 0.050976 -0.0794715 | |
julia> dfc = cov(df) | |
4x4 Float64 Array: | |
0.00302343 -0.00083886 0.00052545 0.00315787 |
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> using Oil | |
julia> s = yip("^GSPC", 1,1,2013, 2,5,2013, "w"); | |
julia> ss = floor_pivots(s); | |
julia> tail(ss[:,[1,8:end]], 1) | |
1x8 DataFrame: | |
Date S3 S2 S1 pivot R1 R2 R3 | |
[1,] 2013-02-04 1483.45 1489.89 1501.53 1507.97 1519.61 1526.05 1532.49 |
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 | |
_ | |
_ _ _(_)_ | A fresh approach to technical computing | |
(_) | (_) (_) | Documentation: http://docs.julialang.org | |
_ _ _| |_ __ _ | Type "help()" to list help topics | |
| | | | | | |/ _` | | | |
| | |_| | | | (_| | | Version 0.0.0+108423170.r890f | |
_/ |\__'_|_|_|\__'_| | Commit 890fa928ca (2013-01-28 20:11:56) | |
|__/ | |
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 = read_stock("data/spx.csv"); | |
julia> head(spx, 3) | |
3x7 DataFrame: | |
Date Open High Low Close Volume Adj Close | |
[1,] 1970-01-02 92.06 93.54 91.79 93.0 8050000 93.0 | |
[2,] 1970-01-05 93.0 94.25 92.53 93.46 11490000 93.46 | |
[3,] 1970-01-06 93.46 93.81 92.13 92.82 11460000 92.82 | |
julia> wat = uoo(spx, 4, "Low"); |
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> require("Calendar") | |
julia> using Calendar | |
julia> require("DataFrames") | |
julia> using DataFrames | |
julia> require("Thyme") | |
julia> using Thyme | |
julia> spx = read_stock("spx.csv"); | |
julia> check = falses(nrow(spx)); | |
julia> for i in 1:nrow(spx) | |
check[i] = dayofweek(spx[i,1]) == 6 |
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> head(fridays) | |
6x9 DataFrame: | |
Date Open High Low Close Volume Adj Close friday RET | |
[1,] 1970-01-02 92.06 93.54 91.79 93.0 8050000 93.0 true 0.0 | |
[2,] 1970-01-09 92.68 93.25 91.82 92.4 9380000 92.4 true -0.00302115 | |
[3,] 1970-01-16 91.68 92.49 90.36 90.92 11940000 90.92 true -0.0082897 | |
[4,] 1970-01-23 90.04 90.45 88.74 89.37 11000000 89.37 true -0.00744114 | |
[5,] 1970-01-30 85.69 86.33 84.42 85.02 12320000 85.02 true -0.00781888 | |
[6,] 1970-02-06 85.9 86.88 85.23 86.33 10150000 86.33 true 0.00500582 |
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
suppressWarnings(rm(list=ls(.strategy), pos=.strategy)) | |
suppressWarnings(rm(list=ls(.blotter), pos=.blotter)) | |
suppressWarnings(rm(list=ls())) |