Skip to content

Commit

Permalink
Merge pull request #317 from alvarobartt/dev
Browse files Browse the repository at this point in the history
Some improvements & bug fixes before v1.0.4 release
  • Loading branch information
Álvaro Bartolomé committed Mar 31, 2021
2 parents 233a2c2 + 3e42ea1 commit db44000
Show file tree
Hide file tree
Showing 27 changed files with 4,813 additions and 2,839 deletions.
75 changes: 49 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ investpy to be one of the most consistent packages when it comes to financial da

---

## Installation
## :hammer_and_wrench: Installation

To get this package working you will need to **install it via pip** (with a Python 3.6 version or higher) on the terminal by typing:

Expand All @@ -44,14 +44,14 @@ the stable release comes out (which eventually may take some time depending on t

---

## Usage
## :computer: Usage

Even though some investpy usage examples are presented on the [docs](https://investpy.readthedocs.io/usage.html),
some basic functionality will be sorted out with sample Python code blocks. Additionally, more usage examples
can be found under [examples/](https://github.com/alvarobartt/investpy/tree/master/examples) directory, which
contains a collection of Jupyter Notebooks on how to use investpy and handle its data.

### Recent/Historical Data Retrieval
### :chart_with_upwards_trend: Recent/Historical Data Retrieval

investpy allows the user to **download both recent and historical data from any financial product indexed**
(stocks, funds, ETFs, currency crosses, certificates, bonds, commodities, indices, and cryptos). In
Expand Down Expand Up @@ -79,7 +79,7 @@ Date
To get to know all the available recent and historical data extraction functions provided by
investpy, and also, parameter tuning, please read the docs.

### Search Data
### :mag: Search Data

**Investing.com search engine is completely integrated** with investpy, which means that any available
financial product (quote) can be easily found. The search function allows the user to tune the parameters
Expand Down Expand Up @@ -121,7 +121,7 @@ Date
```

### Crypto Currencies Data Retrieval
### :money_with_wings: Crypto Currencies Data Retrieval

Cryptocurrencies support has recently been included, to let the user retrieve data and information from any
available crypto at Investing.com. Please note that some cryptocurrencies do not have available data indexed
Expand Down Expand Up @@ -152,13 +152,40 @@ Date

---

## Documentation
## :open_book: Documentation

You can find the **complete investpy documentation** at [Documentation](https://investpy.readthedocs.io/).

---

## Related projects
## :sparkles: Contribute

As this is an open-source project it is **open to contributions, bug reports, bug fixes, documentation improvements,
enhancements, and ideas**. There is an open tab of [issues](https://github.com/alvarobartt/investpy/issues) where
anyone can open new issues if needed or navigate through them to solve them or contribute to its solving.
Remember that issues are not threads to describe multiple problems, this does not mean that issues can not
be discussed, but so to keep structured project management, the same issue should not describe different
problems, just the main one and some nested/related errors that may be found.

---

## :question: Discussions (Q&A, AMA)

GitHub recently released a new feature named __GitHub Discussions__ (still in beta). GitHub Discussions is a
collaborative communication forum for the community around an open source project.

Check the investpy GitHub Discussions page at [Discussions](https://github.com/alvarobartt/investpy/discussions),
and feel free to ask me (ar any developer) anything, share updates, have open-ended conversations, and follow along
on decisions affecting the community's way of working.

:pushpin: __Note__. Usually I don't answer emails asking me questions about investpy, as we currently have the
GitHub Discussions tab, and I encourage you to use it. GitHub Discussions is the easiest way to contact me about
investpy, so that I don't answer the same stuff more than once via email, as anyone can see the opened/answered
discussions.

---

## :card_index_dividers: Related projects

Since investpy is intended to retrieve data from different financial products as indexed in Investing.com,
the **development of some support modules which implement an additional functionality based on investpy data**,
Expand All @@ -174,22 +201,11 @@ include it in this section.

---

## Contribute - [![Open Source Helpers](https://www.codetriage.com/alvarobartt/investpy/badges/users.svg)](https://www.codetriage.com/alvarobartt/investpy)

As this is an open-source project it is **open to contributions, bug reports, bug fixes, documentation improvements,
enhancements, and ideas**. There is an open tab of [issues](https://github.com/alvarobartt/investpy/issues) where
anyone can open new issues if needed or navigate through them to solve them or contribute to its solving.
Remember that issues are not threads to describe multiple problems, this does not mean that issues can not
be discussed, but so to keep structured project management, the same issue should not describe different
problems, just the main one and some nested/related errors that may be found.

---

## Citation
## :memo: Citation

When citing this repository on your scientific publications please use the following **BibTeX** citation:

```
```bibtex
@misc{investpy,
author = {Alvaro Bartolome del Canto},
title = {investpy - Financial Data Extraction from Investing.com with Python},
Expand All @@ -206,17 +222,24 @@ When citing this repository on any other social media, please use the following
investpy - Financial Data Extraction from Investing.com with Python developed by Alvaro Bartolome del Canto
```

And include a mention (so that I can see your work!) to me at any of my social network profiles:
You should also mention the source from where the data is retrieved, Investing.com; even though it's already
included in the package short description title.

---

## :man_technologist: Contact Information

You can contact me at any of my social network profiles:

- LinkedIn: https://linkedin.com/in/alvarobartt
- Twitter: https://twitter.com/alvarobartt
- GitHub: https://github.com/alvarobartt
- :briefcase: LinkedIn: https://linkedin.com/in/alvarobartt
- :bird: Twitter: https://twitter.com/alvarobartt
- :octocat: GitHub: https://github.com/alvarobartt

If applicable also mention the source from where the data is retrieved, Investing.com.
Or via email at alvarobartt@yahoo.com.

---

## Disclaimer
## :warning: Disclaimer

This Python package has been made for **research purposes** to fit the needs that Investing.com does not cover,
so this package works like an Application Programming Interface (API) of Investing.com developed in an **altruistic way**.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/_info/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Currently the `docs/` are still missing a lot of information, but they can be cl

## What do I do if the financial product I am looking for is not indexed in investpy?

As it is known, investpy gathers and retrieves data from Investing.com which is a website that contains a lot of financial information. Since investpy relies on Investing data, some of it may not be available in Investing, which will mean that it will not be available in investpy either. Anyways, it can be an investpy problem while retrieving data, so on, there is a search function (`investpy.search_quotes(text, products, countries, n_results)`) that can be used for searching financial products that are available in Investing but they can not be retrieved using investpy main functions.
As it is known, investpy gathers and retrieves data from Investing.com which is a website that contains a lot of financial information. Since investpy relies on Investing.com data, some of it may not be available in Investing, which will mean that it will not be available in investpy either. Anyways, it can be an investpy problem while retrieving data, so on, there is a search function (`investpy.search_quotes(text, products, countries, n_results)`) that can be used for searching financial products that are available in Investing.com but they can not be retrieved using investpy main functions.

## I am having problems while installing the package.

Expand Down
5 changes: 2 additions & 3 deletions docs/source/_info/funds.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ fund or rainy-day fund to pay for unforeseen expenses or a trust fund to set asi

Source: *Investopedia*


Getting Started
---------------

Expand All @@ -29,7 +28,7 @@ Listing
^^^^^^^

`investpy <https://pypi.org/project/investpy/>`_ offers some listing functions that allow the user to get the general
information of the indexed funds on `Investing <https://www.investing.com/funds/>`_ as that information is already
information of the indexed funds on `Investing.com <https://www.investing.com/funds/>`_ as that information is already
stored on CSV files generated automatically on the package installation.

The user can either retrieve the whole :obj:`pandas.DataFrame` containing all the information stored on the CSV file, a
Expand Down Expand Up @@ -146,7 +145,7 @@ values, as they are mandatory. Both date values are :obj:`str` formatted as *dd/
.. tip::

If you are not familiar with funds you can either retrieve a :obj:`list` of the ones available as provided by
investpy or check the listing in `Investing Funds <https://www.investing.com/funds>`_.
investpy or check the listing in `Investing.com Funds <https://www.investing.com/funds>`_.

Fund Information
^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion docs/source/_info/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Installation

.. note::

After installing the package you are now available to use it! As investpy's latest release is 1.0.3 the installation is
After installing the package you are now available to use it! As investpy's latest release is 1.0.4 the installation is
optimized for it. If you try installing another investpy release, some features may not work.

First Installation
Expand Down
6 changes: 3 additions & 3 deletions docs/source/_info/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ stocks of the companies that make up the Spanish Stock Market, until the date th
a data extraction model for stocks from the Spanish Stock Market.

As time passed by, a decision was made on how investpy could be improved, and as the package was expected to have a high
scalability and thus cover all the data possibilities offered by Investing to the public, investpy is now trying to
scalability and thus cover all the data possibilities offered by Investing.com to the public, investpy is now trying to
expand the data it retrieves to make it more useful.

Along this document some relevant features of `investpy <https://pypi.org/project/investpy/>`_ are going to be
Expand Down Expand Up @@ -52,10 +52,10 @@ Reference. For example, a block of code in order to get to test investpy usage i
Data Source
-----------

`Investing <https://www.investing.com/>`_ is the main data source from which investpy retrieves the data. Investing is a
`Investing.com <https://www.investing.com/>`_ is the main data source from which investpy retrieves the data. Investing.com is a
global financial portal and Internet brand owned by Fusion Media Ltd. which provides news, analysis, streaming quotes,
charts, technical data and financial tools about the global financial markets.

So as, the decision of choosing Investing as the data source is based on its reliability and also because it is one of
So as, the decision of choosing Investing.com as the data source is based on its reliability and also because it is one of
the few web pages that provide detailed data from spanish markets, as it was the main focus when determining to
develop the package as explained previously.
2 changes: 1 addition & 1 deletion docs/source/_info/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ day, respectively. And the volume value refers to the number of shares traded in
.. note::

The Data model is not usable as it is just a class used for the inner package, transparent to the user. It is used
in order to categorize each retrieved value from Investing and then to define its structure and, so on, the
in order to categorize each retrieved value from Investing.com and then to define its structure and, so on, the
structure that either the resulting pandas.DataFrame or JSON file will be based on.

Search Model
Expand Down
6 changes: 3 additions & 3 deletions docs/source/_info/stocks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Listing
^^^^^^^

`investpy <https://pypi.org/project/investpy/>`_ offers some listing functions that allow the user to get the general
information of the indexed stocks on `Investing <https://www.investing.com/>`_ as that information is already
information of the indexed stocks on `Investing.com <https://www.investing.com/>`_ as that information is already
stored on CSV files generated automatically on the package installation.

We can either retrieve the whole :obj:`pandas.DataFrame` containing all the information stored on the CSV file or a
Expand Down Expand Up @@ -82,7 +82,7 @@ values, as they are mandatory. Both date values are :obj:`str` formatted as *dd/
.. tip::

If you are not familiar with stocks you can either retrieve a listing of the ones
available or check the one presented in `Investing Equities <https://www.investing.com/equities>`_.
available or check the one presented in `Investing.com Equities <https://www.investing.com/equities>`_.

Company Profile
^^^^^^^^^^^^^^^
Expand All @@ -96,7 +96,7 @@ is a self-made description of the company.
investpy.get_stock_company_profile(stock='bbva', country='spain', language='english')
As explained before, when it comes to data retrieval, both ``stock`` and ``country`` parameters are mandatory, and
should match; as the default value for the ``language`` of the retrieved company profile is *english* (as `Investing <https://www.investing.com/>`_
should match; as the default value for the ``language`` of the retrieved company profile is *english* (as `Investing.com <https://www.investing.com/>`_
provides company profiles written in english), but besides that, the function
also retrieves the company profile on *spanish* from `Bolsa de Madrid <http://www.bolsamadrid.es/esp/aspx/Portada/Portada.aspx>`_,
which is the additional resource used along this package.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author = 'Alvaro Bartolome del Canto'

# The full version, including alpha/beta/rc tags
release = '1.0.3'
release = '1.0.4'


# -- General configuration ---------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions investpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See LICENSE for details.

__author__ = 'Alvaro Bartolome @ alvarobartt in GitHub'
__version__ = '1.0.3'
__version__ = '1.0.4'

from .stocks import get_stocks, get_stocks_list, get_stocks_dict, get_stock_countries, get_stock_recent_data, \
get_stock_historical_data, get_stock_company_profile, get_stock_dividends, get_stock_information, get_stocks_overview, \
Expand Down Expand Up @@ -35,7 +35,7 @@
get_certificate_recent_data, get_certificate_historical_data, get_certificate_information, get_certificates_overview, \
search_certificates

from .search import search_quotes
from .search import search_quotes, search_events

from .news import economic_calendar

Expand Down
22 changes: 11 additions & 11 deletions investpy/bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,12 @@ def get_bond_recent_data(bond, as_json=False, order='ascending', interval='Daily

bond = unidecode(bond.strip().lower())

if bond not in list(bonds['name'].str.lower()):
if bond not in list(bonds['name'].apply(unidecode).str.lower()):
raise RuntimeError("ERR#0068: bond " + bond + " not found, check if it is correct.")

id_ = bonds.loc[(bonds['name'].str.lower() == bond).idxmax(), 'id']
name = bonds.loc[(bonds['name'].str.lower() == bond).idxmax(), 'name']
full_name = bonds.loc[(bonds['name'].str.lower() == bond).idxmax(), 'full_name']
id_ = bonds.loc[(bonds['name'].apply(unidecode).str.lower() == bond).idxmax(), 'id']
name = bonds.loc[(bonds['name'].apply(unidecode).str.lower() == bond).idxmax(), 'name']
full_name = bonds.loc[(bonds['name'].apply(unidecode).str.lower() == bond).idxmax(), 'full_name']

header = full_name + " Bond Yield Historical Data"

Expand Down Expand Up @@ -475,12 +475,12 @@ def get_bond_historical_data(bond, from_date, to_date, as_json=False, order='asc

bond = unidecode(bond.strip().lower())

if bond not in list(bonds['name'].str.lower()):
if bond not in list(bonds['name'].apply(unidecode).str.lower()):
raise RuntimeError("ERR#0068: bond " + bond + " not found, check if it is correct.")

id_ = bonds.loc[(bonds['name'].str.lower() == bond).idxmax(), 'id']
name = bonds.loc[(bonds['name'].str.lower() == bond).idxmax(), 'name']
full_name = bonds.loc[(bonds['name'].str.lower() == bond).idxmax(), 'full_name']
id_ = bonds.loc[(bonds['name'].apply(unidecode).str.lower() == bond).idxmax(), 'id']
name = bonds.loc[(bonds['name'].apply(unidecode).str.lower() == bond).idxmax(), 'name']
full_name = bonds.loc[(bonds['name'].apply(unidecode).str.lower() == bond).idxmax(), 'full_name']

final = list()

Expand Down Expand Up @@ -643,11 +643,11 @@ def get_bond_information(bond, as_json=False):

bond = unidecode(bond.strip().lower())

if bond not in list(bonds['name'].str.lower()):
if bond not in list(bonds['name'].apply(unidecode).str.lower()):
raise RuntimeError("ERR#0068: bond " + bond + " not found, check if it is correct.")

name = bonds.loc[(bonds['name'].str.lower() == bond).idxmax(), 'name']
tag = bonds.loc[(bonds['name'].str.lower() == bond).idxmax(), 'tag']
name = bonds.loc[(bonds['name'].apply(unidecode).str.lower() == bond).idxmax(), 'name']
tag = bonds.loc[(bonds['name'].apply(unidecode).str.lower() == bond).idxmax(), 'tag']

url = "https://www.investing.com/rates-bonds/" + tag

Expand Down
Loading

0 comments on commit db44000

Please sign in to comment.