Skip to content

Instantly share code, notes, and snippets.

@SajidLhessani
Created September 23, 2021 16:48
Show Gist options
  • Save SajidLhessani/1d4385ec41c1a1fbf02a8047ca79d277 to your computer and use it in GitHub Desktop.
Save SajidLhessani/1d4385ec41c1a1fbf02a8047ca79d277 to your computer and use it in GitHub Desktop.
#Import packages
import pandas as pd
import numpy as np
import yfinance as yf
#Scrap the data
#data = pd.read_html('https://indiancompanies.in/listed-companies-in-nse-with-symbol/')[0]
data = pd.read_html('https://en.wikipedia.org/wiki/List_of_S%26P_500_companies')[0]["Symbol"]
data
#Convert to list
sp = data.to_list()
#Import data
df = yf.download(sp,period = "3d",interval="15m")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment