furas

loop to download again

Aug 2nd, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. def get_data():
  2.  
  3.     stocks = ['A', 'B', 'C', 'D', 'E','F','G','H']
  4.  
  5.     for x in stocks:
  6.  
  7.         while True:
  8.             tws.reqHistoricalData(x)
  9.  
  10.             data = pd.DataFrame(reqHistoricalData)
  11.      
  12.             if not data.empty:
  13.                 break
  14.  
  15.             print("Data is empty")
  16.  
  17.         data.to_csv("Your Path")
Add Comment
Please, Sign In to add comment