Interactive Broker connection break mid-way, cause data request stuck in a while loop
    6 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
I noticed a new problem with IB connection,   sometimes when i request data (using either   getdata history or timeseries ),  the code stuck in the while loop:
while c.DataRequest
  drawnow
end
          i suspect it happend due to using " ib = ibtws('',7496)" ,   i may have connect + disconnect from TWS too often ??   Or did i request data too often from TWS ?    the only solution to make data request work again, is to quit Matlab, and re-launch Matlab,     or re-launch TWS
          Anybody experienced the same problem before ?      
         once " ib = ibtws('',7496)"  is established,   how long does this connection stay??      how to make sure i keep the connection stay there  in practice ?
         How to reconnect with IB, without stuck in the data request while loop ??         Please help 
Best regards
Terry
2 commentaires
  Guillaume
      
      
 le 23 Jan 2020
				Peer Boerretzen's non-answer moved here:
Hi I am experiencing exact same problem. 
For me it happens when IBTWS automatically restarts every night and matlab get stuck in the while loop you mention when trying to request 'timeseries' data. Have tried with both off-line and on-line version of ibtws and with gateway but same problem.
Would also really apprechiate a solution to this problem
  Annie Leonhart
      
 le 8 Fév 2020
				Download iB Gateway and run it with the log on. Should clearly tell you what’s happening.
Réponses (1)
  Annie Leonhart
      
 le 1 Mar 2020
        At the end of your code close the connection. It only needs to be open when requesting. If you leave it open it'll timeout and you'll try to request more data with the same client ID and it will not run. 
simply add to the end of your code and it'll work smoothly every time. 
close(ib)
0 commentaires
Voir également
Catégories
				En savoir plus sur Matrix Indexing dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

