Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions fmpsdk/alternative_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import typing

from .url_methods import __return_json_v4
from .url_methods import __return_json_v4, __return_json_stable


def commitment_of_traders_report_list(
Expand All @@ -14,9 +14,9 @@ def commitment_of_traders_report_list(
:param apikey: Your API key.
:return: A list of dictionaries.
"""
path = f"commitment_of_traders_report/list"
path = f"commitment-of-traders-report/list"
query_vars = {"apikey": apikey}
return __return_json_v4(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def commitment_of_traders_report(
Expand All @@ -42,15 +42,15 @@ def commitment_of_traders_report(
:param to_date: YYYY-MM-DD string.
:return: A list of dictionaries.
"""
path = f"commitment_of_traders_report"
path = f"commitment-of-traders-report"
query_vars = {"apikey": apikey}
if symbol:
path = f"{path}/{symbol}"
if from_date:
query_vars["from"] = from_date
if to_date:
query_vars["to"] = to_date
return __return_json_v4(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def commitment_of_traders_report_analysis(
Expand Down Expand Up @@ -78,4 +78,4 @@ def commitment_of_traders_report_analysis(
query_vars["from"] = from_date
if to_date:
query_vars["to"] = to_date
return __return_json_v4(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)
6 changes: 3 additions & 3 deletions fmpsdk/bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def bulk_historical_eod(
"""
path = f"batch-historical-eod"
query_vars = {"apikey": apikey, "date": date}
return __return_json_v4(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def bulk_profiles(apikey: str, part: str) -> typing.Optional[typing.List[typing.Dict]]:
Expand Down Expand Up @@ -112,7 +112,7 @@ def scores_bulk(
logging.warning("No symbols provided for scores bulk request.")
return []

path = "scores-bulk"
path = f"scores-bulk"
query_vars = {"apikey": apikey, "symbol": ','.join(symbols)}
return __return_json_stable(path=path, query_vars=query_vars)

Expand Down Expand Up @@ -142,7 +142,7 @@ def upgrades_downgrades_consensus_bulk(
- analystsCount
And more...
"""
path = "upgrades-downgrades-consensus-bulk"
path = f"upgrades-downgrades-consensus-bulk"
query_vars = {"apikey": apikey}

if limit is not None:
Expand Down
52 changes: 26 additions & 26 deletions fmpsdk/calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@
import logging

from .settings import DEFAULT_LIMIT
from .url_methods import __return_json_v3, __return_json_v4
from .url_methods import __return_json_v3, __return_json_v4, __return_json_stable


def earning_calendar(
apikey: str, from_date: str = None, to_date: str = None
) -> typing.Optional[typing.List[typing.Dict]]:
"""
Query FMP /earning_calendar/ API.
Query FMP /earnings-calendar/ API.

Note: Between the "from" and "to" parameters the maximum time interval can be 3 months.
:param apikey: Your API key.
:param from_date: 'YYYY:MM:DD'
:param to_date: 'YYYY:MM:DD'
:param from_date: 'YYYY-MM-DD'
:param to_date: 'YYYY-MM-DD'
:return: A list of dictionaries.
"""
path = f"earning_calendar"
path = f"earnings-calendar"
query_vars = {
"apikey": apikey,
}
if from_date:
query_vars["from"] = from_date
if to_date:
query_vars["to"] = to_date
return __return_json_v3(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def historical_earning_calendar(
Expand Down Expand Up @@ -53,92 +53,92 @@ def ipo_calendar(
apikey: str, from_date: str = None, to_date: str = None
) -> typing.Optional[typing.List[typing.Dict]]:
"""
Query FMP /ipo_calendar/ API.
Query FMP /ipos-calendar/ API.

Note: Between the "from" and "to" parameters the maximum time interval can be 3 months.
:param apikey: Your API key.
:param from_date: 'YYYY:MM:DD'
:param to_date: 'YYYY:MM:DD'
:param from_date: 'YYYY-MM-DD'
:param to_date: 'YYYY-MM-DD'
:return: A list of dictionaries.
"""
path = f"ipo_calendar"
path = f"ipos-calendar"
query_vars = {
"apikey": apikey,
}
if from_date:
query_vars["from"] = from_date
if to_date:
query_vars["to"] = to_date
return __return_json_v3(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def stock_split_calendar(
apikey: str, from_date: str = None, to_date: str = None
) -> typing.Optional[typing.List[typing.Dict]]:
"""
Query FMP /stock_split_calendar/ API.
Query FMP /splits-calendar/ API.

Note: Between the "from" and "to" parameters the maximum time interval can be 3 months.
:param apikey: Your API key.
:param from_date: 'YYYY:MM:DD'
:param to_date: 'YYYY:MM:DD'
:param from_date: 'YYYY-MM-DD'
:param to_date: 'YYYY-MM-DD'
:return: A list of dictionaries.
"""
path = f"stock_split_calendar"
path = f"splits-calendar"
query_vars = {
"apikey": apikey,
}
if from_date:
query_vars["from"] = from_date
if to_date:
query_vars["to"] = to_date
return __return_json_v3(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def dividend_calendar(
apikey: str, from_date: str = None, to_date: str = None
) -> typing.Optional[typing.List[typing.Dict]]:
"""
Query FMP /stock_dividend_calendar/ API.
Query FMP /dividends-calendar/ API.

Note: Between the "from" and "to" parameters the maximum time interval can be 3 months.
:param apikey: Your API key.
:param from_date: 'YYYY:MM:DD'
:param to_date: 'YYYY:MM:DD'
:param from_date: 'YYYY-MM-DD'
:param to_date: 'YYYY-MM-DD'
:return: A list of dictionaries.
"""
path = f"stock_dividend_calendar"
path = f"dividends-calendar"
query_vars = {
"apikey": apikey,
}
if from_date:
query_vars["from"] = from_date
if to_date:
query_vars["to"] = to_date
return __return_json_v3(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def economic_calendar(
apikey: str, from_date: str = None, to_date: str = None
) -> typing.Optional[typing.List[typing.Dict]]:
"""
Query FMP /economic_calendar/ API.
Query FMP /economic-calendar/ API.

Note: Between the "from" and "to" parameters the maximum time interval can be 3 months.
:param apikey: Your API key.
:param from_date: 'YYYY:MM:DD'
:param to_date: 'YYYY:MM:DD'
:param from_date: 'YYYY-MM-DD'
:param to_date: 'YYYY-MM-DD'
:return: A list of dictionaries.
"""
path = f"economic_calendar"
path = f"economic-calendar"
query_vars = {
"apikey": apikey,
}
if from_date:
query_vars["from"] = from_date
if to_date:
query_vars["to"] = to_date
return __return_json_v3(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def earning_calendar_confirmed(
Expand Down
26 changes: 13 additions & 13 deletions fmpsdk/company_valuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def company_profile(
"""
path = f"profile/{symbol}"
query_vars = {"apikey": apikey}
return __return_json_v3(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def key_executives(
Expand All @@ -53,7 +53,7 @@ def key_executives(
"""
path = f"key-executives/{symbol}"
query_vars = {"apikey": apikey}
return __return_json_v3(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def search(
Expand All @@ -76,7 +76,7 @@ def search(
"query": query,
"exchange": exchange,
}
return __return_json_v3(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def search_ticker(
Expand All @@ -99,7 +99,7 @@ def search_ticker(
"query": query,
"exchange": exchange,
}
return __return_json_v3(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def financial_statement(
Expand Down Expand Up @@ -152,7 +152,7 @@ def income_statement(
open(filename, "wb").write(response.content)
logging.info(f"Saving {symbol} financial statement as {filename}.")
else:
return __return_json_v3(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def balance_sheet_statement(
Expand Down Expand Up @@ -868,7 +868,7 @@ def earning_call_transcript(
:param quarter: Quarter of the transcripts
:return: A list of dictionaries.
"""
path = f"earning_call_transcript/{symbol}"
path = f"earning-call-transcript/{symbol}"
query_vars = {"apikey": apikey, "year": year, "quarter": quarter}
return __return_json_v3(path=path, query_vars=query_vars)

Expand All @@ -886,7 +886,7 @@ def batch_earning_call_transcript(
"""
path = f"batch_earning_call_transcript/{symbol}"
query_vars = {"apikey": apikey, "year": year}
return __return_json_v4(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def earning_call_transcripts_available_dates(
Expand All @@ -899,9 +899,9 @@ def earning_call_transcripts_available_dates(
:param symbol: Company ticker.
:return: A list of lists.
"""
path = f"earning_call_transcript"
path = f"earning-call-transcript"
query_vars = {"apikey": apikey, "symbol": symbol}
return __return_json_v4(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def sec_filings(
Expand Down Expand Up @@ -950,7 +950,7 @@ def social_sentiments(
"""
path = f"historical/social-sentiment"
query_vars = {"apikey": apikey, "symbol": symbol, "page": page}
return __return_json_v4(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def stock_peers(apikey: str, symbol: str) -> typing.Optional[typing.List[typing.Dict]]:
Expand All @@ -960,9 +960,9 @@ def stock_peers(apikey: str, symbol: str) -> typing.Optional[typing.List[typing.
:param symbol: Company ticker
:return: A list of dictionaries
"""
path = f"stock_peers"
path = f"stock-peers"
query_vars = {"apikey": apikey, "symbol": symbol}
return __return_json_v4(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def analyst_estimates(
Expand Down Expand Up @@ -1019,7 +1019,7 @@ def upgrades_downgrades(
"apikey": apikey,
"symbol": symbol
}
return __return_json_v4(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)

def price_target(
apikey: str, symbol: str
Expand Down
8 changes: 4 additions & 4 deletions fmpsdk/institutional_fund.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import requests

from .settings import DEFAULT_LIMIT, SEC_RSS_FEEDS_FILENAME, BASE_URL_v3
from .url_methods import __return_json_v3, __return_json_v4
from .url_methods import __return_json_v3, __return_json_stable, __return_json_v4


def institutional_holders(
Expand All @@ -19,7 +19,7 @@ def institutional_holders(
"""
path = f"institutional-holder/{symbol}"
query_vars = {"apikey": apikey}
return __return_json_v3(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)


def mutual_fund_holders(
Expand Down Expand Up @@ -115,7 +115,7 @@ def cik_list(apikey: str) -> typing.Optional[typing.List[typing.Dict]]:
:param apikey: Your API key.
:return: A list of dictionaries.
"""
path = f"cik_list"
path = f"cik-list"
query_vars = {"apikey": apikey}
return __return_json_v3(path=path, query_vars=query_vars)

Expand Down Expand Up @@ -204,4 +204,4 @@ def institutional_symbol_ownership(
"includeCurrentQuarter": includeCurrentQuarter,
"limit": limit,
}
return __return_json_v4(path=path, query_vars=query_vars)
return __return_json_stable(path=path, query_vars=query_vars)
Loading