# InvestGo
[](https://badge.fury.io/py/investgo)
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
A Python library for fetching financial data from Investing.com, including historical stock prices, ETF holdings, and technical indicators.
## Features
- 📈 **Historical Data**: Fetch historical stock prices with automatic date range chunking
- 🏢 **Holdings Data**: Get ETF/fund holdings, asset allocation, and sector breakdowns
- 📊 **Technical Analysis**: Access pivot points, moving averages, technical indicators, and trading signals across 8 timeframes
- 🔍 **Symbol Search**: Find pair IDs by ticker symbols
- ⚡ **Concurrent Processing**: Fast data retrieval using multithreading
- 🐼 **Pandas Integration**: Returns data as pandas DataFrames for easy analysis
## Installation
```bash
pip install investgo
```
## Quick Start
```python
from investgo import get_pair_id, get_historical_prices, get_holdings
# Get pair ID for a ticker
pair_id = get_pair_id(['QQQ'])[0]
# Fetch historical data
df = get_historical_prices(pair_id, "01012021", "01012024")
print(df.head())
# Get ETF holdings
holdings = get_holdings(pair_id, "top_holdings")
print(holdings)
```
## API Reference
### Historical Data
#### `get_historical_prices(pair_id, date_from, date_to)`
Fetch historical price data for a given stock.
**Parameters:**
- `pair_id` (str): The Investing.com pair ID
- `date_from` (str): Start date in "DDMMYYYY" format
- `date_to` (str): End date in "DDMMYYYY" format
**Returns:** pandas.DataFrame with columns: price, open, high, low, vol, perc_chg
```python
# Example
data = get_historical_prices("1075", "01012023", "31122023")
```
#### `get_multiple_historical_prices(pair_ids, date_from, date_to)`
Fetch historical data for multiple stocks concurrently.
**Parameters:**
- `pair_ids` (list): List of Investing.com pair IDs
- `date_from` (str): Start date in "DDMMYYYY" format
- `date_to` (str): End date in "DDMMYYYY" format
**Returns:** pandas.DataFrame with concatenated data
### Search Functions
#### `get_pair_id(stock_ids, display_mode="first", name="no")`
Search for stock pair IDs by ticker symbols.
**Parameters:**
- `stock_ids` (str or list): Ticker symbol(s) to search
- `display_mode` (str): "first" for first match, "all" for all matches
- `name` (str): "yes" to return names along with IDs
**Returns:** List of pair IDs or DataFrame (depending on parameters)
```python
# Get pair ID for Apple
apple_id = get_pair_id('AAPL')[0]
# Get IDs and names for multiple tickers
ids, names = get_pair_id(['AAPL', 'MSFT'], name='yes')
# Get all search results
all_results = get_pair_id('AAPL', display_mode='all')
```
### Holdings Data
#### `get_holdings(pair_id, holdings_type="all")`
Get holdings and allocation data for ETFs and funds.
**Parameters:**
- `pair_id` (str): The Investing.com pair ID
- `holdings_type` (str): Type of data to retrieve:
  - `"top_holdings"`: Top holdings by weight
  - `"assets_allocation"`: Asset class breakdown (stocks, bonds, cash)
  - `"stock_sector"`: Sector allocation
  - `"stock_region"`: Geographic allocation
  - `"all"`: All holdings data types
**Returns:** pandas.DataFrame or list of DataFrames
```python
# Get top holdings for QQQ ETF
qqq_id = get_pair_id('QQQ')[0]
top_holdings = get_holdings(qqq_id, "top_holdings")
# Get asset allocation
allocation = get_holdings(qqq_id, "assets_allocation")
# Get all holdings data
all_data = get_holdings(qqq_id, "all")
```
### Technical Analysis
#### `get_technical_data(pair_id, tech_type='pivot_points', interval='daily')`
Get technical analysis data and indicators.
**Parameters:**
- `pair_id` (str): The Investing.com pair ID
- `tech_type` (str): Type of technical data:
  - `'pivot_points'`: Support and resistance levels (classic & fibonacci)
  - `'ti'`: Technical indicators
  - `'ma'`: Moving averages (simple & exponential)
  - `'summary'`: Technical summary with overall signal
- `interval` (str): Time interval:
  - `'5min'`, `'15min'`, `'30min'`: Intraday intervals
  - `'hourly'`, `'5hourly'`: Hourly intervals
  - `'daily'`, `'weekly'`, `'monthly'`: Long-term intervals
**Returns:** pandas.DataFrame with technical indicators
**Pivot Points Columns:** `level`, `classic`, `fibonacci`
**Moving Averages Columns:** `period`, `simple_ma`, `simple_signal`, `exponential_ma`, `exponential_signal`
**Technical Indicators Columns:** `indicator`, `value`, `signal`
**Summary Columns:** `type`, `signal`, `action`, `buy`, `sell`, `neutral`
```python
# Example - Daily pivot points
spy_id = get_pair_id('SPY')[0]
pivot_data = get_technical_data(spy_id, 'pivot_points', 'daily')
print(pivot_data)
#       level  classic  fibonacci
#          R3   709.80     688.57
#          R2   688.57     676.19
# Pivot Point   656.15     656.15
# Example - Weekly moving averages
weekly_ma = get_technical_data(spy_id, 'ma', 'weekly')
# Example - Technical summary
summary = get_technical_data(spy_id, 'summary', 'daily')
print(summary)
#                 type     signal     action
#              Overall Strong Buy strong_buy
#      Moving Averages Strong Buy        NaN
# Technical Indicators Strong Buy        NaN
```
## Complete Example
```python
from investgo import get_pair_id, get_historical_prices, get_holdings
import matplotlib.pyplot as plt
# Search for QQQ ETF
pair_ids = get_pair_id(['QQQ'])
qqq_id = pair_ids[0]
# Get 1 year of historical data
historical_data = get_historical_prices(qqq_id, "01012023", "31122023")
# Get top holdings
holdings = get_holdings(qqq_id, "top_holdings")
# Plot price chart
historical_data['price'].plot(title='QQQ Price History')
plt.show()
# Display top 10 holdings
print("Top 10 Holdings:")
print(holdings.head(10))
```
## Error Handling
The library uses custom exceptions for better error handling:
```python
from investgo import get_pair_id, get_historical_prices
from investgo.exceptions import InvalidParameterError, NoDataFoundError, APIError
try:
    pair_id = get_pair_id('INVALID_TICKER')[0]
    data = get_historical_prices(pair_id, "01012023", "31122023")
except NoDataFoundError as e:
    print(f"No data found: {e}")
except InvalidParameterError as e:
    print(f"Invalid parameter: {e}")
except APIError as e:
    print(f"API error: {e}")
except Exception as e:
    print(f"Unexpected error: {e}")
```
## Requirements
- Python 3.6+
- cloudscraper >= 1.2.68
- pandas >= 2.2.1
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
## Disclaimer
This library is for educational and research purposes.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
            
         
        Raw data
        
            {
    "_id": null,
    "home_page": "https://github.com/gohibiki/investgo",
    "name": "investgo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "gohibiki <gohibiki@protonmail.com>",
    "keywords": "finance, investing, stocks, etf, historical-data, financial-analysis, market-data, investing.com",
    "author": "gohibiki",
    "author_email": "gohibiki <gohibiki@protonmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d1/59/e041020c24a5ed72b875c14e5a26e9a69ec6cbeecf3f3275ae2d2371b12c/investgo-1.0.7.tar.gz",
    "platform": null,
    "description": "# InvestGo\n\n[](https://badge.fury.io/py/investgo)\n[](https://www.python.org/downloads/)\n[](https://opensource.org/licenses/MIT)\n\nA Python library for fetching financial data from Investing.com, including historical stock prices, ETF holdings, and technical indicators.\n\n## Features\n\n- \ud83d\udcc8 **Historical Data**: Fetch historical stock prices with automatic date range chunking\n- \ud83c\udfe2 **Holdings Data**: Get ETF/fund holdings, asset allocation, and sector breakdowns\n- \ud83d\udcca **Technical Analysis**: Access pivot points, moving averages, technical indicators, and trading signals across 8 timeframes\n- \ud83d\udd0d **Symbol Search**: Find pair IDs by ticker symbols\n- \u26a1 **Concurrent Processing**: Fast data retrieval using multithreading\n- \ud83d\udc3c **Pandas Integration**: Returns data as pandas DataFrames for easy analysis\n\n## Installation\n\n```bash\npip install investgo\n```\n\n## Quick Start\n\n```python\nfrom investgo import get_pair_id, get_historical_prices, get_holdings\n\n# Get pair ID for a ticker\npair_id = get_pair_id(['QQQ'])[0]\n\n# Fetch historical data\ndf = get_historical_prices(pair_id, \"01012021\", \"01012024\")\nprint(df.head())\n\n# Get ETF holdings\nholdings = get_holdings(pair_id, \"top_holdings\")\nprint(holdings)\n```\n\n## API Reference\n\n### Historical Data\n\n#### `get_historical_prices(pair_id, date_from, date_to)`\n\nFetch historical price data for a given stock.\n\n**Parameters:**\n- `pair_id` (str): The Investing.com pair ID\n- `date_from` (str): Start date in \"DDMMYYYY\" format\n- `date_to` (str): End date in \"DDMMYYYY\" format\n\n**Returns:** pandas.DataFrame with columns: price, open, high, low, vol, perc_chg\n\n```python\n# Example\ndata = get_historical_prices(\"1075\", \"01012023\", \"31122023\")\n```\n\n#### `get_multiple_historical_prices(pair_ids, date_from, date_to)`\n\nFetch historical data for multiple stocks concurrently.\n\n**Parameters:**\n- `pair_ids` (list): List of Investing.com pair IDs\n- `date_from` (str): Start date in \"DDMMYYYY\" format\n- `date_to` (str): End date in \"DDMMYYYY\" format\n\n**Returns:** pandas.DataFrame with concatenated data\n\n### Search Functions\n\n#### `get_pair_id(stock_ids, display_mode=\"first\", name=\"no\")`\n\nSearch for stock pair IDs by ticker symbols.\n\n**Parameters:**\n- `stock_ids` (str or list): Ticker symbol(s) to search\n- `display_mode` (str): \"first\" for first match, \"all\" for all matches\n- `name` (str): \"yes\" to return names along with IDs\n\n**Returns:** List of pair IDs or DataFrame (depending on parameters)\n\n```python\n# Get pair ID for Apple\napple_id = get_pair_id('AAPL')[0]\n\n# Get IDs and names for multiple tickers\nids, names = get_pair_id(['AAPL', 'MSFT'], name='yes')\n\n# Get all search results\nall_results = get_pair_id('AAPL', display_mode='all')\n```\n\n### Holdings Data\n\n#### `get_holdings(pair_id, holdings_type=\"all\")`\n\nGet holdings and allocation data for ETFs and funds.\n\n**Parameters:**\n- `pair_id` (str): The Investing.com pair ID\n- `holdings_type` (str): Type of data to retrieve:\n  - `\"top_holdings\"`: Top holdings by weight\n  - `\"assets_allocation\"`: Asset class breakdown (stocks, bonds, cash)\n  - `\"stock_sector\"`: Sector allocation\n  - `\"stock_region\"`: Geographic allocation\n  - `\"all\"`: All holdings data types\n\n**Returns:** pandas.DataFrame or list of DataFrames\n\n```python\n# Get top holdings for QQQ ETF\nqqq_id = get_pair_id('QQQ')[0]\ntop_holdings = get_holdings(qqq_id, \"top_holdings\")\n\n# Get asset allocation\nallocation = get_holdings(qqq_id, \"assets_allocation\")\n\n# Get all holdings data\nall_data = get_holdings(qqq_id, \"all\")\n```\n\n### Technical Analysis\n\n#### `get_technical_data(pair_id, tech_type='pivot_points', interval='daily')`\n\nGet technical analysis data and indicators.\n\n**Parameters:**\n- `pair_id` (str): The Investing.com pair ID\n- `tech_type` (str): Type of technical data:\n  - `'pivot_points'`: Support and resistance levels (classic & fibonacci)\n  - `'ti'`: Technical indicators\n  - `'ma'`: Moving averages (simple & exponential)\n  - `'summary'`: Technical summary with overall signal\n- `interval` (str): Time interval:\n  - `'5min'`, `'15min'`, `'30min'`: Intraday intervals\n  - `'hourly'`, `'5hourly'`: Hourly intervals\n  - `'daily'`, `'weekly'`, `'monthly'`: Long-term intervals\n\n**Returns:** pandas.DataFrame with technical indicators\n\n**Pivot Points Columns:** `level`, `classic`, `fibonacci`\n\n**Moving Averages Columns:** `period`, `simple_ma`, `simple_signal`, `exponential_ma`, `exponential_signal`\n\n**Technical Indicators Columns:** `indicator`, `value`, `signal`\n\n**Summary Columns:** `type`, `signal`, `action`, `buy`, `sell`, `neutral`\n\n```python\n# Example - Daily pivot points\nspy_id = get_pair_id('SPY')[0]\npivot_data = get_technical_data(spy_id, 'pivot_points', 'daily')\nprint(pivot_data)\n#       level  classic  fibonacci\n#          R3   709.80     688.57\n#          R2   688.57     676.19\n# Pivot Point   656.15     656.15\n\n# Example - Weekly moving averages\nweekly_ma = get_technical_data(spy_id, 'ma', 'weekly')\n\n# Example - Technical summary\nsummary = get_technical_data(spy_id, 'summary', 'daily')\nprint(summary)\n#                 type     signal     action\n#              Overall Strong Buy strong_buy\n#      Moving Averages Strong Buy        NaN\n# Technical Indicators Strong Buy        NaN\n```\n\n## Complete Example\n\n```python\nfrom investgo import get_pair_id, get_historical_prices, get_holdings\nimport matplotlib.pyplot as plt\n\n# Search for QQQ ETF\npair_ids = get_pair_id(['QQQ'])\nqqq_id = pair_ids[0]\n\n# Get 1 year of historical data\nhistorical_data = get_historical_prices(qqq_id, \"01012023\", \"31122023\")\n\n# Get top holdings\nholdings = get_holdings(qqq_id, \"top_holdings\")\n\n# Plot price chart\nhistorical_data['price'].plot(title='QQQ Price History')\nplt.show()\n\n# Display top 10 holdings\nprint(\"Top 10 Holdings:\")\nprint(holdings.head(10))\n```\n\n## Error Handling\n\nThe library uses custom exceptions for better error handling:\n\n```python\nfrom investgo import get_pair_id, get_historical_prices\nfrom investgo.exceptions import InvalidParameterError, NoDataFoundError, APIError\n\ntry:\n    pair_id = get_pair_id('INVALID_TICKER')[0]\n    data = get_historical_prices(pair_id, \"01012023\", \"31122023\")\nexcept NoDataFoundError as e:\n    print(f\"No data found: {e}\")\nexcept InvalidParameterError as e:\n    print(f\"Invalid parameter: {e}\")\nexcept APIError as e:\n    print(f\"API error: {e}\")\nexcept Exception as e:\n    print(f\"Unexpected error: {e}\")\n```\n\n## Requirements\n\n- Python 3.6+\n- cloudscraper >= 1.2.68\n- pandas >= 2.2.1\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## Disclaimer\n\nThis library is for educational and research purposes.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python library for fetching financial data from Investing.com",
    "version": "1.0.7",
    "project_urls": {
        "Bug Reports": "https://github.com/gohibiki/investgo/issues",
        "Changelog": "https://github.com/gohibiki/investgo/blob/main/CHANGELOG.md",
        "Documentation": "https://github.com/gohibiki/investgo#readme",
        "Homepage": "https://github.com/gohibiki/investgo",
        "Repository": "https://github.com/gohibiki/investgo"
    },
    "split_keywords": [
        "finance",
        " investing",
        " stocks",
        " etf",
        " historical-data",
        " financial-analysis",
        " market-data",
        " investing.com"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "63d01c304a2bebf5cddb2bd54228ef060134975ea3fcf4452a3a2fa4c90b6e8a",
                "md5": "2eca28df0b7cae398f22b647c84bf78d",
                "sha256": "dbee6d8e605957ed64c2b2e88203eb36f411bfcd278c738c79dd993f65286c18"
            },
            "downloads": -1,
            "filename": "investgo-1.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2eca28df0b7cae398f22b647c84bf78d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 16890,
            "upload_time": "2025-10-06T06:52:47",
            "upload_time_iso_8601": "2025-10-06T06:52:47.815101Z",
            "url": "https://files.pythonhosted.org/packages/63/d0/1c304a2bebf5cddb2bd54228ef060134975ea3fcf4452a3a2fa4c90b6e8a/investgo-1.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d159e041020c24a5ed72b875c14e5a26e9a69ec6cbeecf3f3275ae2d2371b12c",
                "md5": "37e8335ba08b96a896c3c70830aec294",
                "sha256": "1e8c5c25ccb956d1390393aba64fc1bb13fe6bdbc5833d91009dfeb28d518982"
            },
            "downloads": -1,
            "filename": "investgo-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "37e8335ba08b96a896c3c70830aec294",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 18194,
            "upload_time": "2025-10-06T06:52:48",
            "upload_time_iso_8601": "2025-10-06T06:52:48.624754Z",
            "url": "https://files.pythonhosted.org/packages/d1/59/e041020c24a5ed72b875c14e5a26e9a69ec6cbeecf3f3275ae2d2371b12c/investgo-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-06 06:52:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "gohibiki",
    "github_project": "investgo",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "investgo"
}