diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 10e847c3..518c9366 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,7 +3,13 @@ + + + + + + - + - - + - + @@ -590,7 +698,6 @@ - @@ -599,7 +706,6 @@ - @@ -650,76 +756,61 @@ - + - - - + - - - - - - - - - - - - - - - - - - - + + - + - - + + - - - - - - + + + + - - - - - - - - + - - + + - + + + - + - - + + - + + + + + + + + + + + + @@ -732,60 +823,231 @@ - - + + - + - - + + - - - - - - - + - + - - - - - + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index 0fe17d28..2ddbddd7 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ To conclude this section, I am in the need to specify that this is not the final In order to get this package working you will need to install [**investpy**](https://pypi.org/project/investpy/) from PyPi via Terminal typing: -``pip install investpy==0.8.4.2`` +``pip install investpy==0.8.4.3`` All the dependencies are already listed on the setup file of the package, but to sum them up, you will need the following requirements: @@ -26,6 +26,15 @@ All the dependencies are already listed on the setup file of the package, but to * [**unidecode 1.0.23**](https://pypi.org/project/unidecode/) * [**pytest 4.1.1**](https://pypi.org/project/pytest/) +## GitHub Gists on investpy use + +In order to explain the use of [**investpy**](https://pypi.org/project/investpy/), some self-explanatory gists have been created and they can be found at [my GitHub Gist Page](https://gist.github.com/alvarob96). As the package is updated with new functionality, gists will be updated so they can be easily tested and provide useful information for investpy use. + +* Equity Data Retrieval: https://gist.github.com/alvarob96/461dce00d9196dd3140f37993f8808f8 + +If needed you can open an [issue](https://github.com/alvarob96/investpy/issues) or [email me](alvarob96@usal.es) to request any other Gist or further explanation on how the package works. + + ## Release Notes 0.8.4.x * Several fixes on minor bugs/errors @@ -39,6 +48,7 @@ All the dependencies are already listed on the setup file of the package, but to * Company Profile retrieval returned value is a dict with the source and the description * Internal fixes to improve its ease of adaptability * Temporarily removed Python 2.7 support due to its warning of deprecation in January 1st of 2020 +* Updated docstrings as reStructuredText (via PyCharm) ## Additional Information diff --git a/investpy/__init__.py b/investpy/__init__.py index 286cc5ea..1fb388c5 100644 --- a/investpy/__init__.py +++ b/investpy/__init__.py @@ -17,6 +17,20 @@ from investpy.Data import Data +# TODO: add country/market param and mapping of 'resources/available_markets' in order to allow users retrieve +# historical data from different markets. + +# TODO: create thread pools to increase scraping efficiency and improve 'investpy' performance + +# TODO: generate sphinx documentation for version 1.0 + +# TODO: allow user to retrieve information from more than one equity/fund/etf in the same function call + +# TODO: handle connection errors and add params to retry on error codes [403, 404, 443, 500, ...] like /tweepy/binder.py + +# TODO: consider moving from es.investing to www.investing (long task - develop on developer branch) + + def get_equities_list(): """ This function retrieves the list of all the available equities @@ -342,6 +356,21 @@ def get_historical_data(equity, start, end, as_json=False, order='ascending'): def get_equity_company_profile(equity, language='english'): + """ + This function retrieves the company profile from an equity in the specified language from different sources. + + Parameters + ---------- + :param equity: str + name of the equity to the company profile from + :param language: str + language or code in which the company profile is going to be retrieved + + Returns + ------- + :returns str + returns a string containing the company profile of the specified equity + """ available_sources = { 'english': 'Investing', diff --git a/investpy/equities.py b/investpy/equities.py index 445f3347..de5d3c0d 100644 --- a/investpy/equities.py +++ b/investpy/equities.py @@ -20,7 +20,7 @@ def get_equity_names(): Returns ------- - returns a dictionary containing all the equities information + :returns a dictionary containing all the equities information """ params = { @@ -82,12 +82,12 @@ def get_equity_names(): def get_isin_code(info): """ - This is an auxiliar function that adds data to the equities pandas.DataFrame. + This is an additional function that adds data to the equities pandas.DataFrame. Added data in this case, are the ISIN codes of every company in order to identify it. Returns ------- - returns a str that contains the ISIN code of the specified equity + :returns a str that contains the ISIN code of the specified equity """ url = "https://es.investing.com/equities/" + info @@ -128,7 +128,7 @@ def list_equities(): Returns ------- - returns a list with all the available equities to retrieve data from + :returns a list with all the available equities to retrieve data from """ resource_package = __name__ diff --git a/investpy/etfs.py b/investpy/etfs.py index b3ceb2d0..25b9a2ce 100644 --- a/investpy/etfs.py +++ b/investpy/etfs.py @@ -18,7 +18,7 @@ def get_etf_names(): Returns ------- - returns a dictionary containing all the etfs information + :returns a dictionary containing all the etfs information """ head = { @@ -83,7 +83,7 @@ def list_etfs(): Returns ------- - returns a list with all the available etfs to retrieve data from + :returns a list with all the available etfs to retrieve data from """ resource_package = __name__ diff --git a/investpy/funds.py b/investpy/funds.py index 065c32d4..ab617c41 100644 --- a/investpy/funds.py +++ b/investpy/funds.py @@ -19,7 +19,7 @@ def get_fund_names(): Returns ------- - returns a dictionary containing all the funds information + :returns a dictionary containing all the funds information """ head = { @@ -83,7 +83,7 @@ def fund_information_to_json(df): Returns ------- - returns a JSON object containing fund information + :returns a JSON object containing fund information """ json_ = { @@ -117,7 +117,7 @@ def list_funds(): Returns ------- - returns a list with all the available funds to retrieve data from + :returns a list with all the available funds to retrieve data from """ resource_package = __name__ diff --git a/investpy/user_agent.py b/investpy/user_agent.py index ead29730..b1affbe6 100644 --- a/investpy/user_agent.py +++ b/investpy/user_agent.py @@ -14,7 +14,7 @@ def get_random(): Returns ------- - returns a string with the random user agent to use + :returns a string with the random user agent to use """ resource_package = __name__ @@ -25,6 +25,7 @@ def get_random(): with open(file, 'r') as f: try: lines = f.readlines() + return str(random.choice(lines)).replace("\n", "") except IOError: raise IOError("ERR#016: unable to retrieve a random user agent") diff --git a/setup.py b/setup.py index f12ec824..3310b344 100644 --- a/setup.py +++ b/setup.py @@ -11,10 +11,10 @@ def readme(): setup( name='investpy', - version='0.8.4.2', + version='0.8.4.3', packages=find_packages(), - url='', - download_url='https://github.com/alvarob96/investpy/archive/0.8.4.2.tar.gz', + url='https://github.com/alvarob96/investpy', + download_url='https://github.com/alvarob96/investpy/archive/0.8.4.3.tar.gz', license='MIT License', author='Alvaro Bartolome', author_email='alvarob96@usal.es',