From cce9ca3898e02a432043587a749c5032c441b777 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20Bartolom=C3=A9=20del=20Canto?=
Date: Mon, 12 Aug 2019 16:11:15 +0200
Subject: [PATCH] docs updated & release setup
- both docstrings and rst files updated
- argument rename from *start* and *end* to *from_date* and *to_date*, as described on #16
---
.travis.yml | 2 +-
README.md | 8 +--
docs/_build/html/_sources/equities.rst.txt | 2 +-
docs/_build/html/_sources/installation.md.txt | 2 +-
.../_build/html/_sources/installation.rst.txt | 2 +-
.../html/_static/documentation_options.js | 2 +-
docs/_build/html/api.html | 4 +-
docs/_build/html/contribution.html | 4 +-
docs/_build/html/disclaimer.html | 4 +-
docs/_build/html/equities.html | 6 +-
docs/_build/html/equities_api.html | 4 +-
docs/_build/html/etfs_api.html | 4 +-
docs/_build/html/examples.html | 4 +-
docs/_build/html/funds_api.html | 4 +-
docs/_build/html/genindex.html | 4 +-
docs/_build/html/index.html | 4 +-
docs/_build/html/information.html | 4 +-
docs/_build/html/installation.html | 6 +-
docs/_build/html/introduction.html | 4 +-
docs/_build/html/license.html | 4 +-
docs/_build/html/main.html | 4 +-
docs/_build/html/main_api.html | 4 +-
docs/_build/html/model.html | 4 +-
docs/_build/html/py-modindex.html | 4 +-
docs/_build/html/release.html | 4 +-
docs/_build/html/search.html | 4 +-
docs/conf.py | 4 +-
docs/equities.rst | 4 +-
docs/installation.rst | 2 +-
investpy/__init__.py | 52 +++++++--------
setup.py | 6 +-
tests/test_investpy.py | 6 +-
tests/test_investpy_errors.py | 66 +++++++++----------
33 files changed, 121 insertions(+), 121 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 22eced7b..7319dcbc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -12,7 +12,7 @@ install:
- pip install requests==2.22.0
- pip install lxml==4.3.3
- pip install Unidecode==1.0.23
- - pip install investpy==0.8.6
+ - pip install investpy==0.8.7
- pip install pytest==4.5.0
- pip install codecov==2.0.15
- pip install pytest-cov==2.7.1
diff --git a/README.md b/README.md
index ed129e33..56bd5e1e 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ investpy seeks to be one of the most used Python packages when it comes to histo
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.6``
+``pip install investpy==0.8.7``
All the dependencies are already listed on the setup file of the package, but to sum them up, you will need the following requirements:
@@ -55,7 +55,7 @@ Date
2019-07-17 4.905 4.965 4.900 4.952 22410000
2019-07-18 4.856 4.894 4.812 4.879 35820000
-df = investpy.get_historical_data(equity='bbva', start='01/01/2018', end='12/08/2019', as_json=False, order='ascending')
+df = investpy.get_historical_data(equity='bbva', from_date='01/01/2018', to_date='12/08/2019', as_json=False, order='ascending')
print(df.head())
>>>
@@ -85,7 +85,7 @@ Date
2019-07-17 1.129 1.129 1.129 1.129
2019-07-18 1.126 1.126 1.126 1.126
-df = investpy.get_fund_historical_data(fund='bbva plan multiactivo moderado pp', start='01/01/2018', end='12/08/2019', as_json=False, order='ascending')
+df = investpy.get_fund_historical_data(fund='bbva plan multiactivo moderado pp', from_date='01/01/2018', to_date='12/08/2019', as_json=False, order='ascending')
print(df.head())
>>>
@@ -115,7 +115,7 @@ Date
2019-07-17 35.830 36.080 35.810 35.965
2019-07-18 35.640 35.785 35.515 35.515
-df = investpy.get_etf_historical_data(etf='bbva accion dj eurostoxx 50', start='01/01/2018', end='12/08/2019', as_json=False, order='ascending')
+df = investpy.get_etf_historical_data(etf='bbva accion dj eurostoxx 50', from_date='01/01/2018', to_date='12/08/2019', as_json=False, order='ascending')
print(df.head())
>>>
diff --git a/docs/_build/html/_sources/equities.rst.txt b/docs/_build/html/_sources/equities.rst.txt
index 858f8592..8c76a439 100644
--- a/docs/_build/html/_sources/equities.rst.txt
+++ b/docs/_build/html/_sources/equities.rst.txt
@@ -10,7 +10,7 @@ protect investors from fraudulent practices. Historically, they have outperforme
run. These investments can be purchased from most online stock brokers.
In this case, historical data from stocks or equities is retrieved from `Investing Equities `_
-just for the Spanish Stock Market, on the current release 0.8.6.
+just for the Spanish Stock Market, on the current release 0.8.7.
Getting Started
---------------
diff --git a/docs/_build/html/_sources/installation.md.txt b/docs/_build/html/_sources/installation.md.txt
index 1996b450..013cc8cb 100644
--- a/docs/_build/html/_sources/installation.md.txt
+++ b/docs/_build/html/_sources/installation.md.txt
@@ -29,5 +29,5 @@ it will install the following dependencies:
.. note::
- After installing the package you are now available to use it! As investpy's latest release is 0.8.6 the installation is
+ After installing the package you are now available to use it! As investpy's latest release is 0.8.7 the installation is
optimized for it. If you try installing another investpy release, some features may not work.
\ No newline at end of file
diff --git a/docs/_build/html/_sources/installation.rst.txt b/docs/_build/html/_sources/installation.rst.txt
index 07659d21..f4e7d054 100644
--- a/docs/_build/html/_sources/installation.rst.txt
+++ b/docs/_build/html/_sources/installation.rst.txt
@@ -5,7 +5,7 @@ Installation
.. note::
- After installing the package you are now available to use it! As investpy's latest release is 0.8.6 the installation is
+ After installing the package you are now available to use it! As investpy's latest release is 0.8.7 the installation is
optimized for it. If you try installing another investpy release, some features may not work.
First Installation
diff --git a/docs/_build/html/_static/documentation_options.js b/docs/_build/html/_static/documentation_options.js
index 5226d97e..a647d55a 100644
--- a/docs/_build/html/_static/documentation_options.js
+++ b/docs/_build/html/_static/documentation_options.js
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
- VERSION: '0.8.6',
+ VERSION: '0.8.7',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
diff --git a/docs/_build/html/api.html b/docs/_build/html/api.html
index be97869d..564f9a2b 100644
--- a/docs/_build/html/api.html
+++ b/docs/_build/html/api.html
@@ -8,7 +8,7 @@
- API Reference — investpy 0.8.6 documentation
+ API Reference — investpy 0.8.7 documentation
@@ -60,7 +60,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/contribution.html b/docs/_build/html/contribution.html
index 9bc15545..cd975068 100644
--- a/docs/_build/html/contribution.html
+++ b/docs/_build/html/contribution.html
@@ -8,7 +8,7 @@
- Contribute to investpy - — investpy 0.8.6 documentation
+ Contribute to investpy - — investpy 0.8.7 documentation
@@ -58,7 +58,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/disclaimer.html b/docs/_build/html/disclaimer.html
index dc83e39a..9b79dc91 100644
--- a/docs/_build/html/disclaimer.html
+++ b/docs/_build/html/disclaimer.html
@@ -8,7 +8,7 @@
- Disclaimer — investpy 0.8.6 documentation
+ Disclaimer — investpy 0.8.7 documentation
@@ -59,7 +59,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/equities.html b/docs/_build/html/equities.html
index 53f89d8d..ef357d07 100644
--- a/docs/_build/html/equities.html
+++ b/docs/_build/html/equities.html
@@ -8,7 +8,7 @@
- Stocks/Equities — investpy 0.8.6 documentation
+ Stocks/Equities — investpy 0.8.7 documentation
@@ -60,7 +60,7 @@
- 0.8.6
+ 0.8.7
@@ -175,7 +175,7 @@ Stocks/Equities
-just for the Spanish Stock Market, on the current release 0.8.6.
+just for the Spanish Stock Market, on the current release 0.8.7.
Getting Started
To get started using investpy you first need to install it as described on
diff --git a/docs/_build/html/equities_api.html b/docs/_build/html/equities_api.html
index 1e8c73f3..95b4b1ba 100644
--- a/docs/_build/html/equities_api.html
+++ b/docs/_build/html/equities_api.html
@@ -8,7 +8,7 @@
-
investpy.equities — investpy 0.8.6 documentation
+
investpy.equities — investpy 0.8.7 documentation
@@ -60,7 +60,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/etfs_api.html b/docs/_build/html/etfs_api.html
index 909d4a41..028c35f6 100644
--- a/docs/_build/html/etfs_api.html
+++ b/docs/_build/html/etfs_api.html
@@ -8,7 +8,7 @@
-
investpy.etfs — investpy 0.8.6 documentation
+
investpy.etfs — investpy 0.8.7 documentation
@@ -60,7 +60,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/examples.html b/docs/_build/html/examples.html
index e5a52ed5..e3792b05 100644
--- a/docs/_build/html/examples.html
+++ b/docs/_build/html/examples.html
@@ -8,7 +8,7 @@
-
GitHub Gists on investpy use — investpy 0.8.6 documentation
+
GitHub Gists on investpy use — investpy 0.8.7 documentation
@@ -58,7 +58,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/funds_api.html b/docs/_build/html/funds_api.html
index e62711a7..80201c17 100644
--- a/docs/_build/html/funds_api.html
+++ b/docs/_build/html/funds_api.html
@@ -8,7 +8,7 @@
-
investpy.funds — investpy 0.8.6 documentation
+
investpy.funds — investpy 0.8.7 documentation
@@ -60,7 +60,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/genindex.html b/docs/_build/html/genindex.html
index 5d3de4ad..ca4f94b2 100644
--- a/docs/_build/html/genindex.html
+++ b/docs/_build/html/genindex.html
@@ -9,7 +9,7 @@
-
Index — investpy 0.8.6 documentation
+
Index — investpy 0.8.7 documentation
@@ -59,7 +59,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/index.html b/docs/_build/html/index.html
index bb54fbbd..5069eae7 100644
--- a/docs/_build/html/index.html
+++ b/docs/_build/html/index.html
@@ -8,7 +8,7 @@
-
Welcome to investpy’s documentation! — investpy 0.8.6 documentation
+
Welcome to investpy’s documentation! — investpy 0.8.7 documentation
@@ -59,7 +59,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/information.html b/docs/_build/html/information.html
index 822d616b..ea30fa56 100644
--- a/docs/_build/html/information.html
+++ b/docs/_build/html/information.html
@@ -8,7 +8,7 @@
-
Additional Information — investpy 0.8.6 documentation
+
Additional Information — investpy 0.8.7 documentation
@@ -60,7 +60,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/installation.html b/docs/_build/html/installation.html
index 2a8d49cf..20292a7a 100644
--- a/docs/_build/html/installation.html
+++ b/docs/_build/html/installation.html
@@ -8,7 +8,7 @@
-
Installation — investpy 0.8.6 documentation
+
Installation — investpy 0.8.7 documentation
@@ -60,7 +60,7 @@
- 0.8.6
+ 0.8.7
@@ -165,7 +165,7 @@
Installation
Note
-
After installing the package you are now available to use it! As investpy’s latest release is 0.8.6 the installation is
+
After installing the package you are now available to use it! As investpy’s latest release is 0.8.7 the installation is
optimized for it. If you try installing another investpy release, some features may not work.
diff --git a/docs/_build/html/introduction.html b/docs/_build/html/introduction.html
index 24574a04..40fbd917 100644
--- a/docs/_build/html/introduction.html
+++ b/docs/_build/html/introduction.html
@@ -8,7 +8,7 @@
-
Introduction — investpy 0.8.6 documentation
+
Introduction — investpy 0.8.7 documentation
@@ -60,7 +60,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/license.html b/docs/_build/html/license.html
index 1aa688de..b0107215 100644
--- a/docs/_build/html/license.html
+++ b/docs/_build/html/license.html
@@ -8,7 +8,7 @@
-
License — investpy 0.8.6 documentation
+
License — investpy 0.8.7 documentation
@@ -60,7 +60,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/main.html b/docs/_build/html/main.html
index 831d47c3..6d40ae43 100644
--- a/docs/_build/html/main.html
+++ b/docs/_build/html/main.html
@@ -8,7 +8,7 @@
-
investpy — investpy 0.8.6 documentation
+
investpy — investpy 0.8.7 documentation
@@ -60,7 +60,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/main_api.html b/docs/_build/html/main_api.html
index 6fe4860a..25ad866b 100644
--- a/docs/_build/html/main_api.html
+++ b/docs/_build/html/main_api.html
@@ -8,7 +8,7 @@
-
investpy — investpy 0.8.6 documentation
+
investpy — investpy 0.8.7 documentation
@@ -60,7 +60,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/model.html b/docs/_build/html/model.html
index bfe7b09f..8c213618 100644
--- a/docs/_build/html/model.html
+++ b/docs/_build/html/model.html
@@ -8,7 +8,7 @@
-
Model — investpy 0.8.6 documentation
+
Model — investpy 0.8.7 documentation
@@ -60,7 +60,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/py-modindex.html b/docs/_build/html/py-modindex.html
index f9c3854f..b74faaf4 100644
--- a/docs/_build/html/py-modindex.html
+++ b/docs/_build/html/py-modindex.html
@@ -8,7 +8,7 @@
-
Python Module Index — investpy 0.8.6 documentation
+
Python Module Index — investpy 0.8.7 documentation
@@ -61,7 +61,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/release.html b/docs/_build/html/release.html
index dfaf0831..dae8bb12 100644
--- a/docs/_build/html/release.html
+++ b/docs/_build/html/release.html
@@ -8,7 +8,7 @@
-
Release Notes 0.8.4.x — investpy 0.8.6 documentation
+
Release Notes 0.8.4.x — investpy 0.8.7 documentation
@@ -58,7 +58,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/_build/html/search.html b/docs/_build/html/search.html
index fd5a1b0a..7065b4fe 100644
--- a/docs/_build/html/search.html
+++ b/docs/_build/html/search.html
@@ -8,7 +8,7 @@
-
Search — investpy 0.8.6 documentation
+
Search — investpy 0.8.7 documentation
@@ -59,7 +59,7 @@
- 0.8.6
+ 0.8.7
diff --git a/docs/conf.py b/docs/conf.py
index 9f911b5a..99eccacc 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -25,9 +25,9 @@
author = 'Alvaro Bartolome'
# The short X.Y version
-version = '0.8.6'
+version = '0.8.7'
# The full version, including alpha/beta/rc tags
-release = '0.8.6'
+release = '0.8.7'
# -- General configuration ---------------------------------------------------
diff --git a/docs/equities.rst b/docs/equities.rst
index 858f8592..6bd45b0e 100644
--- a/docs/equities.rst
+++ b/docs/equities.rst
@@ -10,7 +10,7 @@ protect investors from fraudulent practices. Historically, they have outperforme
run. These investments can be purchased from most online stock brokers.
In this case, historical data from stocks or equities is retrieved from `Investing Equities
`_
-just for the Spanish Stock Market, on the current release 0.8.6.
+just for the Spanish Stock Market, on the current release 0.8.7.
Getting Started
---------------
@@ -57,7 +57,7 @@ So on an example is proposed in order to clarify the use of investpy for histori
df = investpy.get_recent_data(equity='bbva', as_json=False, order='ascending')
# Retrieves the historical data of BBVA on the specified date range as a pandas.DataFrame on ascending order
- df = investpy.get_historical_data(equity='bbva', start='01/01/2010', end='01/01/2019', as_json=False, order='ascending')
+ df = investpy.get_historical_data(equity='bbva', from_date='01/01/2010', to_date='01/01/2019', as_json=False, order='ascending')
As we already saw, both functions take a lot of parameters, but some of them are *optional* which means that the function
does not need the user to specify them.
diff --git a/docs/installation.rst b/docs/installation.rst
index 07659d21..f4e7d054 100644
--- a/docs/installation.rst
+++ b/docs/installation.rst
@@ -5,7 +5,7 @@ Installation
.. note::
- After installing the package you are now available to use it! As investpy's latest release is 0.8.6 the installation is
+ After installing the package you are now available to use it! As investpy's latest release is 0.8.7 the installation is
optimized for it. If you try installing another investpy release, some features may not work.
First Installation
diff --git a/investpy/__init__.py b/investpy/__init__.py
index f68bf546..bce45776 100644
--- a/investpy/__init__.py
+++ b/investpy/__init__.py
@@ -4,7 +4,7 @@
# See LICENSE for details.
__author__ = 'Alvaro Bartolome '
-__version__ = '0.8.6'
+__version__ = '0.8.7'
import datetime
import json
@@ -223,7 +223,7 @@ def get_recent_data(equity, as_json=False, order='ascending'):
continue
-def get_historical_data(equity, start, end, as_json=False, order='ascending'):
+def get_historical_data(equity, from_date, to_date, as_json=False, order='ascending'):
"""
This function retrieves historical data from the introduced `equity` from Investing
via Web Scraping on the introduced date range. The resulting data can it either be
@@ -231,8 +231,8 @@ def get_historical_data(equity, start, end, as_json=False, order='ascending'):
Args:
equity (:obj:`str`): name of the equity to retrieve recent historical data from.
- start (:obj:`str`): start date as `str` formatted as `dd/mm/yyyy`
- end (:obj:`str`): end date as `str` formatted as `dd/mm/yyyy`
+ from_date (:obj:`str`): date as `str` formatted as `dd/mm/yyyy`, from where data is going to be retrieved.
+ to_date (:obj:`str`): date as `str` formatted as `dd/mm/yyyy`, until where data is going to be retrieved.
as_json (:obj:`boolean`, optional):
to determine the format of the output data (:obj:`pandas.DataFrame` or :obj:`json`).
order (:obj:`str`, optional): to define the order of the retrieved data (`ascending` or `descending`).
@@ -274,7 +274,7 @@ def get_historical_data(equity, start, end, as_json=False, order='ascending'):
IndexError: if equity information was unavailable or not found.
Examples:
- >>> investpy.get_historical_data(equity='bbva', start='01/01/2010', end='01/01/2019', as_json=False, order='ascending')
+ >>> investpy.get_historical_data(equity='bbva', from_date='01/01/2010', to_date='01/01/2019', as_json=False, order='ascending')
date || open | high | low | close | volume
-----||-----------------------------------
xxxx || xxxx | xxxx | xxx | xxxxx | xxxxxx
@@ -294,17 +294,17 @@ def get_historical_data(equity, start, end, as_json=False, order='ascending'):
raise ValueError("ERR#0003: order argument can just be ascending or descending, str type.")
try:
- datetime.datetime.strptime(start, '%d/%m/%Y')
+ datetime.datetime.strptime(from_date, '%d/%m/%Y')
except ValueError:
- raise ValueError("ERR#0011: incorrect start date format, it should be 'dd/mm/yyyy'.")
+ raise ValueError("ERR#0011: incorrect from_date date format, it should be 'dd/mm/yyyy'.")
try:
- datetime.datetime.strptime(end, '%d/%m/%Y')
+ datetime.datetime.strptime(to_date, '%d/%m/%Y')
except ValueError:
raise ValueError("ERR#0012: incorrect end date format, it should be 'dd/mm/yyyy'.")
- start_date = datetime.datetime.strptime(start, '%d/%m/%Y')
- end_date = datetime.datetime.strptime(end, '%d/%m/%Y')
+ start_date = datetime.datetime.strptime(from_date, '%d/%m/%Y')
+ end_date = datetime.datetime.strptime(to_date, '%d/%m/%Y')
if start_date >= end_date:
raise ValueError("ERR#0032: end_date should be greater than start_date, both formatted as 'dd/mm/yyyy'.")
@@ -843,7 +843,7 @@ def get_fund_recent_data(fund, as_json=False, order='ascending'):
continue
-def get_fund_historical_data(fund, start, end, as_json=False, order='ascending'):
+def get_fund_historical_data(fund, from_date, to_date, as_json=False, order='ascending'):
"""
This function retrieves historical data from the introduced `fund` from Investing
via Web Scraping on the introduced date range. The resulting data can it either be
@@ -851,8 +851,8 @@ def get_fund_historical_data(fund, start, end, as_json=False, order='ascending')
Args:
fund (:obj:`str`): name of the fund to retrieve recent historical data from.
- start (:obj:`str`): start date as `str` formatted as `dd/mm/yyyy`
- end (:obj:`str`): end date as `str` formatted as `dd/mm/yyyy`
+ from_date (:obj:`str`): date as `str` formatted as `dd/mm/yyyy`, from where data is going to be retrieved.
+ to_date (:obj:`str`): date as `str` formatted as `dd/mm/yyyy`, until where data is going to be retrieved.
as_json (:obj:`boolean`, optional):
to determine the format of the output data (:obj:`pandas.DataFrame` or :obj:`json`).
order (:obj:`str`, optional): to define the order of the retrieved data (`ascending` or `descending`).
@@ -893,7 +893,7 @@ def get_fund_historical_data(fund, start, end, as_json=False, order='ascending')
IndexError: if fund information was unavailable or not found.
Examples:
- >>> investpy.get_fund_historical_data(fund='bbva multiactivo conservador pp', start='01/01/2010', end='01/01/2019', as_json=False, order='ascending')
+ >>> investpy.get_fund_historical_data(fund='bbva multiactivo conservador pp', from_date='01/01/2010', to_date='01/01/2019', as_json=False, order='ascending')
date || open | high | low | close
-----||---------------------------
xxxx || xxxx | xxxx | xxx | xxxxx
@@ -913,17 +913,17 @@ def get_fund_historical_data(fund, start, end, as_json=False, order='ascending')
raise ValueError("ERR#0003: order argument can just be ascending or descending, str type.")
try:
- datetime.datetime.strptime(start, '%d/%m/%Y')
+ datetime.datetime.strptime(from_date, '%d/%m/%Y')
except ValueError:
raise ValueError("ERR#0011: incorrect start date format, it should be 'dd/mm/yyyy'.")
try:
- datetime.datetime.strptime(end, '%d/%m/%Y')
+ datetime.datetime.strptime(to_date, '%d/%m/%Y')
except ValueError:
raise ValueError("ERR#0012: incorrect end date format, it should be 'dd/mm/yyyy'.")
- start_date = datetime.datetime.strptime(start, '%d/%m/%Y')
- end_date = datetime.datetime.strptime(end, '%d/%m/%Y')
+ start_date = datetime.datetime.strptime(from_date, '%d/%m/%Y')
+ end_date = datetime.datetime.strptime(to_date, '%d/%m/%Y')
if start_date >= end_date:
raise ValueError("ERR#0032: end_date should be greater than start_date, both formatted as 'dd/mm/yyyy'.")
@@ -1508,7 +1508,7 @@ def get_etf_recent_data(etf, as_json=False, order='ascending'):
continue
-def get_etf_historical_data(etf, start, end, as_json=False, order='ascending'):
+def get_etf_historical_data(etf, from_date, to_date, as_json=False, order='ascending'):
"""
This function retrieves historical data from the introduced `etf` from Investing
via Web Scraping on the introduced date range. The resulting data can it either be
@@ -1516,8 +1516,8 @@ def get_etf_historical_data(etf, start, end, as_json=False, order='ascending'):
Args:
etf (:obj:`str`): name of the etf to retrieve recent historical data from.
- start (:obj:`str`): start date as `str` formatted as `dd/mm/yyyy`
- end (:obj:`str`): end date as `str` formatted as `dd/mm/yyyy`
+ from_date (:obj:`str`): date as `str` formatted as `dd/mm/yyyy`, from where data is going to be retrieved.
+ to_date (:obj:`str`): date as `str` formatted as `dd/mm/yyyy`, until where data is going to be retrieved.
as_json (:obj:`boolean`, optional):
to determine the format of the output data (:obj:`pandas.DataFrame` or :obj:`json`).
order (:obj:`str`, optional): to define the order of the retrieved data (`ascending` or `descending`).
@@ -1558,7 +1558,7 @@ def get_etf_historical_data(etf, start, end, as_json=False, order='ascending'):
IndexError: if etf information was unavailable or not found.
Examples:
- >>> investpy.get_etf_historical_data(etf='bbva accion dj eurostoxx 50', start='01/01/2010', end='01/01/2019', as_json=False, order='ascending')
+ >>> investpy.get_etf_historical_data(etf='bbva accion dj eurostoxx 50', from_date='01/01/2010', to_date='01/01/2019', as_json=False, order='ascending')
date || open | high | low | close
-----||---------------------------
xxxx || xxxx | xxxx | xxx | xxxxx
@@ -1578,17 +1578,17 @@ def get_etf_historical_data(etf, start, end, as_json=False, order='ascending'):
raise ValueError("ERR#0003: order argument can just be ascending or descending, str type.")
try:
- datetime.datetime.strptime(start, '%d/%m/%Y')
+ datetime.datetime.strptime(from_date, '%d/%m/%Y')
except ValueError:
raise ValueError("ERR#0011: incorrect data format, it should be 'dd/mm/yyyy'.")
try:
- datetime.datetime.strptime(end, '%d/%m/%Y')
+ datetime.datetime.strptime(to_date, '%d/%m/%Y')
except ValueError:
raise ValueError("ERR#0011: incorrect data format, it should be 'dd/mm/yyyy'.")
- start_date = datetime.datetime.strptime(start, '%d/%m/%Y')
- end_date = datetime.datetime.strptime(end, '%d/%m/%Y')
+ start_date = datetime.datetime.strptime(from_date, '%d/%m/%Y')
+ end_date = datetime.datetime.strptime(to_date, '%d/%m/%Y')
if start_date >= end_date:
raise ValueError("ERR#0032: end_date should be greater than start_date, both formatted as 'dd/mm/yyyy'.")
diff --git a/setup.py b/setup.py
index 67bcc932..1604de91 100644
--- a/setup.py
+++ b/setup.py
@@ -11,14 +11,14 @@ def readme():
setup(
name='investpy',
- version='0.8.6',
+ version='0.8.7',
packages=find_packages(),
url='https://investpy.readthedocs.io/',
- download_url='https://github.com/alvarob96/investpy/archive/0.8.6.tar.gz',
+ download_url='https://github.com/alvarob96/investpy/archive/0.8.7.tar.gz',
license='MIT License',
author='Alvaro Bartolome',
author_email='alvarob96@usal.es',
- description='investpy — Python package for stock historical data extraction from Investing',
+ description='investpy — a Python package for financial historical data extraction from Investing',
long_description=readme(),
long_description_content_type='text/markdown',
install_requires=['requests==2.22.0',
diff --git a/tests/test_investpy.py b/tests/test_investpy.py
index 668636f9..6b12be20 100644
--- a/tests/test_investpy.py
+++ b/tests/test_investpy.py
@@ -32,7 +32,7 @@ def test_investpy():
for param in params:
investpy.get_recent_data(equity='enagás', as_json=param['as_json'], order=param['order'])
- investpy.get_historical_data(equity='enagás', start='01/01/1990', end='01/01/2019', as_json=param['as_json'], order=param['order'])
+ investpy.get_historical_data(equity='enagás', from_date='01/01/1990', to_date='01/01/2019', as_json=param['as_json'], order=param['order'])
for value in ['spanish', 'english']:
investpy.get_equity_company_profile(equity='enagás', language=value)
@@ -55,7 +55,7 @@ def test_investpy():
for param in params:
investpy.get_fund_recent_data(fund='bbva multiactivo conservador pp', as_json=param['as_json'], order=param['order'])
- investpy.get_fund_historical_data(fund='bbva multiactivo conservador pp', start='01/01/2010', end='01/01/2019', as_json=param['as_json'], order=param['order'])
+ investpy.get_fund_historical_data(fund='bbva multiactivo conservador pp', from_date='01/01/2010', to_date='01/01/2019', as_json=param['as_json'], order=param['order'])
investpy.get_funds()
@@ -86,7 +86,7 @@ def test_investpy():
for param in params:
investpy.get_etf_recent_data(etf='bbva accion dj eurostoxx 50', as_json=param['as_json'], order=param['order'])
- investpy.get_etf_historical_data(etf='bbva accion dj eurostoxx 50', start='01/01/2010', end='01/01/2019', as_json=param['as_json'], order=param['order'])
+ investpy.get_etf_historical_data(etf='bbva accion dj eurostoxx 50', from_date='01/01/2010', to_date='01/01/2019', as_json=param['as_json'], order=param['order'])
retrieve_etfs(debug_mode=True)
diff --git a/tests/test_investpy_errors.py b/tests/test_investpy_errors.py
index d9a16a90..4381042e 100644
--- a/tests/test_investpy_errors.py
+++ b/tests/test_investpy_errors.py
@@ -26,21 +26,21 @@ def test_equity_errors():
pass
params = [
- {'equity': 'bbva', 'start': '01/01/2019', 'end': '01/01/2019', 'as_json': 'error', 'order': 'ascending'},
- {'equity': 'bbva', 'start': '01/01/2019', 'end': '01/01/2019', 'as_json': False, 'order': 'error'},
- {'equity': 'bbva', 'start': 'error', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'equity': 'bbva', 'start': '01/01/2019', 'end': 'error', 'as_json': False, 'order': 'ascending'},
- {'equity': 'error', 'start': '01/01/2019', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'equity': ['error'], 'start': '01/01/2019', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'equity': 'bbva', 'start': '01/01/1999', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'equity': 'bbva', 'start': '01/01/1900', 'end': '01/01/1950', 'as_json': False, 'order': 'ascending'},
- {'equity': 'bbva', 'start': '01/01/1950', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'equity': 'bbva', 'start': '01/01/2019', 'end': '01/01/1999', 'as_json': False, 'order': 'ascending'},
+ {'equity': 'bbva', 'from_date': '01/01/2019', 'to_date': '01/01/2019', 'as_json': 'error', 'order': 'ascending'},
+ {'equity': 'bbva', 'from_date': '01/01/2019', 'to_date': '01/01/2019', 'as_json': False, 'order': 'error'},
+ {'equity': 'bbva', 'from_date': 'error', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'equity': 'bbva', 'from_date': '01/01/2019', 'to_date': 'error', 'as_json': False, 'order': 'ascending'},
+ {'equity': 'error', 'from_date': '01/01/2019', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'equity': ['error'], 'from_date': '01/01/2019', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'equity': 'bbva', 'from_date': '01/01/1999', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'equity': 'bbva', 'from_date': '01/01/1900', 'to_date': '01/01/1950', 'as_json': False, 'order': 'ascending'},
+ {'equity': 'bbva', 'from_date': '01/01/1950', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'equity': 'bbva', 'from_date': '01/01/2019', 'to_date': '01/01/1999', 'as_json': False, 'order': 'ascending'},
]
for param in params:
try:
- investpy.get_historical_data(equity=param['equity'], start=param['start'], end=param['end'],
+ investpy.get_historical_data(equity=param['equity'], from_date=param['from_date'], to_date=param['to_date'],
as_json=param['as_json'], order=param['order'])
except:
pass
@@ -87,21 +87,21 @@ def test_fund_errors():
pass
params = [
- {'fund': 'quality inversion conservadora fi', 'start': '01/01/2019', 'end': '01/01/2019', 'as_json': 'error', 'order': 'ascending'},
- {'fund': 'quality inversion conservadora fi', 'start': '01/01/2019', 'end': '01/01/2019', 'as_json': False, 'order': 'error'},
- {'fund': 'quality inversion conservadora fi', 'start': 'error', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'fund': 'quality inversion conservadora fi', 'start': '01/01/2019', 'end': 'error', 'as_json': False, 'order': 'ascending'},
- {'fund': 'error', 'start': '01/01/2019', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'fund': ['error'], 'start': '01/01/1998', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'fund': 'quality inversion conservadora fi', 'start': '01/01/1998', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'fund': 'quality inversion conservadora fi', 'start': '01/01/1990', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'fund': 'quality inversion conservadora fi', 'start': '01/01/2019', 'end': '01/01/1998', 'as_json': False, 'order': 'ascending'},
- {'fund': 'quality inversion conservadora fi', 'start': '01/01/1900', 'end': '01/01/1950', 'as_json': False, 'order': 'ascending'},
+ {'fund': 'quality inversion conservadora fi', 'from_date': '01/01/2019', 'to_date': '01/01/2019', 'as_json': 'error', 'order': 'ascending'},
+ {'fund': 'quality inversion conservadora fi', 'from_date': '01/01/2019', 'to_date': '01/01/2019', 'as_json': False, 'order': 'error'},
+ {'fund': 'quality inversion conservadora fi', 'from_date': 'error', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'fund': 'quality inversion conservadora fi', 'from_date': '01/01/2019', 'to_date': 'error', 'as_json': False, 'order': 'ascending'},
+ {'fund': 'error', 'from_date': '01/01/2019', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'fund': ['error'], 'from_date': '01/01/1998', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'fund': 'quality inversion conservadora fi', 'from_date': '01/01/1998', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'fund': 'quality inversion conservadora fi', 'from_date': '01/01/1990', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'fund': 'quality inversion conservadora fi', 'from_date': '01/01/2019', 'to_date': '01/01/1998', 'as_json': False, 'order': 'ascending'},
+ {'fund': 'quality inversion conservadora fi', 'from_date': '01/01/1900', 'to_date': '01/01/1950', 'as_json': False, 'order': 'ascending'},
]
for param in params:
try:
- investpy.get_fund_historical_data(fund=param['fund'], start=param['start'], end=param['end'], as_json=param['as_json'], order=param['order'])
+ investpy.get_fund_historical_data(fund=param['fund'], from_date=param['from_date'], to_date=param['to_date'], as_json=param['as_json'], order=param['order'])
except:
pass
@@ -146,21 +146,21 @@ def test_etf_errors():
pass
params = [
- {'etf': 'bbva accion dj eurostoxx 50', 'start': '01/01/2019', 'end': '01/01/2019', 'as_json': 'error', 'order': 'ascending'},
- {'etf': 'bbva accion dj eurostoxx 50', 'start': '01/01/2019', 'end': '01/01/2019', 'as_json': False, 'order': 'error'},
- {'etf': 'bbva accion dj eurostoxx 50', 'start': 'error', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'etf': 'bbva accion dj eurostoxx 50', 'start': '01/01/2019', 'end': 'error', 'as_json': False, 'order': 'ascending'},
- {'etf': 'error', 'start': '01/01/2019', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'etf': ['error'], 'start': '01/01/2019', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'etf': 'bbva accion dj eurostoxx 50', 'start': '01/01/1998', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'etf': 'bbva accion dj eurostoxx 50', 'start': '01/01/1900', 'end': '01/01/2019', 'as_json': False, 'order': 'ascending'},
- {'etf': 'bbva accion dj eurostoxx 50', 'start': '01/01/2019', 'end': '01/01/1998', 'as_json': False, 'order': 'ascending'},
- {'etf': 'bbva accion dj eurostoxx 50', 'start': '01/01/1900', 'end': '01/01/1950', 'as_json': False, 'order': 'ascending'},
+ {'etf': 'bbva accion dj eurostoxx 50', 'from_date': '01/01/2019', 'to_date': '01/01/2019', 'as_json': 'error', 'order': 'ascending'},
+ {'etf': 'bbva accion dj eurostoxx 50', 'from_date': '01/01/2019', 'to_date': '01/01/2019', 'as_json': False, 'order': 'error'},
+ {'etf': 'bbva accion dj eurostoxx 50', 'from_date': 'error', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'etf': 'bbva accion dj eurostoxx 50', 'from_date': '01/01/2019', 'to_date': 'error', 'as_json': False, 'order': 'ascending'},
+ {'etf': 'error', 'from_date': '01/01/2019', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'etf': ['error'], 'from_date': '01/01/2019', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'etf': 'bbva accion dj eurostoxx 50', 'from_date': '01/01/1998', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascto_dateing'},
+ {'etf': 'bbva accion dj eurostoxx 50', 'from_date': '01/01/1900', 'to_date': '01/01/2019', 'as_json': False, 'order': 'ascending'},
+ {'etf': 'bbva accion dj eurostoxx 50', 'from_date': '01/01/2019', 'to_date': '01/01/1998', 'as_json': False, 'order': 'ascending'},
+ {'etf': 'bbva accion dj eurostoxx 50', 'from_date': '01/01/1900', 'to_date': '01/01/1950', 'as_json': False, 'order': 'ascending'},
]
for param in params:
try:
- investpy.get_etf_historical_data(etf=param['etf'], start=param['start'], end=param['end'], as_json=param['as_json'], order=param['order'])
+ investpy.get_etf_historical_data(etf=param['etf'], from_date=param['from_date'], to_date=param['to_date'], as_json=param['as_json'], order=param['order'])
except:
pass