Finance Python Library GitHub

0
0
Finance Python Library GitHub

PyPI Latest Release
Package Status
License
downloads
Build Status

pyfmpcloud is a Python wrapper library for the Monetary Mannequin Prep professional API (fmpcloud.io)

Set up

Train the gear supervisor pip to arrange pyfmpcloud

pip arrange pyfmpcloud --strengthen --no-cache-dir 

Alternatively, uncover and extract the *.tar.gz folder, and crawl the subsequent narrate from the
root itemizing in your shell:

Utilization

pyfmpcloud incorporates a settings module and 4 different modules which are the core of the
pyfmpcloud API wrapper.

The following sections declare the 4 fundamental modules for pyfmpcloud and their utilization with examples.
Show that the modules are structured inside the the identical methodology because the API documentation that can be found
at fmpcloud.io API documentation. The names of the capabilities
at some point of the modules moreover advise the naming conference on this documentation. This helps with staying
constant. The 4 modules and their capabilities are as follows:

Settings

from pyfmpcloud import settings

General helper capabilities to achieve entry to and replace settings for the library environment. These are:

set_apikey: Please dwelling your API Key on this file utilizing the settings.set_apikey([YOUR KEY]). The predominant can be retrieved from fmpcloud.io by signing up. Default is the ‘demo’ key. Occasion:

settings.set_apikey('stringcontainingyourapikey')

get_apikey: Will get the at present dwelling API key. Default is demo

get_urlroot: Will get the muse API url for fmpcloud.io

get_urlrootfmp: Will get the muse API url for fmpcloud’s sister API financialmodelprep.com. Trusty to salvage nonetheless is now not at present feeble inside the wrapper.

settings.get_urlrootfmp()

Firm Valuation

from pyfmpcloud import company_valuation as cv

Right here, you salvage gotten capabilities that wrap at some point of the APIs listed in fmpcloud.io (search for fmpcloud.io API documentation) under Firm Valuation. These are:

rss_feed: This attribute returns updates for all filings of public companies, together with their submitting sort (10-Q, 13-F, and masses others.), their CIK amount, and the date and time of the submitting.

balance_sheet: This attribute returns the steadiness sheet recordsdata of the specified ticker. Inputs are: ticker, period(‘annual’ or ‘quarter’) and ftype(‘paunchy’ or ‘utter’)

Examples:

cv.balance_sheet(ticker = 'AAPL', period = 'annual', ftype = 'paunchy')
cv.balance_sheet(ticker = 'AAPL', period = 'annual', ftype = 'utter')
cv.balance_sheet(ticker = 'AAPL', period = 'quarter', ftype = 'paunchy')
cv.balance_sheet(ticker = 'AAPL', period = 'quarter', ftype = 'utter')

income_statement: This attribute returns the income assertion of the specified ticker. Inputs arguments are: ticker, period(‘annual’ or ‘quarter’) and ftype(‘paunchy’, ‘utter’)

Examples:

cv.balance_sheet(ticker = 'AAPL', period = 'annual', ftype = 'paunchy')
cv.balance_sheet(ticker = 'AAPL', period = 'annual', ftype = 'utter')
cv.balance_sheet(ticker = 'AAPL', period = 'quarter', ftype = 'paunchy')
cv.balance_sheet(ticker = 'AAPL', period = 'quarter', ftype = 'utter')

cash_flow_statement: This attribute returns the cash-wander assertion of the specified ticker. Inputs are Inputs are: ticker, period(‘annual’ or ‘quarter’) and ftype(‘paunchy’ or ‘utter’)

Examples:

cv.cash_flow_statement(ticker = 'AAPL', period = 'annual', ftype = 'paunchy')
cv.cash_flow_statement(ticker = 'AAPL', period = 'annual', ftype = 'utter')
cv.cash_flow_statement(ticker = 'AAPL', period = 'quarter', ftype = 'paunchy')
cv.cash_flow_statement(ticker = 'AAPL', period = 'quarter', ftype = 'utter')

