Fix incorrect date typing in signatures (#3524)

* Report fixes

* replace wrong typing

* mypy

* mypy again

Co-authored-by: james <jmaslek11@gmail.com>
This commit is contained in:
montezdesousa
2022-11-22 22:15:40 +00:00
committed by GitHub
parent fb42272c81
commit bfc4c021e7
35 changed files with 162 additions and 154 deletions

View File

@@ -1,7 +1,7 @@
"""SentimentInvestor Model"""
__docformat__ = "numpy"
from typing import Union, Dict
from typing import Union, Dict, Optional
from datetime import datetime, timedelta
import logging
@@ -19,8 +19,8 @@ logger = logging.getLogger(__name__)
@check_api_key(["API_SENTIMENTINVESTOR_TOKEN"])
def get_historical(
symbol: str,
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
number: int = 100,
) -> pd.DataFrame:
"""Get hour-level sentiment data for the chosen symbol.
@@ -31,9 +31,9 @@ def get_historical(
----------
symbol: str
Ticker to view sentiment data
start_date: str
start_date: Optional[str]
Initial date like string or unix timestamp (e.g. 12-21-2021)
end_date: str
end_date: Optional[str]
End date like string or unix timestamp (e.g. 12-21-2021)
number : int
Number of results returned by API call
@@ -134,7 +134,7 @@ def check_supported_ticker(symbol: str) -> bool:
@check_api_key(["API_SENTIMENTINVESTOR_TOKEN"])
def get_trending(
start_date: str = None,
start_date: Optional[str] = None,
hour: int = 0,
number: int = 10,
) -> pd.DataFrame:
@@ -143,7 +143,7 @@ def get_trending(
Parameters
----------
start_date : str
start_date : Optional[str]
Initial date, format YYYY-MM-DD
hour: int
Hour of the day in 24-hour notation (e.g. 14)

View File

@@ -30,8 +30,8 @@ logger = logging.getLogger(__name__)
@check_api_key(["API_SENTIMENTINVESTOR_TOKEN"])
def display_historical(
symbol: str,
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
number: int = 100,
raw: bool = False,
limit: int = 10,
@@ -45,9 +45,9 @@ def display_historical(
----------
symbol: str
Ticker symbol to view sentiment data
start_date: str
start_date: Optional[str]
Initial date like string or unix timestamp (e.g. 2021-12-21)
end_date: str
end_date: Optional[str]
End date like string or unix timestamp (e.g. 2022-01-15)
number: int
Number of results returned by API call
@@ -150,7 +150,7 @@ def display_historical(
@log_start_end(log=logger)
@check_api_key(["API_SENTIMENTINVESTOR_TOKEN"])
def display_trending(
start_date: str = None,
start_date: Optional[str] = None,
hour: int = 0,
number: int = 10,
limit: int = 10,
@@ -161,7 +161,7 @@ def display_trending(
Parameters
----------
start_date : str
start_date : Optional[str]
Initial date, format YYYY-MM-DD
hour: int
Hour of the day in 24-hour notation (e.g. 14)

View File

@@ -4,7 +4,7 @@ __docformat__ = "numpy"
import logging
from datetime import datetime, timedelta
from typing import Any, List, Tuple
from typing import Any, List, Optional, Tuple
import requests
import pandas as pd
from openbb_terminal import config_terminal as cfg
@@ -19,7 +19,7 @@ logger = logging.getLogger(__name__)
def get_news(
query: str,
limit: int = 10,
start_date: str = None,
start_date: Optional[str] = None,
show_newest: bool = True,
sources: str = "",
) -> List[Tuple[pd.DataFrame, Any]]:
@@ -29,7 +29,7 @@ def get_news(
----------
query : str
term to search on the news articles
start_date: str
start_date: Optional[str]
date to start searching articles from formatted YYYY-MM-DD
show_newest: bool
flag to show newest articles first

View File

@@ -3,6 +3,7 @@ __docformat__ = "numpy"
import os
import logging
from typing import Optional
import pandas as pd
@@ -20,7 +21,7 @@ logger = logging.getLogger(__name__)
def display_news(
query: str,
limit: int = 3,
start_date: str = None,
start_date: Optional[str] = None,
show_newest: bool = True,
sources: str = "",
export: str = "",
@@ -31,7 +32,7 @@ def display_news(
----------
query : str
term to search on the news articles
start_date: str
start_date: Optional[str]
date to start searching articles from formatted YYYY-MM-DD
limit : int
number of articles to display

View File

@@ -121,8 +121,8 @@ def view_ma(
def view_vwap(
data: pd.DataFrame,
symbol: str = "",
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
offset: int = 0,
interval: str = "",
export: str = "",
@@ -138,10 +138,10 @@ def view_vwap(
Ticker
offset : int
Offset variable
start_date: datetime
Start date to get data from with
end_date: datetime
End date to get data from with
start_date: Optional[str]
Initial date, format YYYY-MM-DD
end_date: Optional[str]
Final date, format YYYY-MM-DD
interval : str
Interval of data
export : str

View File

@@ -182,7 +182,7 @@ INTERVALS_ACTIVE_ADDRESSES = ["24h", "1w", "1month"]
def get_close_price(
symbol: str,
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
print_errors: bool = True,
) -> pd.DataFrame:
"""Returns the price of a cryptocurrency
@@ -250,7 +250,7 @@ def get_close_price(
def get_non_zero_addresses(
symbol: str,
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
) -> pd.DataFrame:
"""Returns addresses with non-zero balance of a certain symbol
[Source: https://glassnode.com]
@@ -313,7 +313,7 @@ def get_active_addresses(
symbol: str,
interval: str = "24h",
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
) -> pd.DataFrame:
"""Returns active addresses of a certain symbol
[Source: https://glassnode.com]
@@ -377,7 +377,7 @@ def get_hashrate(
symbol: str,
interval: str = "24h",
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
) -> pd.DataFrame:
"""Returns dataframe with mean hashrate of btc or eth blockchain and symbol price
[Source: https://glassnode.com]
@@ -557,7 +557,7 @@ def get_exchange_net_position_change(
symbol: str,
exchange: str = "binance",
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
) -> pd.DataFrame:
"""Returns 30d change of the supply held in exchange wallets of a certain symbol.
[Source: https://glassnode.com]
@@ -568,9 +568,9 @@ def get_exchange_net_position_change(
Asset symbol to search supply (e.g., BTC)
exchange : str
Exchange to check net position change (e.g., binance)
start_date : str
start_date : Optional[str]
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
Returns

View File

@@ -33,7 +33,7 @@ logger = logging.getLogger(__name__)
def display_active_addresses(
symbol: str,
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
interval: str = "24h",
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
@@ -47,7 +47,7 @@ def display_active_addresses(
Asset to search active addresses (e.g., BTC)
start_date : str
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
interval : str
Interval frequency (possible values are: 24h, 1w, 1month)
@@ -97,7 +97,7 @@ def display_active_addresses(
def display_non_zero_addresses(
symbol: str,
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
) -> None:
@@ -110,7 +110,7 @@ def display_non_zero_addresses(
Asset to search (e.g., BTC)
start_date : str
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
export : str
Export dataframe data to csv,json,xlsx file
@@ -159,7 +159,7 @@ def display_exchange_net_position_change(
symbol: str,
exchange: str = "binance",
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
) -> None:
@@ -176,7 +176,7 @@ def display_exchange_net_position_change(
hitbtc, kraken, okex, bithumb, zb.com, cobinhood, bitmex, bitstamp, coinbase, coincheck, luno)
start_date : str
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
export : str
Export dataframe data to csv,json,xlsx file
@@ -321,7 +321,7 @@ def display_exchange_balances(
def display_hashrate(
symbol: str,
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
interval: str = "24h",
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
@@ -335,7 +335,7 @@ def display_hashrate(
Blockchain to check mean hashrate (BTC or ETH)
start_date : str
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
interval : str
Interval frequency (possible values are: 24, 1w, 1month)

View File

@@ -4,7 +4,7 @@ __docformat__ = "numpy"
# pylint: disable=C0301,C0302
import logging
from typing import Any, Tuple
from typing import Any, Optional, Tuple
from datetime import datetime, timedelta
import re
import pandas as pd
@@ -81,8 +81,8 @@ base_url2 = "https://data.messari.io/api/v2/"
def get_marketcap_dominance(
symbol: str,
interval: str = "1d",
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
) -> pd.DataFrame:
"""Returns market dominance of a coin over time
[Source: https://messari.io/]
@@ -93,9 +93,9 @@ def get_marketcap_dominance(
Crypto symbol to check market cap dominance
interval : str
Interval frequency (possible values are: 5m, 15m, 30m, 1h, 1d, 1w)
start_date : int
start_date : Optional[str]
Initial date like string (e.g., 2021-10-01)
end_date : int
end_date : Optional[str]
End date like string (e.g., 2021-10-01)
Returns
@@ -126,8 +126,8 @@ def get_messari_timeseries(
symbol: str,
timeseries_id: str,
interval: str = "1d",
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
) -> Tuple[pd.DataFrame, str]:
"""Returns messari timeseries
[Source: https://messari.io/]
@@ -140,9 +140,9 @@ def get_messari_timeseries(
Messari timeserie id
interval : str
Interval frequency (possible values are: 5m, 15m, 30m, 1h, 1d, 1w)
start : int
start : Optional[str]
Initial date like string (e.g., 2021-10-01)
end : int
end : Optional[str]
End date like string (e.g., 2021-10-01)
Returns

View File

@@ -104,8 +104,8 @@ def display_messari_timeseries_list(
def display_messari_timeseries(
symbol: str,
timeseries_id: str,
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
interval: str = "1d",
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
@@ -119,9 +119,9 @@ def display_messari_timeseries(
Crypto symbol to check market cap dominance
timeseries_id: str
Obtained by api.crypto.dd.get_mt command
start_date : int
start_date : Optional[str]
Initial date like string (e.g., 2021-10-01)
end_date : int
end_date : Optional[str]
End date like string (e.g., 2021-10-01)
interval : str
Interval frequency (possible values are: 5m, 15m, 30m, 1h, 1d, 1w)
@@ -181,8 +181,8 @@ def display_messari_timeseries(
@check_api_key(["API_MESSARI_KEY"])
def display_marketcap_dominance(
symbol: str,
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
interval: str = "1d",
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
@@ -194,9 +194,9 @@ def display_marketcap_dominance(
----------
symbol : str
Crypto symbol to check market cap dominance
start_date : int
start_date : Optional[str]
Initial date like string (e.g., 2021-10-01)
end_date : int
end_date : Optional[str]
End date like string (e.g., 2021-10-01)
interval : str
Interval frequency (possible values are: 5m, 15m, 30m, 1h, 1d, 1w)

View File

@@ -1,5 +1,6 @@
import logging
from datetime import datetime, timedelta
from typing import Optional
import requests
@@ -30,8 +31,8 @@ def get_github_activity(
symbol: str,
dev_activity: bool = False,
interval: str = "1d",
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
) -> pd.DataFrame:
"""Returns a list of developer activity for a given coin and time interval.
@@ -45,9 +46,9 @@ def get_github_activity(
Whether to filter only for development activity
interval : str
Interval frequency (e.g., 1d)
start_date : int
start_date : Optional[str]
Initial date like string (e.g., 2021-10-01)
end_date : int
end_date : Optional[str]
End date like string (e.g., 2021-10-01)
Returns

View File

@@ -25,9 +25,9 @@ logger = logging.getLogger(__name__)
@check_api_key(["API_SANTIMENT_KEY"])
def display_github_activity(
symbol: str,
start_date: str = None,
start_date: Optional[str] = None,
dev_activity: bool = False,
end_date: str = None,
end_date: Optional[str] = None,
interval: str = "1d",
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
@@ -42,9 +42,9 @@ def display_github_activity(
Crypto symbol to check github activity
dev_activity: bool
Whether to filter only for development activity
start_date : int
start_date : Optional[str]
Initial date like string (e.g., 2021-10-01)
end_date : int
end_date : Optional[str]
End date like string (e.g., 2021-10-01)
interval : str
Interval frequency (some possible values are: 1h, 1d, 1w)

View File

@@ -27,7 +27,7 @@ logger = logging.getLogger(__name__)
@log_start_end(log=logger)
def display_btc_circulating_supply(
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
) -> None:
@@ -37,7 +37,7 @@ def display_btc_circulating_supply(
----------
start_date : str
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
export : str
Export dataframe data to csv,json,xlsx file
@@ -87,7 +87,7 @@ def display_btc_circulating_supply(
@log_start_end(log=logger)
def display_btc_confirmed_transactions(
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
) -> None:
@@ -97,7 +97,7 @@ def display_btc_confirmed_transactions(
----------
start_date : str
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
export : str
Export dataframe data to csv,json,xlsx file

View File

@@ -2,6 +2,7 @@
import json
import logging
from datetime import datetime
from typing import Optional
import pandas as pd
import requests
@@ -19,7 +20,7 @@ DAYS = [30, 90, 365]
def get_altcoin_index(
period: int = 30,
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
) -> pd.DataFrame:
"""Get altcoin index overtime
[Source: https://blockchaincenter.net]
@@ -32,7 +33,7 @@ def get_altcoin_index(
30 will check monthly performance (30 days).
start_date : str
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
Returns

View File

@@ -27,7 +27,7 @@ logger = logging.getLogger(__name__)
def display_altcoin_index(
period: int = 365,
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
) -> None:
@@ -38,7 +38,7 @@ def display_altcoin_index(
----------
start_date : str
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
period: int
Number of days to check the performance of coins and calculate the altcoin index.

View File

@@ -1,5 +1,6 @@
from datetime import datetime
import logging
from typing import Optional
from pandas import DataFrame
from openbb_terminal.decorators import log_start_end
@@ -17,7 +18,7 @@ api_url = "https://api.glassnode.com/v1/metrics/"
@log_start_end(log=logger)
def get_btc_rainbow(
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
) -> DataFrame:
"""Get bitcoin price data
[Price data from source: https://glassnode.com]
@@ -27,7 +28,7 @@ def get_btc_rainbow(
----------
start_date : str
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
Returns

View File

@@ -29,7 +29,7 @@ logger = logging.getLogger(__name__)
@check_api_key(["API_GLASSNODE_KEY"])
def display_btc_rainbow(
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
):
@@ -41,7 +41,7 @@ def display_btc_rainbow(
----------
start_date : str
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
export : str
Export dataframe data to csv,json,xlsx file

View File

@@ -4,7 +4,7 @@ __docformat__ = "numpy"
# pylint: disable=no-member
import logging
from typing import Dict, Any, Tuple, Union
from typing import Dict, Any, Optional, Tuple, Union
from urllib.error import HTTPError
from datetime import datetime
@@ -483,8 +483,8 @@ def get_macro_data(
parameter: str,
country: str,
transform: str = "",
start_date=None,
end_date=None,
start_date: str = "1900-01-01",
end_date: Optional[str] = None,
symbol: str = "",
) -> Tuple[pd.Series, Union[str, Any]]:
"""Query the EconDB database to find specific macro data about a company [Source: EconDB]
@@ -505,7 +505,7 @@ def get_macro_data(
'TNOR' - Start = 100
start_date : str
The starting date, format "YEAR-MONTH-DAY", i.e. 2010-12-31.
end_date : str
end_date : Optional[str]
The end date, format "YEAR-MONTH-DAY", i.e. 2020-06-05.
symbol : str
In what currency you wish to convert all values.
@@ -517,11 +517,8 @@ def get_macro_data(
The units of the macro data, e.g. 'Bbl/day" for oil.
"""
if start_date is None:
start_date = pd.to_datetime("1900-01-01")
if end_date is None:
end_date = datetime.today().date()
end_date = datetime.today().strftime("%Y-%m-%d")
df, units = pd.DataFrame(), ""
country = country.replace("_", " ")
@@ -572,7 +569,9 @@ def get_macro_data(
if start_date or end_date:
try:
df = df.loc[start_date:end_date]
dt_start = pd.to_datetime(start_date)
dt_end = pd.to_datetime(end_date)
df = df.loc[dt_start:dt_end]
except TypeError:
console.print("[red]Invalid date sent. Format as YYYY-MM-DD[/red]\n")
return pd.DataFrame(), "NA/NA"
@@ -658,7 +657,7 @@ def get_aggregated_macro_data(
countries: list = None,
transform: str = "",
start_date: str = "1900-01-01",
end_date: str = None,
end_date: Optional[str] = None,
symbol: str = "",
) -> Tuple[pd.DataFrame, Dict[Any, Dict[Any, Any]], str]:
"""This functions groups the data queried from the EconDB database [Source: EconDB]
@@ -673,7 +672,7 @@ def get_aggregated_macro_data(
The selected transform. Available transforms can be accessed through get_macro_transform().
start_date : str
The starting date, format "YEAR-MONTH-DAY", i.e. 2010-12-31.
end_date : str
end_date : Optional[str]
The end date, format "YEAR-MONTH-DAY", i.e. 2020-06-05.
symbol : str
In what currency you wish to convert all values.
@@ -739,7 +738,7 @@ def get_treasuries(
maturities: list = None,
frequency: str = "monthly",
start_date: str = "1900-01-01",
end_date: str = None,
end_date: Optional[str] = None,
) -> pd.DataFrame:
"""Get U.S. Treasury rates [Source: EconDB]
@@ -754,7 +753,7 @@ def get_treasuries(
Frequency of the data, this can be annually, monthly, weekly or daily.
start_date : str
Starting date, format "YEAR-MONTH-DAY", i.e. 2010-12-31.
end_date : str
end_date : Optional[str]
End date, format "YEAR-MONTH-DAY", i.e. 2020-06-05.
Returns

View File

@@ -27,7 +27,7 @@ def show_macro_data(
countries: list = None,
transform: str = "",
start_date: str = "1900-01-01",
end_date: str = None,
end_date: Optional[str] = None,
symbol: str = "",
raw: bool = False,
external_axes: Optional[List[plt.axes]] = None,
@@ -51,7 +51,7 @@ def show_macro_data(
'TNOR' - Start = 100
start_date : str
The starting date, format "YEAR-MONTH-DAY", i.e. 2010-12-31.
end_date : str
end_date : Optional[str]
The end date, format "YEAR-MONTH-DAY", i.e. 2020-06-05.
symbol : str
In what currency you wish to convert all values.
@@ -147,7 +147,7 @@ def show_treasuries(
maturities: list = None,
frequency: str = "monthly",
start_date: str = "1900-01-01",
end_date: str = None,
end_date: Optional[str] = None,
raw: bool = False,
external_axes: Optional[List[plt.axes]] = None,
export: str = "",
@@ -165,7 +165,7 @@ def show_treasuries(
Frequency of the data, this can be daily, weekly, monthly or annually
start_date : str
Starting date, format "YEAR-MONTH-DAY", i.e. 2010-12-31.
end_date : str
end_date : Optional[str]
End date, format "YEAR-MONTH-DAY", i.e. 2020-06-05.
raw : bool
Whether to display the raw output.

View File

@@ -4,7 +4,7 @@ __docformat__ = "numpy"
import os
import logging
import textwrap
from typing import List, Tuple
from typing import List, Optional, Tuple
from datetime import datetime, timedelta
from requests import HTTPError
@@ -169,7 +169,7 @@ def get_series_ids(search_query: str, limit: int = -1) -> pd.DataFrame:
@log_start_end(log=logger)
@check_api_key(["API_FRED_KEY"])
def get_series_data(
series_id: str, start_date: str = None, end_date: str = None
series_id: str, start_date: Optional[str] = None, end_date: Optional[str] = None
) -> pd.DataFrame:
"""Get Series data. [Source: FRED]
@@ -177,9 +177,9 @@ def get_series_data(
----------
series_id : str
Series ID to get data from
start_date : str
start_date : Optional[str]
Start date to get data from, format yyyy-mm-dd
end_date : str
end_date : Optional[str]
End data to get from, format yyyy-mm-dd
Returns
@@ -207,7 +207,9 @@ def get_series_data(
@log_start_end(log=logger)
@check_api_key(["API_FRED_KEY"])
def get_aggregated_series_data(
series_ids: List[str], start_date: str = None, end_date: str = None
series_ids: List[str],
start_date: Optional[str] = None,
end_date: Optional[str] = None,
) -> Tuple[pd.DataFrame, dict]:
"""Get Series data. [Source: FRED]

View File

@@ -76,8 +76,8 @@ def notes(search_query: str, limit: int = 10):
@check_api_key(["API_FRED_KEY"])
def display_fred_series(
series_ids: List[str],
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
limit: int = 10,
get_data: bool = False,
raw: bool = False,
@@ -90,9 +90,9 @@ def display_fred_series(
----------
series_ids : List[str]
FRED Series ID from https://fred.stlouisfed.org. For multiple series use: series1,series2,series3
start_date : str
start_date : Optional[str]
Starting date (YYYY-MM-DD) of data
end_date : str
end_date : Optional[str]
Ending date (YYYY-MM-DD) of data
limit : int
Number of data points to display.

View File

@@ -4,7 +4,7 @@ __docformat__ = "numpy"
import argparse
import logging
import os
from typing import List, Union
from typing import List, Optional, Union
from datetime import datetime as dt
import pandas as pd
@@ -20,8 +20,8 @@ logger = logging.getLogger(__name__)
@log_start_end(log=logger)
def get_economic_calendar(
countries: Union[List[str], str] = "",
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
) -> pd.DataFrame:
"""Get economic calendar for countries between specified dates
@@ -29,9 +29,9 @@ def get_economic_calendar(
----------
countries : [List[str],str]
List of countries to include in calendar. Empty returns all
start_date : str
start_date : Optional[str]
Start date for calendar
end_date : str
end_date : Optional[str]
End date for calendar
Returns

View File

@@ -97,7 +97,7 @@ def load(
from_symbol: str,
resolution: str = "d",
interval: str = "1day",
start_date: str = None,
start_date: Optional[str] = None,
source: str = "YahooFinance",
verbose: bool = False,
) -> pd.DataFrame:
@@ -113,7 +113,7 @@ def load(
The resolution for the data, by default "d"
interval : str, optional
What interval to get data for, by default "1day"
start_date : str, optional
start_date : Optional[str], optional
When to begin loading in data, by default last_year.strftime("%Y-%m-%d")
source : str, optional
Where to get data from, by default "YahooFinance"

View File

@@ -2,6 +2,7 @@
__docformat__ = "numpy"
from datetime import datetime
from typing import Optional
import requests
import pandas as pd
from openbb_terminal.config_terminal import API_POLYGON_KEY as api_key
@@ -18,7 +19,7 @@ def get_historical(
multiplier: int = 1,
timespan: str = "day",
start_date: str = "2000-01-01",
end_date: str = None,
end_date: Optional[str] = None,
) -> pd.DataFrame:
"""Load historical fx data from polygon
@@ -32,7 +33,7 @@ def get_historical(
Window to aggregate data.
start_date : str
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
Returns

View File

@@ -65,7 +65,7 @@ def display_search(
def display_historical(
symbols: List[str],
expiry: str = "",
start_date: str = None,
start_date: Optional[str] = None,
raw: bool = False,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
@@ -78,7 +78,7 @@ def display_historical(
List of future timeseries symbols to display
expiry: str
Future expiry date with format YYYY-MM
start_date : str
start_date : Optional[str]
Initial date like string (e.g., 2021-10-01)
raw: bool
Display futures timeseries in raw format

View File

@@ -4,7 +4,7 @@ __docformat__ = "numpy"
import logging
from datetime import datetime, timedelta
from typing import List, Dict
from typing import List, Dict, Optional
import finnhub
import pandas as pd
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
@@ -20,8 +20,8 @@ logger = logging.getLogger(__name__)
@check_api_key(["API_FINNHUB_KEY"])
def get_company_news(
symbol: str,
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
) -> List[Dict]:
"""Get news from a company. [Source: Finnhub]
@@ -29,9 +29,9 @@ def get_company_news(
----------
symbol : str
company ticker to look for news articles
start_date: str
start_date: Optional[str]
date to start searching articles, with format YYYY-MM-DD
end_date: str
end_date: Optional[str]
date to end searching articles, with format YYYY-MM-DD
Returns

View File

@@ -3,7 +3,7 @@ __docformat__ = "numpy"
import logging
from datetime import datetime, timedelta
from typing import List, Tuple
from typing import List, Optional, Tuple
import warnings
import numpy as np
@@ -30,7 +30,7 @@ d_candle_types = {
@log_start_end(log=logger)
def get_historical(
similar: List[str],
start_date: str = None,
start_date: Optional[str] = None,
candle_type: str = "a",
) -> pd.DataFrame:
"""Get historical prices for all comparison stocks
@@ -41,7 +41,7 @@ def get_historical(
List of similar tickers.
Comparable companies can be accessed through
finnhub_peers(), finviz_peers(), polygon_peers().
start_date: str, optional
start_date: Optional[str], optional
Initial date (e.g., 2021-10-01). Defaults to 1 year back
candle_type: str, optional
Candle variable to compare, by default "a" for Adjusted Close. Possible values are: o, h, l, c, a, v, r
@@ -97,7 +97,7 @@ def get_historical(
@log_start_end(log=logger)
def get_correlation(
similar: List[str],
start_date: str = None,
start_date: Optional[str] = None,
candle_type: str = "a",
) -> Tuple[pd.DataFrame, pd.DataFrame]:
"""
@@ -109,7 +109,7 @@ def get_correlation(
List of similar tickers.
Comparable companies can be accessed through
finnhub_peers(), finviz_peers(), polygon_peers().
start_date : str, optional
start_date : Optional[str], optional
Initial date (e.g., 2021-10-01). Defaults to 1 year back
candle_type : str, optional
OHLCA column to use for candles or R for returns, by default "a" for Adjusted Close
@@ -133,7 +133,7 @@ def get_correlation(
@log_start_end(log=logger)
def get_volume(
similar: List[str],
start_date: str = None,
start_date: Optional[str] = None,
) -> pd.DataFrame:
"""Get stock volume. [Source: Yahoo Finance]
@@ -143,7 +143,7 @@ def get_volume(
List of similar tickers.
Comparable companies can be accessed through
finnhub_peers(), finviz_peers(), polygon_peers().
start_date : str, optional
start_date : Optional[str], optional
Initial date (e.g., 2021-10-01). Defaults to 1 year back
Returns

View File

@@ -42,7 +42,7 @@ d_candle_types = {
@log_start_end(log=logger)
def display_historical(
similar: List[str],
start_date: str = None,
start_date: Optional[str] = None,
candle_type: str = "a",
normalize: bool = True,
export: str = "",
@@ -56,7 +56,7 @@ def display_historical(
List of similar tickers.
Comparable companies can be accessed through
finnhub_peers(), finviz_peers(), polygon_peers().
start_date: str, optional
start_date: Optional[str], optional
Initial date (e.g., 2021-10-01). Defaults to 1 year back
candle_type: str, optional
OHLCA column to use or R to use daily returns calculated from Adjusted Close, by default "a" for Adjusted Close
@@ -106,7 +106,7 @@ def display_historical(
@log_start_end(log=logger)
def display_volume(
similar: List[str],
start_date: str = None,
start_date: Optional[str] = None,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
):
@@ -118,7 +118,7 @@ def display_volume(
List of similar tickers.
Comparable companies can be accessed through
finnhub_peers(), finviz_peers(), polygon_peers().
start_date : str, optional
start_date : Optional[str], optional
Initial date (e.g., 2021-10-01). Defaults to 1 year back
export : str, optional
Format to export historical prices, by default ""
@@ -158,7 +158,7 @@ def display_volume(
@log_start_end(log=logger)
def display_correlation(
similar: List[str],
start_date: str = None,
start_date: Optional[str] = None,
candle_type: str = "a",
display_full_matrix: bool = False,
raw: bool = False,
@@ -175,7 +175,7 @@ def display_correlation(
List of similar tickers.
Comparable companies can be accessed through
finnhub_peers(), finviz_peers(), polygon_peers().
start_date : str, optional
start_date : Optional[str], optional
Initial date (e.g., 2021-10-01). Defaults to 1 year back
candle_type : str, optional
OHLCA column to use for candles or R for returns, by default "a" for Adjusted Close

View File

@@ -3,6 +3,7 @@ __docformat__ = "numpy"
import logging
from datetime import datetime, timedelta
from typing import Optional
import pandas as pd
import requests
@@ -58,8 +59,8 @@ def catching_diff_url_formats(ftd_urls: list) -> list:
@log_start_end(log=logger)
def get_fails_to_deliver(
symbol: str,
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
limit: int = 0,
) -> pd.DataFrame:
"""Display fails-to-deliver data for a given ticker. [Source: SEC]
@@ -68,9 +69,9 @@ def get_fails_to_deliver(
----------
symbol : str
Stock ticker
start_date : str
start_date : Optional[str]
Start of data, in YYYY-MM-DD format
end_date : str
end_date : Optional[str]
End of data, in YYYY-MM-DD format
limit : int
Number of latest fails-to-deliver being printed

View File

@@ -28,8 +28,8 @@ logger = logging.getLogger(__name__)
def fails_to_deliver(
symbol: str,
data: pd.DataFrame = None,
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
limit: int = 0,
raw: bool = False,
export: str = "",
@@ -43,9 +43,9 @@ def fails_to_deliver(
Stock ticker
data: pd.DataFrame
Stock data
start_date: str
start_date: Optional[str]
Start of data, in YYYY-MM-DD format
end_date: str
end_date: Optional[str]
End of data, in YYYY-MM-DD format
limit : int
Number of latest fails-to-deliver being printed

View File

@@ -15,16 +15,16 @@ logger = logging.getLogger(__name__)
@log_start_end(log=logger)
@check_api_key(["API_FINNHUB_KEY"])
def get_ipo_calendar(
start_date: str = None,
end_date: str = None,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
) -> pd.DataFrame:
"""Get IPO calendar
Parameters
----------
start_date : str
start_date : Optional[str]
Initial date, format YYYY-MM-DD
end_date : str
end_date : Optional[str]
Final date, format YYYY-MM-DD
Returns

View File

@@ -31,7 +31,7 @@ register_matplotlib_converters()
def price_target_from_analysts(
symbol: str,
data: DataFrame,
start_date: str = None,
start_date: Optional[str] = None,
limit: int = 10,
raw: bool = False,
export: str = "",
@@ -45,7 +45,7 @@ def price_target_from_analysts(
Due diligence ticker symbol
data: DataFrame
Due diligence stock dataframe
start_date : str
start_date : Optional[str]
Start date of the stock data, format YYYY-MM-DD
limit : int
Number of latest price targets from analysts to print

View File

@@ -3,7 +3,7 @@ __docformat__ = "numpy"
import logging
from datetime import datetime, timedelta
from typing import Tuple
from typing import Optional, Tuple
from urllib.request import Request, urlopen
import re
@@ -272,7 +272,7 @@ def get_dividends(symbol: str) -> pd.DataFrame:
@log_start_end(log=logger)
def get_mktcap(
symbol: str,
start_date: str = None,
start_date: Optional[str] = None,
) -> Tuple[pd.DataFrame, str]:
"""Get market cap over time for ticker. [Source: Yahoo Finance]
@@ -280,7 +280,7 @@ def get_mktcap(
----------
symbol: str
Ticker to get market cap over time
start_date: str
start_date: Optional[str]
Initial date (e.g., 2021-10-01). Defaults to 3 years back
Returns

View File

@@ -334,7 +334,7 @@ def display_splits(
@log_start_end(log=logger)
def display_mktcap(
symbol: str,
start_date: str = None,
start_date: Optional[str] = None,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
):
@@ -344,7 +344,7 @@ def display_mktcap(
----------
symbol: str
Stock ticker symbol
start_date: str
start_date: Optional[str]
Initial date (e.g., 2021-10-01). Defaults to 3 years back
export: str
Format to export data

View File

@@ -32,7 +32,7 @@ register_matplotlib_converters()
def insider_activity(
data: pd.DataFrame,
symbol: str,
start_date: str = None,
start_date: Optional[str] = None,
interval: str = "1440min",
limit: int = 10,
raw: bool = False,
@@ -47,7 +47,7 @@ def insider_activity(
Stock dataframe
symbol: str
Due diligence ticker symbol
start_date: str
start_date: Optional[str]
Initial date (e.g., 2021-10-01). Defaults to 3 years back
interval: str
Stock data interval

View File

@@ -3,6 +3,7 @@ __docformat__ = "numpy"
import logging
from datetime import datetime, timedelta
from typing import Optional
import pandas as pd
import requests
@@ -16,7 +17,7 @@ logger = logging.getLogger(__name__)
def get_put_call_ratio(
symbol: str,
window: int = 30,
start_date: str = None,
start_date: Optional[str] = None,
) -> pd.DataFrame:
"""Gets put call ratio over last time window [Source: AlphaQuery.com]
@@ -26,7 +27,7 @@ def get_put_call_ratio(
Ticker symbol to look for
window: int, optional
Window to consider, by default 30
start_date: str, optional
start_date: Optional[str], optional
Start date to plot (e.g., 2021-10-01), by default last 366 days
Returns