Investment research for everyone, anywhere.
Project description
CapInvest Platform
CapInvest is committed to build the future of investment research by focusing on an open source infrastructure accessible to everyone, everywhere. |
Overview
The CapInvest Platform provides a convenient way to access raw financial data from multiple data providers. The package comes with a ready to use REST API - this allows developers from any language to easily create applications on top of CapInvest Platform.
Installation
The command below provides access to the core functionalities behind the CapInvest Platform.
pip install capinvest
This will install the following data providers:
These packages are what will be installed when pip install capinvest is run
| Extension Name | Description | Installation Command | Minimum Subscription Type Required |
|---|---|---|---|
| capinvest-benzinga | Benzinga data connector | pip install capinvest-benzinga | Paid |
| capinvest-bls | Bureau of Labor Statistics data connector | pip install capinvest-bls | Free |
| capinvest-cftc | Commodity Futures Trading Commission data connector | pip install capinvest-cftc | Free |
| capinvest-econdb | EconDB data connector | pip install capinvest-econdb | None |
| capinvest-imf | IMF data connector | pip install capinvest-imf | None |
| capinvest-fmp | FMP data connector | pip install capinvest-fmp | Free |
| capinvest-fred | FRED data connector | pip install capinvest-fred | Free |
| capinvest-intrinio | Intrinio data connector | pip install capinvest-intrinio | Paid |
| capinvest-oecd | OECD data connector | pip install capinvest-oecd | Free |
| capinvest-polygon | Polygon data connector | pip install capinvest-polygon | Free |
| capinvest-sec | SEC data connector | pip install capinvest-sec | None |
| capinvest-tiingo | Tiingo data connector | pip install capinvest-tiingo | Free |
| capinvest-tradingeconomics | TradingEconomics data connector | pip install capinvest-tradingeconomics | Paid |
| capinvest-yfinance | Yahoo Finance data connector | pip install capinvest-yfinance | None |
Community Providers
These packages are not installed when pip install capinvest is run. They are available for installation separately or by running pip install capinvest[all]
| Extension Name | Description | Installation Command | Minimum Subscription Type Required |
|---|---|---|---|
| capinvest-alpha-vantage | Alpha Vantage data connector | pip install capinvest-alpha-vantage | Free |
| capinvest-biztoc | Biztoc News data connector | pip install capinvest-biztoc | Free |
| capinvest-cboe | Cboe data connector | pip install capinvest-cboe | None |
| capinvest-ecb | ECB data connector | pip install capinvest-ecb | None |
| capinvest-federal-reserve | Federal Reserve data connector | pip install capinvest-federal-reserve | None |
| capinvest-finra | FINRA data connector | pip install capinvest-finra | None / Free |
| capinvest-finviz | Finviz data connector | pip install capinvest-finviz | None |
| capinvest-government-us | US Government data connector | pip install capinvest-us-government | None |
| capinvest-nasdaq | Nasdaq Data Link connector | pip install capinvest-nasdaq | None / Free |
| capinvest-seeking-alpha | Seeking Alpha data connector | pip install capinvest-seeking-alpha | None |
| capinvest-stockgrid | Stockgrid data connector | pip install capinvest-stockgrid | None |
| capinvest-tmx | TMX data connector | pip install capinvest-tmx | None |
| capinvest-tradier | Tradier data connector | pip install capinvest-tradier | None |
| capinvest-wsj | Wall Street Journal data connector | pip install capinvest-wsj | None |
To install extensions that expand the core functionalities specify the extension name or use all to install all. |
# Install a single extension, e.g. capinvest-charting and yahoo finance
pip install capinvest[charting]
pip install capinvest-yfinance
Alternatively, you can install all extensions at once.
pip install capinvest[all]
Python
>>> from capinvest import obb
>>> output = obb.equity.price.historical("AAPL")
>>> df = output.to_dataframe()
>>> df.head()
open high low ... change_percent label change_over_time
date ...
2022-09-19 149.31 154.56 149.10 ... 3.46000 September 19, 22 0.034600
2022-09-20 153.40 158.08 153.08 ... 2.28000 September 20, 22 0.022800
2022-09-21 157.34 158.74 153.60 ... -2.30000 September 21, 22 -0.023000
2022-09-22 152.38 154.47 150.91 ... 0.23625 September 22, 22 0.002363
2022-09-23 151.19 151.47 148.56 ... -0.50268 September 23, 22 -0.005027
[5 rows x 12 columns]
API keys
To fully leverage the capinvest Platform you need to get some API keys to connect with data providers.
Runtime
>>> from capinvest import obb
>>> obb.user.credentials.fmp_api_key = "REPLACE_ME"
>>> obb.user.credentials.polygon_api_key = "REPLACE_ME"
>>> # Persist changes in ~/.capinvest_platform/user_settings.json
>>> obb.account.save()
Local file
You can specify the keys directly in the ~/.capinvest/user_settings.json file.
Populate this file with the following template and replace the values with your keys:
{
"credentials": {
"fmp_api_key": "REPLACE_ME",
"polygon_api_key": "REPLACE_ME",
"benzinga_api_key": "REPLACE_ME",
"fred_api_key": "REPLACE_ME"
}
}
REST API
The capinvest Platform comes with a ready to use REST API built with FastAPI. Start the application using this command:
uvicorn capinvest_core.api.rest_api:app --host 0.0.0.0 --port 8000 --reload
API documentation is found under "/docs", from the root of the server address, and is viewable in any browser supporting HTTP over localhost, such as Chrome.
Check capinvest-core README for additional info.
Install for development
To develop the capinvest Platform you need to have the following:
- Git
- Python 3.9 or higher
- Virtual Environment with
poetryinstalled- To install these packages activate your virtual environment and run
pip install poetry toml
- To install these packages activate your virtual environment and run
How to install the platform in editable mode?
- Activate your virtual environment
- Navigate into the
capinvest_platformfolder - Run
python dev_install.pyto install the packages in editable mode
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file capinvest-1.0.3.tar.gz.
File metadata
- Download URL: capinvest-1.0.3.tar.gz
- Upload date:
- Size: 187.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.11.4 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52ce6232f4a2ef8f4416a4827734b863e144249fd0c22b0db462c376f321073d
|
|
| MD5 |
4821d9f772deebba4ccbc39e93ec34fc
|
|
| BLAKE2b-256 |
6baecfa306b8b21cc9671a87fffd27d4c64c812099893760b88e8a14e45b2659
|
File details
Details for the file capinvest-1.0.3-py3-none-any.whl.
File metadata
- Download URL: capinvest-1.0.3-py3-none-any.whl
- Upload date:
- Size: 195.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.11.4 Windows/10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7700d339bfb883265e68eed540e1d5e0c3407ac764f4bafcd5044558ab4c6621
|
|
| MD5 |
7114f74a0f0028eb2983f80bae9a42bd
|
|
| BLAKE2b-256 |
feee5c549b12bb49573394689b800cc345580d3cb0ffbfe0ec9252bc974d03b0
|