python - Disconnecting from Interactive Brokers with ibpy -


here pretty standard piece of code use request data interactive brokers api through python:

from ib.ext.contract import contract ib.opt import ibconnection, message import time  def watcher(msg):     print msg  con = ibconnection() con.registerall(watcher) con.connect()  contract = contract() contract.m_symbol = "eur" contract.m_exchange = "idealpro" contract.m_currency = "usd" contract.m_sectype = "cash"  con.reqmktdata(1, contract, '', false)  time.sleep(5)  con.disconnect() print "disconnected"  time.sleep(60) 

i expect connection closed after con.disconnect(), keeps getting new data (messages print updated bid, ask etc).

why doesn't disconnect() seem , how can close connection?

use cancelmktdata(). after calling method, market data specified id stop flowing.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -