Skip to content

Python Invest

Python Invest Logo

Financial data extraction with Python.

The Python Invest package is based on an unofficial data extraction API from the website Investing.com. It's a package inspired by the amazing Investpy library.

This package consumes an unofficial open API and will validate the user's email before providing the data. After that, the user can consume all available services.

Python Invest its a Open Source package and Free to use, respecting the MIT License.

Requirements

✅ Python >= 3.10

🛠 Installation

  • pip
pip install python-invest
  • poetry
poetry add python-invest

📈 Usage Examples

Getting historical BTC data:

1
2
3
4
5
6
7
8
9
from python_invest import Invest

inv = Invest('youremail@email.com')

data = inv.crypto.get_historical_data(
        symbol='BTC',
        from_date='2023-01-01',
        to_date='2023-02-01'
    )

The API can send a verification link to your email, it's a security measure you won't be charged for anything. If this happens, you will receive an error similar to this:

Traceback (most recent call last):
 File "...", line 5, in <module>
    data = inv.crypto.get_historical_data(symbol='BTC', from_date='2023-01-01', to_date='2023-02-01')
    ...
PermissionError: The Scrapper API sent to your email address the verification link. Please verify your email before run the code again.

If you get this error: Just open your email box and click on the verification link.

The email would be a equal this:

Verification Email Link

After that, you can run the code:

 5
 6
 7
 8
 9
10
11
data = inv.crypto.get_historical_data(
        symbol='BTC',
        from_date='2023-01-01',
        to_date='2023-02-01'
    )

print(data)
      Price      Open      High       Low     Vol Change        Date
0  16,674.3  16,618.4  16,766.9  16,551.0  136027   0.34  2023-02-01
1  16,618.4  16,537.5  16,621.9  16,499.7  107837   0.49  2023-01-01

The default output is the Pandas DataFrame.