Skip to content

Commit

Permalink
updated docstrings, todo-list and gists created
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarob96 committed May 3, 2019
1 parent 5129348 commit 1a2c002
Show file tree
Hide file tree
Showing 8 changed files with 456 additions and 154 deletions.
542 changes: 402 additions & 140 deletions .idea/workspace.xml

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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]([email protected]) 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
Expand All @@ -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

Expand Down
29 changes: 29 additions & 0 deletions investpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
Expand Down
8 changes: 4 additions & 4 deletions investpy/equities.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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__
Expand Down
4 changes: 2 additions & 2 deletions investpy/etfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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__
Expand Down
6 changes: 3 additions & 3 deletions investpy/funds.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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_ = {
Expand Down Expand Up @@ -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__
Expand Down
3 changes: 2 additions & 1 deletion investpy/user_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand All @@ -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")
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='[email protected]',
Expand Down

0 comments on commit 1a2c002

Please sign in to comment.