Click here to Skip to main content
15,892,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The code when i use TSLA , FB , and other us stocks it will work but for indian stocks it wont like ADANIPORTS etc etc . So, pls anyone tell me how to get data for indian stocks from yahoo or any other ....

What I have tried:

import datetime as dt
import matplotlib.pyplot as plt
from matplotlib import style
import pandas as pd
import pandas_datareader.data as web

style.use('ggplot')

start = dt.datetime(2000,1,1)
end = dt.datetime(2020,5,22)
df = web.DataReader('TSLA' ,  'yahoo' , start , end)
df.to_csv('tsla.csv')
Posted
Updated 22-May-20 5:44am
Comments
Richard MacCutchan 22-May-20 11:34am    
You need to get the web information from the correct feed. If the one you are using is US based then it probably will not include Indian stocks.

1 solution

Looks like you're using Yahoo Finance, where Indian stocks have an ".NS" suffix. For example, try "TATAMOTORS.NS" for Tata Motors.
 
Share this answer
 
Comments
PythonPreran 22-May-20 21:42pm    
WoW man awesome thanks for the help , it worked . I actually didnt find anywhere on net , so i asked . Thanks by the way it worked.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900