SHARE
TWEET

loop to download again

furas Aug 2nd, 2018 26 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top