From d42801ecdfb5c6bbd4f4455dfc6f782d4fb4eb29 Mon Sep 17 00:00:00 2001 From: lbilli Date: Mon, 11 Mar 2024 11:01:32 -0400 Subject: [PATCH] Update to API v183 --- Project.toml | 2 +- src/process.jl | 4 ++++ src/requests.jl | 6 +++++- src/types_mutable.jl | 3 ++- src/versions.jl | 1 + 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 34e86bd..2400d41 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Jib" uuid = "f310f2d2-a263-11e8-3998-47bd686f18f7" authors = ["Luca Billi "] -version = "0.20.4" +version = "0.20.5" [deps] DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" diff --git a/src/process.jl b/src/process.jl index ca18f9f..10d3a2a 100644 --- a/src/process.jl +++ b/src/process.jl @@ -272,6 +272,8 @@ const process = Dict( :midOffsetAtWhole, :midOffsetAtHalf), it) + ver ≥ Client.CUSTOMER_ACCOUNT && (o.customerAccount = pop(it)) + w.openOrder(o.orderId, c, o, os) end, @@ -1032,6 +1034,8 @@ const process = Dict( :midOffsetAtWhole, :midOffsetAtHalf), it) + ver ≥ Client.CUSTOMER_ACCOUNT && (o.customerAccount = pop(it)) + w.completedOrder(c, o, os) end, diff --git a/src/requests.jl b/src/requests.jl index e884ccc..8e667d8 100644 --- a/src/requests.jl +++ b/src/requests.jl @@ -249,6 +249,8 @@ function placeOrder(ib::Connection, id::Int, contract::Contract, order::Order) order.midOffsetAtHalf) end + ib.version ≥ Client.CUSTOMER_ACCOUNT && o(order.customerAccount) + sendmsg(ib, o) end @@ -372,7 +374,7 @@ function reqHistoricalData(ib::Connection, tickerId::Int, contract::Contract, en sendmsg(ib, o) end -function exerciseOptions(ib::Connection, tickerId::Int, contract::Contract, exerciseAction::Int, exerciseQuantity::Int, account::String, override::Int, manualOrderTime::String) +function exerciseOptions(ib::Connection, tickerId::Int, contract::Contract, exerciseAction::Int, exerciseQuantity::Int, account::String, override::Int, manualOrderTime::String, customerAccount::String) o = enc() @@ -386,6 +388,8 @@ function exerciseOptions(ib::Connection, tickerId::Int, contract::Contract, exer ib.version ≥ Client.MANUAL_ORDER_TIME_EXERCISE_OPTIONS && o(manualOrderTime) + ib.version ≥ Client.CUSTOMER_ACCOUNT && o(customerAccount) + sendmsg(ib, o) end diff --git a/src/types_mutable.jl b/src/types_mutable.jl index 4a600de..e103d3a 100644 --- a/src/types_mutable.jl +++ b/src/types_mutable.jl @@ -167,6 +167,7 @@ mutable struct Order competeAgainstBestOffset::Union{Float64,Nothing} midOffsetAtWhole::Union{Float64,Nothing} midOffsetAtHalf::Union{Float64,Nothing} + customerAccount::String end Order() = Order(0, 0, 0, ns, 0, ns, nothing, nothing, ns, ns, ns, ns, 0, ns, true, 0, false, false, nothing, 0, false, false, ns, ns, ns, false, nothing, nothing, @@ -178,7 +179,7 @@ Order() = Order(0, 0, 0, ns, 0, ns, nothing, nothing, ns, ns, ns, ns, 0, ns, tru fill(nothing, 4)..., 0, nothing, [], false, false, ns, SoftDollarTier(), nothing, ns, ns, ns, ns, false, false, false, ns, nothing, nothing, false, ns, false, false, fill(nothing, 4)..., ns, ns, - fill(nothing, 5)...) + fill(nothing, 5)..., ns) mutable struct ScannerSubscription diff --git a/src/versions.jl b/src/versions.jl index 33f957a..a766462 100644 --- a/src/versions.jl +++ b/src/versions.jl @@ -7,5 +7,6 @@ MANUAL_ORDER_TIME_EXERCISE_OPTIONS = 180 OPEN_ORDER_AD_STRATEGY = 181 LAST_TRADE_DATE = 182 + CUSTOMER_ACCOUNT = 183 end