Skip to main content

A python wrapper for the Financial Modeling Prep API

Project description

fmpy

A python wrapper for the Financial Modeling Prep (FMP) API (unofficial). This package focus on providing a simple and powerful interface for the FMP API.

For more information on subscription plans and obtaining an API key, please visit the FMP website.

Installation


Install fmpy using the pip command:

$ pip install fmpy_qi

Usage


To begin, you need to create an FmpClient object by passing your API key (provided by FMP) as parameter:

from fmpy.client import FmpClient

client = FmpClient(api_key="YOU_API_KEY")

Note that fmpy allow you have to store your API key in as an environment variable under the name FMP_API_KEY (in that case no need to provide the api_key parameter for the FmpClient instantiation)

FmpClient can be initialised with other parameters:

rate_limit: number of call per minute tolerance (300 by default). This allow to not exceed the rate limit
timeout: number of seconds to wait a request before raising a timeout (5 by default)
request_retry: number of request retries before abording (5 by default)

Here is an example:

from fmpy.client import FmpClient

client = FmpClient(api_key="YOU_API_KEY", rate_limit=750, timeout=20, request_retry=1)
# Will not make more than 750 requests per minute, 
# with 20s of timeout and a potential request retry limited to 1

Historical data

from fmpy.client import FmpClient

client = FmpClient(api_key="YOU_API_KEY")
hist_data = client.get_historical_data('TSLA', period='1h', start='2020-01-02 10:00:00', end='2022-06-25 15:00:00')
# Retreive historical 1h candles for Tesla stock between 2020-01-02 10:00:00 and 2022-06-25 15:00:00
# start and end support both "%Y-%m-%d %H:%M:%S" and "%Y-%m-%d" time formats

Licence


© 2023 Nicolas Thiery

This repository is licensed under the MIT license See LICENSE for details.

Please note that this package is not endorsed, supported, or affiliated with FMP. We do not have any formal relationship with FMP, nor do we receive any financial compensation for developing or distributing this package.

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

fmpy_qi-0.1.7.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

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

fmpy_qi-0.1.7-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file fmpy_qi-0.1.7.tar.gz.

File metadata

  • Download URL: fmpy_qi-0.1.7.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for fmpy_qi-0.1.7.tar.gz
Algorithm Hash digest
SHA256 0bd5195826005b388c024847bdd91906dd68a576c194480aed31dbe588da6bf6
MD5 827f6e957087fe30367a2450456b4661
BLAKE2b-256 173b01b5f7f397783543dbe7a55bf2b846921f586d8325743b54724d8b03de4f

See more details on using hashes here.

File details

Details for the file fmpy_qi-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: fmpy_qi-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for fmpy_qi-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 cd2db2ac14bdce2592fb77820a0f2f5f3cedfa6f06cd7d387c5e1ec1d23eb884
MD5 94e40b158223548670d315149c3b40ba
BLAKE2b-256 f670716ebe6985a1c07d7e172ae16c0b9e7cfdf7e24301c401d521d251474bef

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