Skip to main content

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 poetry installed
    • To install these packages activate your virtual environment and run pip install poetry toml

How to install the platform in editable mode?

  1. Activate your virtual environment
  2. Navigate into the capinvest_platform folder
  3. Run python dev_install.py to install the packages in editable mode

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

capinvest-1.0.2.tar.gz (201.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

capinvest-1.0.2-py3-none-any.whl (208.6 kB view details)

Uploaded Python 3

File details

Details for the file capinvest-1.0.2.tar.gz.

File metadata

  • Download URL: capinvest-1.0.2.tar.gz
  • Upload date:
  • Size: 201.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.4 Windows/10

File hashes

Hashes for capinvest-1.0.2.tar.gz
Algorithm Hash digest
SHA256 26c24befad5f673feb6f4f87d6b1f9636f7a8be431fca82703f1147ec44dc16f
MD5 1459aa569bd00b6cafbb3428a0c37c15
BLAKE2b-256 c09eac585ba512f1cf688bb548df38faefd64d4f50efd76d16b144ce99e7d413

See more details on using hashes here.

File details

Details for the file capinvest-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: capinvest-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 208.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.11.4 Windows/10

File hashes

Hashes for capinvest-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7fa2709d8d1750716a2257262c0ae970b69206ee7506eab1853fcd2d4d0fd841
MD5 a3eb3086a2045ce5158c37ef4e16b090
BLAKE2b-256 bd77c2920adc4ec20589af597e5ff00b68f1cab1da44905fbbae4a9fc5c90993

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page