Reputation: 309
I am trying to learn how to use APIs for financial analysis.
I have the following simple code:
import numpy as np
import pandas as pd
from pandas_datareader import data as wb
PG = wb.DataReader('PG', data_source = 'morningstar', start = '1995-01-01')
So, I am trying to extract PandG data from morningstar. The problem is that I get back the following message:
ImmediateDeprecationError:
Morningstar has been immediately deprecated due to large breaks in the API without the
introduction of a stable replacement. Pull Requests to re-enable these data
connectors are welcome.
I tried the same with Google but I failed. Is there something wrong in my code or is it something else?
I do have some csv files, how can I use them as source in the code above?
Below you can see what my codes gives back:
Upvotes: 0
Views: 802
Reputation: 81
For now, I would recommend using other sources such as AlphaVantage, Quandl, or IEX. The simplest is IEX, which does not require an API key. The reason for that is because maybe MorningStar has discontinued their API services. MorningStar is a less-known API. Or Python won't run it because it is not stable enough. Google has also disabled their API services.
Upvotes: 2
Reputation: 398
Use single responsibility principle. Create a DataFetcher class and expose a public method which can retrieve you data. For now, this DataFetcher class would extract information from the CSV file. Use DataFetcher class in your actual place.
Once you are confident enough, you can switch the CSV file logic to API request.
Upvotes: 1
Reputation: 34
Apperently you have to change from google finance to another.
https://github.com/pydata/pandas-datareader/issues/604
Upvotes: 1