SHARE
TWEET

loop only 10 times 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.         for _ in range(10):
  8.             tws.reqHistoricalData(x)
  9.  
  10.             data = pd.DataFrame(reqHistoricalData)
  11.      
  12.             if not data.empty:
  13.                 data.to_csv("Your Path")
  14.                 break
  15.  
  16.             print("Data is empty")
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