financial_ratios: This attribute returns the financial ratios of the specified ticker. ttm can present these ratios for the trailing twelve months. Inputs arguments are: ticker, period(‘annual’ or ‘quarter’) and ttm(Trusty or Inaccurate)

Examples:

cv.financial_ratios(ticker = 'AAPL', period = 'annual', ttm = Trusty)
cv.financial_ratios(ticker = 'AAPL', period = 'annual', ttm = Inaccurate)
cv.financial_ratios(ticker = 'AAPL', period = 'quarter', ttm = Trusty)
cv.financial_ratios(ticker = 'AAPL', period = 'quarter', ttm = Inaccurate)

key_metrics : This attribute returns the predominant metrics of the specified ticker. Inputs are: ticker and period(‘annual’ or ‘quarter’)

Examples:

cv.key_metrics(ticker = 'AAPL', period = 'annual')
cv.key_metrics(ticker = 'AAPL', period = 'quarter')

enterprise_value : This attribute returns the endeavor fee of the specified ticker. Inputs are: ticker and period(‘annual’ or ‘quarter’)

Examples:

cv.enterprise_value(ticker = 'AAPL', period = 'annual')
cv.enterprise_value(ticker = 'AAPL', period = 'quarter')

financial_statements_growth : This attribute returns the financial statements utter/evolution over time of the specified ticker. Inputs are: ticker and period(‘annual’ or ‘quarter’)

Examples:

cv.financial_statements_growth(ticker = 'AAPL', period = 'annual')
cv.financial_statements_growth(ticker = 'AAPL', period = 'quarter')

dcf : This attribute returns the discounted cashflow fee of the specified ticker, over time. Inputs are: ticker and historical past(‘proper now time’, ‘every day’, ‘annual’ or ‘quarter’)

Examples:

cv.dcf(ticker = 'AAPL', historical past = 'proper now time')
cv.dcf(ticker = 'AAPL', historical past = 'every day')
cv.dcf(ticker = 'AAPL', historical past = 'annual')
cv.dcf(ticker = 'AAPL', historical past = 'quarter')

market_capitalization : This attribute returns the market capitalization of the specified ticker, over time. Inputs are: ticker and historical past(‘proper now time’, ‘every day’)

Examples:

cv.market_capitalization(ticker = 'AAPL', historical past = 'proper now time')
cv.market_capitalization(ticker = 'AAPL', historical past = 'every day')

rating: This attribute returns the rankings of the specified ticker, over time. Inputs are: ticker and historical past(‘proper now time’, ‘every day’)

Examples:

cv.rating(ticker = 'AAPL', historical past = 'proper now time')
cv.rating(ticker = 'AAPL', historical past = 'every day')

stock_screener : A attribute to indicate camouflage shares in response to market capitalization, beta, dividend payouts, buying and selling quantity and sector. Moreover talent that you simply simply can restrict the choice of rows returned from the question. The following are the arguments to look on the filter.

mcgt : lope with the wander enter for market cap greater than.
mclt : lope with the wander enter for market cap less than
bgt : lope with the wander enter for beta greater than
blt : lope with the wander enter for beta less than
divgt : lope with the wander enter for dividend greater than
divlt : lope with the wander enter for dividend less than
volgt : lope with the wander enter for volume greater than
vollt : lope with the wander enter for volume less than
sector : string enter for sector.
restrict : int enter for restrict of returned rows from the API question

Examples:

cv.stock_screener(mcgt = 1000000, mclt = 5000000, bgt = 1.2, blt = 2.1)
cv.stock_screener(mcgt = 1000000, mclt = 5000000, volgt = 500000, blt = 2.1, divgt = 1)

Inventory Time Sequence

from pyfmpcloud import stock_time_series as sts

These comprise capabilities from fmpcloud.io ‘s API for Inventory Time Sequence (search for fmpcloud.io API documentation) under Inventory Time Sequence. these are:

