Skip to main content

Python wrapper for Financial Modeling Prep API

Project description

Build Status PyPI version Average time to resolve an issue Percentage of issues still open

Financial Modeling Prep Python Module

Python module to get stock data from the Financial Modeling Prep API

Install

This library requires you to have an account with Financial Modeling Prep (sign up here)

You can install the package:

  • Using pip:
pip install fmp_python
  • From the source:
git clone https://github.com/ikbale/fmp_python.git

pip install -e fmp_python

Usage

To get data from the API:

  • import the library and call the object with your API key:
from fmp_python.fmp import FMP

fmp = FMP(api_key='YOUR_API_KEY')
fmp.get_quote('AAL')
  • Or, you can store it in the environment variable FMP_API_KEY
from fmp_python.fmp import FMP

fmp = FMP(output_format='pandas', write_to_file=True)
fmp.get_quote('AAL')

You can choose which output format you want your data output_format = 'pandas' or 'json'.

'json' is the default value

You can also choose if you want the output to be stored in a file (in C:/tmp) by setting write_to_file = True

'False' is the default value

Real Time Stock Price

Reference: https://financialmodelingprep.com/developer/docs/#Company-Quote

fmp.get_quote(symbol: str)

Usage Example

fmp = FMP(output_format = 'pandas', write_to_file= True)
fmp.get_quote('AAL')

Stock Time Series

1. Stock Price

Reference: https://financialmodelingprep.com/developer/docs/#Stock-Price

fmp.get_quote_short(symbol: str)

Usage Example

fmp = FMP(output_format = 'pandas', write_to_file= True)
fmp.quote_short('AAL')

2. Stock Historical Price

Reference: https://financialmodelingprep.com/developer/docs/#Stock-Historical-Price

fmp.get_historical_chart(interval:str, symbol: str)

Usage Example

fmp = FMP(output_format = 'pandas', write_to_file= True)
fmp.get_historical_chart('5min','AAL')

Market Indexes

1. Most of the majors indexes (Dow Jones, Nasdaq, S&P 500)

Reference: https://financialmodelingprep.com/developer/docs/#Most-of-the-majors-indexes-(Dow-Jones,-Nasdaq,-S&P-500)

fmp.get_index_quote(symbol: str)

Usage Example

fmp = FMP(output_format = 'pandas', write_to_file= True)
fmp.get_index_quote('GSPC')

2. Historical stock index prices

Reference: https://financialmodelingprep.com/developer/docs/#Historical-stock-index-prices

  • By timelapse:
fmp.get_historical_chart_index(interval:str,symbol: str)

Usage Example

fmp = FMP(output_format = 'pandas', write_to_file= True)
fmp.get_historical_chart_index('5min', GSPC')
  • Daily:
fmp.get_historical_price(symbol: str)

Usage Example

fmp = FMP(output_format = 'pandas', write_to_file= True)
fmp.get_historical_price('GSPC')

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

fmp_python-0.1.5.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

fmp_python-0.1.5-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file fmp_python-0.1.5.tar.gz.

File metadata

  • Download URL: fmp_python-0.1.5.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for fmp_python-0.1.5.tar.gz
Algorithm Hash digest
SHA256 422869c5d613ad892c097ddd3fa67fa1b923cce21c03943bb3cf1522c0942574
MD5 3bb12a770151a576105f0c147ee27495
BLAKE2b-256 664d0187b4aebed1b7a4903a26b93298a35b47e84ad9f93ac078693234deb7a8

See more details on using hashes here.

File details

Details for the file fmp_python-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: fmp_python-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for fmp_python-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ccd5d8520d54f8bcf025bbc418ba76e9f0d68509f933b5518095b3629e68679b
MD5 766ecef567b9813cc3671d2c92723b1a
BLAKE2b-256 9b5ed54928f6934963f880bface74b787013521ec8975c37ba5ac829da5bed71

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