Closed iwalucas closed 5 years ago
Hi,
yes. By replacing highlighted in bold syntax in screener.py file we can extract yahoo data instead of quandl. After changing the code iam extracting NSE data from yahoo site without any issue. Also we need to install below packages for yahoo data.
################### code modfication require #################### class Stocker():
# Initialization requires a ticker symbol
def init(self, ticker, exchange='NS'): <-----replace with your tricker*
# Enforce capitalization
ticker = ticker.upper()
# Symbol is used for labeling plots
self.symbol = ticker
# Use Personal Api Key
# quandl.ApiConfig.api_key = 'YourKeyHere'
# Retrieval the financial data
try:
* stock = web.DataReader(ticker, 'yahoo', start, end) <---- by
using this we can extract yahoo data instead of quandl*
############################################install below packages for yahoo data extraction ##############################################
(base) C:\Users\bathula>pip install pandas-datareader Collecting pandas-datareader Downloading https://files.pythonhosted.org/packages/cc/5c/ea5b6dcfd0f55c5fb1e37fb45335ec01cceca199b8a79339137f5ed269e0/pandas_datareader-0.7.0-py2.py3-none-any.whl (111kB) 100% || 112kB 443kB/s Requirement already satisfied: wrapt in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from pandas-datareader) (1.10.11) Requirement already satisfied: requests>=2.3.0 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from pandas-datareader) (2.19.1) Requirement already satisfied: lxml in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from pandas-datareader) (4.2.5) Requirement already satisfied: pandas>=0.19.2 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from pandas-datareader) (0.23.4) Requirement already satisfied: idna<2.8,>=2.5 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from requests>=2.3.0->pandas-datareader) (2.7) Requirement already satisfied: urllib3<1.24,>=1.21.1 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from requests>=2.3.0->pandas-datareader) (1.23) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from requests>=2.3.0->pandas-datareader) (3.0.4) Requirement already satisfied: certifi>=2017.4.17 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from requests>=2.3.0->pandas-datareader) (2018.10.15) Requirement already satisfied: python-dateutil>=2.5.0 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from pandas>=0.19.2->pandas-datareader) (2.7.5) Requirement already satisfied: pytz>=2011k in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from pandas>=0.19.2->pandas-datareader) (2018.7) Requirement already satisfied: numpy>=1.9.0 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from pandas>=0.19.2->pandas-datareader) (1.15.3) Requirement already satisfied: six>=1.5 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from python-dateutil>=2.5.0->pandas>=0.19.2->pandas-datareader) (1.11.0) Installing collected packages: pandas-datareader Successfully installed pandas-datareader-0.7.0
(base) C:\Users\bathula>
(base) C:\Users\bathula>pip install BeautifulSoup4 Requirement already satisfied: BeautifulSoup4 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (4.6.3)
(base) C:\Users\bathula>pip install scikit-learn Requirement already satisfied: scikit-learn in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (0.20.0) Requirement already satisfied: numpy>=1.8.2 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from scikit-learn) (1.15.3) Requirement already satisfied: scipy>=0.13.3 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from scikit-learn) (1.1.0)
(base) C:\Users\bathula>pip install sklearn Collecting sklearn Downloading https://files.pythonhosted.org/packages/1e/7a/dbb3be0ce9bd5c8b7e3d87328e79063f8b263b2b1bfa4774cb1147bfcd3f/sklearn-0.0.tar.gz Requirement already satisfied: scikit-learn in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from sklearn) (0.20.0) Requirement already satisfied: numpy>=1.8.2 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from scikit-learn->sklearn) (1.15.3) Requirement already satisfied: scipy>=0.13.3 in c:\users\bathula\appdata\local\continuum\anaconda3\lib\site-packages (from scikit-learn->sklearn) (1.1.0) Building wheels for collected packages: sklearn Running setup.py bdist_wheel for sklearn ... done Stored in directory: C:\Users\bathula\AppData\Local\pip\Cache\wheels\76\03\bb\589d421d27431bcd2c6da284d5f2286c8e3b2ea3cf1594c074 Successfully built sklearn Installing collected packages: sklearn Successfully installed sklearn-0.0
(base) C:\Users\bathula>
##########################################################################
Regards, Bathlua
On Thu, Jul 11, 2019 at 1:13 AM iwalucas notifications@github.com wrote:
Would it be possible to have yahoo as a source for the stocker? QUANDL doesnt offer (for free) all world stocks.
Tks
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/WillKoehrsen/Data-Analysis/issues/46?email_source=notifications&email_token=AKUZA2HTGQUHWAGUD2LRTWDP6YKEDA5CNFSM4H7RPFN2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4G6NCLNQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AKUZA2E4THEYDOKEIIWAKO3P6YKEDANCNFSM4H7RPFNQ .
--
Thanks & Regards, Srinivasarao Bathula Mobile: +91 8500085997
Here is the full code:
import pandas_datareader.data as web
import datetime
# Class for analyzing and (attempting) to predict future prices
# Contains a number of visualizations and analysis methods
class Stocker():
# Initialization requires a ticker symbol
def __init__(self, ticker, exchange='NS'):
# Enforce capitalization
ticker = ticker.upper()
# Symbol is used for labeling plots
self.symbol = ticker
# Use Personal Api Key
# quandl.ApiConfig.api_key = 'YourKeyHere'
# Retrieval the financial data
try:
#stock = quandl.get('%s/%s' % (exchange, ticker))
start = datetime.datetime(2000, 1, 1)
end = datetime.datetime.now()
stock = web.DataReader(ticker, 'yahoo', start, end)
Tks @cnubathula !
@iwalucas how do you get free data from yahoo? very interested (sorry i know this is closed)
@kevb10 I think its free, it just works
what's the endpoint and stuff. i'm unable to find it
I dont know, I just replaced those line of codes
Em ter, 3 de set de 2019 às 11:17, Kevin Manase notifications@github.com escreveu:
what's the endpoint and stuff. i'm unable to find it
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/WillKoehrsen/Data-Analysis/issues/46?email_source=notifications&email_token=AA34I76MMTHSV7AM3D6VSW3QHZWXXA5CNFSM4H7RPFN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5YK7NY#issuecomment-527478711, or mute the thread https://github.com/notifications/unsubscribe-auth/AA34I7YEOBB74T7OMDD27IDQHZWXXANCNFSM4H7RPFNQ .
-- Lucas
Would it be possible to have yahoo as a source for the stocker? QUANDL doesnt offer (for free) all world stocks.
Tks