Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect date typing in signatures #3524

Merged
merged 11 commits into from
Nov 22, 2022
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -19,8 +19,8 @@
@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.
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
@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,
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions openbb_terminal/common/newsapi_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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
Expand All @@ -19,7 +19,7 @@
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]]:
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions openbb_terminal/common/newsapi_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import os
import logging
from typing import Optional

import pandas as pd

Expand All @@ -20,7 +21,7 @@
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 = "",
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions openbb_terminal/common/technical_analysis/overlap_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "",
Expand All @@ -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
Expand Down
21 changes: 11 additions & 10 deletions openbb_terminal/cryptocurrency/due_diligence/glassnode_model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime
import logging
import json
from typing import Optional

import pandas as pd
import requests
Expand Down Expand Up @@ -181,7 +182,7 @@
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
Expand Down Expand Up @@ -249,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]
Expand Down Expand Up @@ -312,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]
Expand Down Expand Up @@ -376,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]
Expand Down Expand Up @@ -454,7 +455,7 @@ def get_exchange_balances(
symbol: str,
exchange: str = "binance",
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
) -> pd.DataFrame:
"""Returns the total amount of coins held on exchange addresses in units and percentage.
[Source: https://glassnode.com]
Expand All @@ -465,9 +466,9 @@ def get_exchange_balances(
Asset to search active addresses (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
Expand Down Expand Up @@ -540,7 +541,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]
Expand All @@ -551,9 +552,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
Expand Down
18 changes: 9 additions & 9 deletions openbb_terminal/cryptocurrency/due_diligence/glassnode_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
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,
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -240,7 +240,7 @@ def display_exchange_balances(
symbol: str,
exchange: str = "binance",
start_date: str = "2010-01-01",
end_date: str = None,
end_date: Optional[str] = None,
percentage: bool = False,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
Expand Down Expand Up @@ -319,7 +319,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,
Expand All @@ -333,7 +333,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)
Expand Down
18 changes: 9 additions & 9 deletions openbb_terminal/cryptocurrency/due_diligence/messari_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# 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
Expand Down Expand Up @@ -81,8 +81,8 @@ def get_available_timeseries(only_free: bool = True) -> pd.DataFrame:
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/]
Expand All @@ -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
Expand Down Expand Up @@ -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/]
Expand All @@ -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
Expand Down
Loading