diff --git a/Project.toml b/Project.toml index e1a7ff5..fcf5412 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Jib" uuid = "f310f2d2-a263-11e8-3998-47bd686f18f7" authors = ["Luca Billi "] -version = "0.14.0" +version = "0.14.1" [deps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" diff --git a/src/decoder.jl b/src/decoder.jl index 7bd53be..5ab096b 100644 --- a/src/decoder.jl +++ b/src/decoder.jl @@ -19,7 +19,8 @@ function decode(msg, w, ver) id::Int = pop(it) # The second field (version) is ignored for id < 75 and != 3, 5, 11, 17, 21 - if id < 75 && id ∉ (3, 5, 11, 17, 21) + if id < 75 && id ∉ (3, 5, 10, 11, 17, 18, 21) || + id ∈ (10, 18) && ver < Client.SIZE_RULES pop(it) end diff --git a/src/process.jl b/src/process.jl index eeb0ef5..7265245 100644 --- a/src/process.jl +++ b/src/process.jl @@ -133,7 +133,7 @@ const process = Dict{Int,Function}( # TODO Use a Tuple instead? :discretionaryAmt, :goodAfterTime), it) - pop(it) # Deprecated sharesAllocation + pop(it) # deprecated sharesAllocation slurp!(o, (:faGroup, :faMethod, @@ -157,9 +157,9 @@ const process = Dict{Int,Function}( # TODO Use a Tuple instead? :minQty, :ocaType), it) - pop(it) # Deprecated eTradeOnly - pop(it) # Deprecated firmQuoteOnly - pop(it) # Deprecated nbboPriceCap + pop(it) # deprecated eTradeOnly + pop(it) # deprecated firmQuoteOnly + pop(it) # deprecated nbboPriceCap slurp!(o, (:parentId, :triggerMethod), it) @@ -302,9 +302,11 @@ const process = Dict{Int,Function}( # TODO Use a Tuple instead? cd.marketName, cd.contract.tradingClass, cd.contract.conId, - cd.minTick, - cd.mdSizeMultiplier, - cd.contract.multiplier = it + cd.minTick = it + + ver < Client.SIZE_RULES && pop(it) # deprecated mdSizeMultiplier + + cd.contract.multiplier = pop(it) slurp!(cd, 4:8, it) cd.contract.primaryExchange = pop(it) @@ -320,7 +322,12 @@ const process = Dict{Int,Function}( # TODO Use a Tuple instead? :realExpirationDate, :stockType), it) - ver ≥ Client.FRACTIONAL_SIZE_SUPPORT && (cd.sizeMinTick = pop(it)) + Client.FRACTIONAL_SIZE_SUPPORT ≤ ver < Client.SIZE_RULES && pop(it) # deprecated sizeMinTick + + ver ≥ Client.SIZE_RULES && slurp!(cd, (:minSize, + :sizeIncrement, + :suggestedSizeIncrement, + :minCashQtySize), it) w.contractDetails(reqId, cd) end, @@ -359,8 +366,8 @@ const process = Dict{Int,Function}( # TODO Use a Tuple instead? reqId::Int = pop(it) - pop(it) # Ignore startDate - pop(it) # Ignore endDate + pop(it) # ignore startDate + pop(it) # ignore endDate n::Int = pop(it) @@ -396,11 +403,12 @@ const process = Dict{Int,Function}( # TODO Use a Tuple instead? cd.contract.currency, cd.marketName, cd.contract.tradingClass, - cd.contract.conId = it + cd.contract.conId, + cd.minTick = it + + ver < Client.SIZE_RULES && pop(it) # deprecated mdSizeMultiplier - slurp!(cd, (:minTick, - :mdSizeMultiplier, - :orderTypes, + slurp!(cd, (:orderTypes, :validExchanges, :nextOptionDate, :nextOptionType, @@ -416,6 +424,11 @@ const process = Dict{Int,Function}( # TODO Use a Tuple instead? cd.aggGroup, cd.marketRuleIds = it + ver ≥ Client.SIZE_RULES && slurp!(cd, (:minSize, + :sizeIncrement, + :suggestedSizeIncrement, + :minCashQtySize), it) + w.bondContractDetails(reqId, cd) end, diff --git a/src/types_private.jl b/src/types_private.jl index 5e1e400..6f7787a 100644 --- a/src/types_private.jl +++ b/src/types_private.jl @@ -32,7 +32,6 @@ mutable struct ContractDetails liquidHours::String evRule::String evMultiplier::Union{Float64,Nothing} - mdSizeMultiplier::Int aggGroup::Union{Int,Nothing} underSymbol::String underSecType::String @@ -40,7 +39,10 @@ mutable struct ContractDetails realExpirationDate::String lastTradeTime::String stockType::String - sizeMinTick::Union{Float64,Nothing} + minSize::Union{Float64,Nothing} + sizeIncrement::Union{Float64,Nothing} + suggestedSizeIncrement::Union{Float64,Nothing} + minCashQtySize::Union{Float64,Nothing} secIdList::NamedTuple cusip::String ratings::String @@ -59,9 +61,9 @@ mutable struct ContractDetails notes::String end ContractDetails() = ContractDetails(Contract(), ns, 0, ns, ns, 0, 0, fill(ns, 9)..., - nothing, 0, nothing, fill(ns, 6)..., nothing, (;), - fill(ns, 5)..., false, false, nothing, false, ns, - ns, ns, ns, false, ns) + nothing, nothing, fill(ns, 6)..., nothing, nothing, + nothing, nothing, (;), fill(ns, 5)..., false, false, + nothing, false, ns, ns, ns, ns, false, ns) struct Execution diff --git a/src/versions.jl b/src/versions.jl index 804b38a..a2e5d92 100644 --- a/src/versions.jl +++ b/src/versions.jl @@ -7,5 +7,6 @@ WSHE_CALENDAR = 161 AUTO_CANCEL_PARENT = 162 FRACTIONAL_SIZE_SUPPORT = 163 + SIZE_RULES = 164 end