Skip to content

Commit

Permalink
Update to API v156
Browse files Browse the repository at this point in the history
tickOptionComputation() signature change
  • Loading branch information
lbilli committed Jul 8, 2020
1 parent 7c3cb62 commit 0e378e7
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Jib"
uuid = "f310f2d2-a263-11e8-3998-47bd686f18f7"
authors = ["Luca Billi <[email protected]>"]
version = "0.8.0"
version = "0.9.0"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Currently, only API versions ~`v100`~ `v142+` are supported.
The package design follows the official C++/Java
[IB API](http://interactivebrokers.github.io/tws-api/),
which is based on an asynchronous request-response communication model
over a TCP socket.
over TCP.

### Installation
To install from GitHub:
Expand Down
2 changes: 1 addition & 1 deletion data/wrapper_signatures.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tickPrice= function(tickerId::Int, field::String, price::Float64, size::Int, att

tickSize= function(tickerId::Int, field::String, size::Int)

tickOptionComputation= function(tickerId::Int, tickType::String, impliedVol::Union{Float64,Nothing}, delta::Union{Float64,Nothing}, optPrice::Union{Float64,Nothing}, pvDividend::Union{Float64,Nothing}, gamma::Union{Float64,Nothing}, vega::Union{Float64,Nothing}, theta::Union{Float64,Nothing}, undPrice::Union{Float64,Nothing})
tickOptionComputation= function(tickerId::Int, tickType::String, tickAttrib::Union{Int,Nothing}, impliedVol::Union{Float64,Nothing}, delta::Union{Float64,Nothing}, optPrice::Union{Float64,Nothing}, pvDividend::Union{Float64,Nothing}, gamma::Union{Float64,Nothing}, vega::Union{Float64,Nothing}, theta::Union{Float64,Nothing}, undPrice::Union{Float64,Nothing})

tickGeneric= function(tickerId::Int, tickType::String, value::Float64)

Expand Down
8 changes: 4 additions & 4 deletions src/decoder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ function decode(msg, w, ver)
# The first field is the message ID
id::Int = pop(it)

# The second field (version) is ignored for id < 75 and != 3, 5, 11, 17
if id < 75 && id [3, 5, 11, 17] ||
id == 5 && ver < Client.ORDER_CONTAINER

# The second field (version) is ignored for id < 75 and != 3, 5, 11, 17, 21
if id < 75 && id [3, 5, 11, 17, 21] ||
id == 5 && ver < Client.ORDER_CONTAINER ||
id == 21 && ver < Client.PRICE_BASED_VOLATILITY
pop(it)
end

Expand Down
6 changes: 5 additions & 1 deletion src/process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@ const process = Dict{Int,Function}( # TODO Use a Tuple instead?
tickerId::Int,
ticktype::Int = it

tickAttrib = if ver Client.PRICE_BASED_VOLATILITY
slurp(Int, it)
end

v = collect(Union{Float64,Nothing}, take(it, 8))

# (impliedVol, optPrice, pvDividend, undPrice) == -1 means NA
Expand All @@ -468,7 +472,7 @@ const process = Dict{Int,Function}( # TODO Use a Tuple instead?
v[filter(i -> v[i] == -2, [2, 5, 6, 7])] .= nothing


w.tickOptionComputation(tickerId, tickname(ticktype), v...)
w.tickOptionComputation(tickerId, tickname(ticktype), tickAttrib, v...)
end,

# TICK_GENERIC
Expand Down
1 change: 1 addition & 0 deletions src/versions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
ENCODE_MSG_ASCII7 = 153
SEND_ALL_FAMILY_CODES = 154
NO_DEFAULT_OPEN_CLOSE = 155
PRICE_BASED_VOLATILITY = 156

end
4 changes: 2 additions & 2 deletions src/wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ function simple_wrap()

tickSize= (tickerId::Int, field::String, size::Int) -> println("Size: $tickerId $field $size"),

tickOptionComputation= function(tickerId::Int, tickType::String, impliedVol::Union{Float64,Nothing}, delta::Union{Float64,Nothing}, optPrice::Union{Float64,Nothing}, pvDividend::Union{Float64,Nothing}, gamma::Union{Float64,Nothing}, vega::Union{Float64,Nothing}, theta::Union{Float64,Nothing}, undPrice::Union{Float64,Nothing})
d[:option] = (tickType, impliedVol, delta, optPrice, pvDividend, gamma, vega, theta, undPrice)
tickOptionComputation= function(tickerId::Int, tickType::String, tickAttrib::Union{Int,Nothing}, impliedVol::Union{Float64,Nothing}, delta::Union{Float64,Nothing}, optPrice::Union{Float64,Nothing}, pvDividend::Union{Float64,Nothing}, gamma::Union{Float64,Nothing}, vega::Union{Float64,Nothing}, theta::Union{Float64,Nothing}, undPrice::Union{Float64,Nothing})
d[:option] = (tickType, tickAttrib, impliedVol, delta, optPrice, pvDividend, gamma, vega, theta, undPrice)
println("Option: $tickerId $tickType")
end,

Expand Down

0 comments on commit 0e378e7

Please sign in to comment.