diff --git a/REQUIRE b/REQUIRE index 44554fa..1f2099d 100644 --- a/REQUIRE +++ b/REQUIRE @@ -5,3 +5,4 @@ MarketTechnicals Match Reactive Docile +Compat 0.4.0 diff --git a/src/TradingLogic.jl b/src/TradingLogic.jl index d50687b..1bedb28 100644 --- a/src/TradingLogic.jl +++ b/src/TradingLogic.jl @@ -8,7 +8,7 @@ using Reactive, Match, FinancialSeries, MarketTechnicals module TradingLogic -using Docile +using Docile, Compat if VERSION < v"0.4-" using Dates @@ -51,7 +51,8 @@ In-place modifies `blotter` (adds transactions to it). Returns `Bool`-signal for the overall status of the trading system (false if problems are detected). """ -function runtrading!{M}(blotter::Dict{DateTime,(Int64,Float64)}, +#function runtrading!{M}(blotter::Dict{DateTime,(Int64,Float64)}, +function runtrading!{M}(blotter::Dict{DateTime,@compat(Tuple{Int64,Float64})}, backtest::Bool, s_ohlc::Input{FinancialTimeSeries{Float64,2,M}}, s_pnow::Signal{Float64}, diff --git a/src/orderhandl.jl b/src/orderhandl.jl index 678e32a..b259c9c 100644 --- a/src/orderhandl.jl +++ b/src/orderhandl.jl @@ -18,7 +18,8 @@ if stop-price of stoplimit order is reached. Overwrites `orde` and returns `Bool` request status. """ function targ2order!(orde::Order, - targ::(Int64, Vector{Float64}), + #targ::(Int64, Vector{Float64}), + targ::@compat(Tuple{Int64, Vector{Float64}}), trig::ASCIIString, position_actual::Int64, backtest::Bool) @@ -75,11 +76,14 @@ In-place modifies: and `backtestblotter` associative collection. Returns `Bool` system status. """ -function orderhandling!(targ::(Int64, Vector{Float64}), - pnow::Float64, tnow::DateTime, +#function orderhandling!(targ::(Int64, Vector{Float64}), +function orderhandling!(targ::@compat(Tuple{Int64, Vector{Float64}}), + pnow::Float64, + tnow::DateTime, position_actual_mut::Vector{Int64}, ordcurr::Order, - blotter::Dict{DateTime,(Int64,Float64)}, + #blotter::Dict{DateTime,(Int64,Float64)}, + blotter::Dict{DateTime,@compat(Tuple{Int64,Float64})}, backtest::Bool ) posact = position_actual_mut[1] diff --git a/src/performance.jl b/src/performance.jl index 5e96816..da144dc 100644 --- a/src/performance.jl +++ b/src/performance.jl @@ -4,9 +4,11 @@ Trade analysis for `blotter` provided as Input `metrics` specifies what to calculate. Returns: tuple ( DateTime (ordered) array , assoc. collection of perf metrics ). """ -function tradeperf(blotter::Dict{DateTime,(Int64,Float64)}, +#function tradeperf(blotter::Dict{DateTime,(Int64,Float64)}, +function tradeperf(blotter::Dict{DateTime,@compat(Tuple{Int64,Float64})}, metrics::Vector{Symbol}) - perfm = (Symbol=>Vector{Float64})[] + #perfm = (Symbol=>Vector{Float64})[] + perfm = @compat Dict{Symbol, Vector{Float64}}() ### TODO (later): accociative collections syntax changes in Julia 0.4 # timestamps in order @@ -40,7 +42,7 @@ faster verision (minimizing memory allocation) to be used in e.g. parameter optimization workflow. Returns: final profit/loss `Float64` scalar. """ -function tradepnlfinal(blotter::Dict{DateTime,(Int64,Float64)}) +function tradepnlfinal(blotter::Dict{DateTime,@compat(Tuple{Int64,Float64})}) # timestamps in order vt = sort!(collect(keys(blotter))) nt = length(vt) diff --git a/src/types.jl b/src/types.jl index e2e9fa5..475991e 100644 --- a/src/types.jl +++ b/src/types.jl @@ -50,7 +50,8 @@ end Initialize empty blotter as an associative collection `DateTime => (Qty::Int64, FillPrice::Float64)` """ -emptyblotter() = (DateTime=>(Int64,Float64))[] +#emptyblotter() = (DateTime=>(Int64,Float64))[] +emptyblotter() = @compat Dict{DateTime, Tuple{Int64,Float64}}() ### TODO (later): accociative collections syntax changes in Julia 0.4