real_time_quote: Correct-Time Quotes for specified tickers. Enter is ticker

Occasion:

sts.real_time_quote('AAPL')

ticker_search: Partial matching of tickers in response to geared up string sing. Inputs are match, restrict and change

Examples:

sts.ticker_search(match = 'AA', restrict = 100, change = 'Nasdaq')

historical_stock_data: Historic inventory recordsdata for specified tickers in response to specified period (‘1 min’, ‘5min’, ’15min’, ’30min’ and ‘1hour’, or every day alternate sort dailytype (‘line’, ‘alternate’). period and dailytype can’t be feeble collectively. If dailytype is feeble, that you simply simply would possibly specify open and discontinuance dates on your question. Dates are a straightforward string (now not a datetime object) inside the structure yyyy-mm-dd. Alternatively, that you simply simply would possibly moreover specify a question for each day costs over the closing choice of days utilizing closing

Examples:

sts.historical_stock_data('AAPL', period = '1hour')
sts.historical_stock_data('AAPL', dailytype = 'line', open = '2019-04-15', discontinuance = '2020-04-15')
sts.historical_stock_data('AAPL', dailytype = 'alternate', open = '2019-04-15', discontinuance = '2020-04-15')
sts.historical_stock_data('AAPL', dailytype = 'alternate', closing = 30)

batch_request_eod_prices: batch question for EOD costs for a single date (if no date is specified, it will presumably maybe properly perchance return the EOD costs for the closing market discontinuance). Preferrred accepts an array of strings, even for a single ticker question. If tickers are geared up, a date should be geared up. If no ticker is supplied, it will presumably maybe properly perchance return the EOD costs for all tickers. date is a straightforward string (now not a datetime object) inside the structure yyyy-mm-dd

Examples:

sts.batch_request_eod_prices()
sts.batch_request_eod_prices(['AAPL'], date='2020-04-15')
sts.batch_request_eod_prices(date='2020-04-15')
sts.batch_request_eod_prices(['AAPL', 'FB', 'MSFT'], date='2020-04-15')

symbol_list: Guidelines of all readily available tickers.

Occasion:

company_profile: Firm profile for the specified ticker

Occasion:

sts.company_profile('AAPL')

available_markets_and_tickers: Guidelines of readily available shares on the specified market (e.g. Nasdaq), and costs of the tickers on the specified market. Inputs are markettype (‘ETF‘,’Commodities‘,’Euronext‘,’NYSE‘,’AMEX‘,’TSX‘,’Mutual Funds‘,’Index‘ or ‘Nasdaq‘) and a boolean marketprices` (Trusty or Inaccurate) to declare if costs of the tickers for the specified markettypes are sought.

Examples:

sts.available_markets_and_tickers(markettype = 'Nasdaq')
sts.available_markets_and_tickers(markettype = 'Nasdaq', marketprices = Trusty)

stock_market_performances: Overview of the market effectivity at some point of specified effectivity sort, similar to by sector, or by superb gainers. Enter is performancetype(‘lively‘,’gainers‘,’losers‘,’sector‘,’sector historic‘, ‘market hours’)

Examples:

sts.stock_market_performances(performancetype = 'lively')
sts.stock_market_performances(performancetype = 'market hours')

Foreign exchange

from pyfmpcloud import overseas change as fx

These comprise capabilities from fmpcloud.io ‘s API for Foreign exchange (search for fmpcloud.io API documentation). these are:

forex_realtime_quote: Correct-time quotes for specified fx tickers. You’d maybe maybe properly perchance question the guidelines of overseas change, their costs, or every by the fxtype (‘guidelines’, ‘imprint’, ‘every’) argument.

Examples:

fx.forex_realtime_quote(fxtype = 'guidelines')
fx.forex_realtime_quote(fxtype = 'imprint')
fx.forex_realtime_quote(fxtype = 'every')

forex_historical_data: Historic fx recordsdata for specified tickers in response to specified period (‘1 min’, ‘5min’, ’15min’, ’30min’ and ‘1hour’, or every day alternate sort dailytype (‘line’, ‘alternate’). period and dailytype can’t be feeble collectively. If dailytype is feeble, that you simply simply would possibly specify open and discontinuance dates on your question. Dates are a straightforward string (now not a datetime object) inside the structure yyyy-mm-dd. Alternatively, that you simply simply would possibly moreover specify a question for each day fx costs over the closing choice of days utilizing closing

Examples:

fx.forex_historical_data('EURUSD', period = '1hour')
fx.forex_historical_data('EURUSD', dailytype = 'line', open = '2019-04-15', discontinuance = '2020-04-15')
fx.forex_historical_data('EURUSD', dailytype = 'alternate', open = '2019-04-15', discontinuance = '2020-04-15')
fx.forex_historical_data('EURUSD', dailytype = 'alternate', closing = 30)

Crypto

from pyfmpcloud import crypto as cp

These comprise capabilities from fmpcloud.io ‘s API for Crypto (search for fmpcloud.io API documentation). These are:

crypto_realtime_quote: Correct-time quotes for specified crypto tickers. You’d maybe maybe properly perchance question the guidelines of crypto or their costs by the cryptotype (‘guidelines’, ‘imprint’) argument.

Examples:

cp.crypto_realtime_quote(cryptotype = 'guidelines')
cp.crypto_realtime_quote(cryptotype = 'imprint')

crypto_historical_data: Historic crypto recordsdata for specified tickers in response to specified period (‘1 min’, ‘5min’, ’15min’, ’30min’ and ‘1hour’, or every day alternate sort dailytype (‘line’, ‘alternate’). period and dailytype can’t be feeble collectively. If dailytype is feeble, that you simply simply would possibly specify open and discontinuance dates on your question. Dates are a straightforward string (now not a datetime object) inside the structure yyyy-mm-dd. Alternatively, that you simply simply would possibly moreover specify a question for each day fx costs over the closing choice of days utilizing closing

Examples:

cp.crypto_historical_data('BTCUSD', period = '1hour')
cp.crypto_historical_data('BTCUSD', dailytype = 'line', open = '2019-04-15', discontinuance = '2020-04-15')
cp.crypto_historical_data('BTCUSD', dailytype = 'alternate', open = '2019-04-15', discontinuance = '2020-04-15')
cp.crypto_historical_data('BTCUSD', dailytype = 'alternate', closing = 30)

13F Sorts and CUSIP

from pyfmpcloud import form_13f as ff

These comprise capabilities from fmpcloud.io ‘s API for Make 13f (search for fmpcloud.io API documentation). These are:

form_list: Guidelines of all 13F types readily available on the API. Discover: https://fmpcloud.io/documentation#thirteenFormList

Examples:

form_nametocik: Converts specified firm title to the corresponding CIK amount. Permits partial matching. Discover: https://fmpcloud.io/documentation#thirteenFormName

Examples:

ff.form_nametocik('Berskshire')

form_ciktoname: Converts the specified cik amount to corresponding firm title. Discover: https://fmpcloud.io/documentation#thirteenFormCik

Examples:

ff.form_ciktoname('1214816')

construct: Returns all related 13F types for the specified cik amount, for specified yr together with issuer title, SEC hyperlink, and masses others. Discover: https://fmpcloud.io/documentation#thirteenForm

Examples:

cusip_mapper: Returns firm/safety title for specified CUSIP amount. https://fmpcloud.io/documentation#cusipMapper

Examples:

ff.cusip_mapper('000360206')

Contributing

Pull requests are welcome. For fundamental adjustments, please open an self-discipline first to give attention to what that you simply simply would possibly esteem to alternate.

Please assure to replace assessments as related.

License

MIT

Completely completely different

Buy Me A Coffee

LEAVE A REPLY

Please enter your comment!
Please enter your name here