Skip to content

adds Compat package and fixes tuplecopalyse errors and Dict warnings #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ MarketTechnicals
Match
Reactive
Docile
Compat 0.4.0
5 changes: 3 additions & 2 deletions src/TradingLogic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using Reactive, Match, FinancialSeries, MarketTechnicals

module TradingLogic

using Docile
using Docile, Compat

if VERSION < v"0.4-"
using Dates
Expand Down Expand Up @@ -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},
Expand Down
12 changes: 8 additions & 4 deletions src/orderhandl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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]
Expand Down
8 changes: 5 additions & 3 deletions src/performance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down