mmyjh86

[YouTube] 벡테스팅 - 원숭이매매법 : 데이터 수집

Sep 25th, 2020
1,992
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import os
  2. import time
  3. from pykrx import stock
  4.  
  5. # 폴더생성
  6. path = "kospi-market"
  7. os.mkdir(path)
  8.  
  9. # 데이터 스크래핑
  10. ticker_list = stock.get_market_ticker_list()
  11. for ticker in ticker_list:
  12.     df = stock.get_market_ohlcv_by_date("20200101", "20200831", ticker)
  13.     df.to_excel(f"{path}/{ticker}.xlsx")
  14.     time.sleep(1)
RAW Paste Data