# 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 technical indicators and pivot points
- 🔍 **Symbol Search**: Find stock 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 stock ID for a ticker
stock_id = get_pair_id(['QQQ'])[0]
# Fetch historical data
df = get_historical_prices(stock_id, "01012021", "01012024")
print(df.head())
# Get ETF holdings
holdings = get_holdings(stock_id, "top_holdings")
print(holdings)
```
## API Reference
### Historical Data
#### `get_historical_prices(stock_id, date_from, date_to)`
Fetch historical price data for a given stock.
**Parameters:**
- `stock_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(stock_ids, date_from, date_to)`
Fetch historical data for multiple stocks concurrently.
**Parameters:**
- `stock_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(tech_type='pivot_points', interval='5min')`
Get technical analysis data and indicators.
**Parameters:**
- `tech_type` (str): Type of technical data ('pivot_points', 'ti', 'ma')
- `interval` (str): Time interval ('5min', '15min', 'hourly', 'daily')
**Returns:** pandas.DataFrame with technical indicators
## Complete Example
```python
from investgo import get_pair_id, get_historical_prices, get_holdings
import matplotlib.pyplot as plt
# Search for QQQ ETF
stock_ids = get_pair_id(['QQQ'])
qqq_id = stock_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 includes basic error handling, but you should wrap calls in try-except blocks for production use:
```python
try:
stock_id = get_pair_id('INVALID_TICKER')[0]
data = get_historical_prices(stock_id, "01012023", "31122023")
except ValueError as e:
print(f"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. Please respect Investing.com's terms of service and rate limits when using this library.
## 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/0a/8a/94021b9529536b10f2edb5b798e8f92d6123324d244eac49aee4f85526fc/investgo-1.0.4.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 technical indicators and pivot points\n- \ud83d\udd0d **Symbol Search**: Find stock 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 stock ID for a ticker\nstock_id = get_pair_id(['QQQ'])[0]\n\n# Fetch historical data\ndf = get_historical_prices(stock_id, \"01012021\", \"01012024\")\nprint(df.head())\n\n# Get ETF holdings\nholdings = get_holdings(stock_id, \"top_holdings\")\nprint(holdings)\n```\n\n## API Reference\n\n### Historical Data\n\n#### `get_historical_prices(stock_id, date_from, date_to)`\n\nFetch historical price data for a given stock.\n\n**Parameters:**\n- `stock_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(stock_ids, date_from, date_to)`\n\nFetch historical data for multiple stocks concurrently.\n\n**Parameters:**\n- `stock_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(tech_type='pivot_points', interval='5min')`\n\nGet technical analysis data and indicators.\n\n**Parameters:**\n- `tech_type` (str): Type of technical data ('pivot_points', 'ti', 'ma')\n- `interval` (str): Time interval ('5min', '15min', 'hourly', 'daily')\n\n**Returns:** pandas.DataFrame with technical indicators\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\nstock_ids = get_pair_id(['QQQ'])\nqqq_id = stock_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 includes basic error handling, but you should wrap calls in try-except blocks for production use:\n\n```python\ntry:\n stock_id = get_pair_id('INVALID_TICKER')[0]\n data = get_historical_prices(stock_id, \"01012023\", \"31122023\")\nexcept ValueError as e:\n print(f\"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. Please respect Investing.com's terms of service and rate limits when using this library.\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.4",
"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": "886d3f6cfa7ff40e3bfe4a203ed199a7a625b13df03fb7c8686bbbe1b0b2cb6e",
"md5": "0cc1b0bdbfaad7c71abf73b35d1c1189",
"sha256": "3326ebb2a314ef55cb008935c8dc9f62a39cf1c8ba6ffa8fa563fc84a212f2bd"
},
"downloads": -1,
"filename": "investgo-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0cc1b0bdbfaad7c71abf73b35d1c1189",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 16070,
"upload_time": "2025-09-03T04:09:03",
"upload_time_iso_8601": "2025-09-03T04:09:03.986061Z",
"url": "https://files.pythonhosted.org/packages/88/6d/3f6cfa7ff40e3bfe4a203ed199a7a625b13df03fb7c8686bbbe1b0b2cb6e/investgo-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "0a8a94021b9529536b10f2edb5b798e8f92d6123324d244eac49aee4f85526fc",
"md5": "edfcb25775c2cf806b6ab1bc38cb65e5",
"sha256": "a47bc0fc1d6598d54d8c193a91fe774ee0da52e57665b3141dfb395e76c1c16b"
},
"downloads": -1,
"filename": "investgo-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "edfcb25775c2cf806b6ab1bc38cb65e5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 16990,
"upload_time": "2025-09-03T04:09:04",
"upload_time_iso_8601": "2025-09-03T04:09:04.841956Z",
"url": "https://files.pythonhosted.org/packages/0a/8a/94021b9529536b10f2edb5b798e8f92d6123324d244eac49aee4f85526fc/investgo-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-03 04:09:04",
"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"
}