lbilli / Jib.jl

A Julia implementation of Interactive Brokers API
MIT License
62 stars 14 forks source link

LoadError: [ Info: reader exiting IOError: stream is closed or unusable #35

Closed ghost closed 2 years ago

ghost commented 2 years ago

Hi all using ZMQ ( if relevant) code has been working excellently ( all hail ibilli ) but I am getting this message this am. I suck at error handling so anyone got any clues as to the cause? Thanks

ERROR: ┌ Warning: connection terminated
└ @ Jib.Reader ~/.julia/packages/Jib/12qUA/src/reader.jl:70
LoadError: [ Info: reader exiting
IOError: stream is closed or unusable
Stacktrace:
  [1] check_open
    @ ./stream.jl:388 [inlined]
  [2] uv_write_async(s::Sockets.TCPSocket, p::Ptr{UInt8}, n::UInt64)
    @ Base ./stream.jl:1069
  [3] uv_write(s::Sockets.TCPSocket, p::Ptr{UInt8}, n::UInt64)
    @ Base ./stream.jl:1032
  [4] unsafe_write(s::Sockets.TCPSocket, p::Ptr{UInt8}, n::UInt64)
    @ Base ./stream.jl:1115
  [5] unsafe_write
    @ ./io.jl:683 [inlined]
  [6] write
    @ ./io.jl:706 [inlined]
  [7] write_one(socket::Sockets.TCPSocket, buf::IOBuffer)
    @ Jib.Client ~/.julia/packages/Jib/12qUA/src/client.jl:28
  [8] sendmsg
    @ ~/.julia/packages/Jib/12qUA/src/requests.jl:27 [inlined]
  [9] reqMktData(ib::Jib.Connection, tickerId::Int64, contract::Jib.Contract, genericTicks::String, snapshot::Bool, regulatorySnaphsot::Bool, mktDataOptions::NamedTuple{(), Tuple{}})
    @ Jib.Requests ~/.julia/packages/Jib/12qUA/src/requests.jl:70
 [10] reqMktData
    @ ~/.julia/packages/Jib/12qUA/src/requests.jl:47 [inlined]
 [11] top-level scope
    @ ~/tontine_2022/2022_live/9_6_22_LIVE_STK_IV_VOL_LAST.jl:171
in expression starting at /home/dave/tontine_2022/2022_live/9_6_22_LIVE_STK_IV_VOL_LAST.jl:160

here's the relevant "code" no giggling :-)

Jib.start_reader(ib, wrap)

context = Context()

stk_socket = Socket(context, PUSH)

ZMQ.connect(stk_socket, "tcp://localhost:5555")

for (idx, s) in enumerate(eachrow(symbol_list))

    contract = Jib.Contract(symbol=s.Sym, secType="STK" , exchange=s.exchange , currency="USD")

    Jib.reqMktData(ib, idx, contract,"106", false) # https://interactivebrokers.github.io/tws-api/tick_types.html

end
ghost commented 2 years ago

I got it. There was an existing IB connection open and I just used the repl to close it. All is well now. Sorry to have bugged you all. Don't know how to delete this.