mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
Populate model functions with check_api_key decorator (#2755)
* fred decorator * fmp decorator * quandl decorator * reddit decorator * polygon decorator * twitter decorator * news decorator * tradier decorator * cmc decorator * binance decorator * finnhub decorator * iex decorator * sentiment investor * walert decorator * glassnode decorator * coinglass decorator * cryptopanic decorator * bitquery decorator * smartstake decorator * messari decorator * github decorator * santiment decorator * eodhd decorator * import check_api_decorator * fix some decorators * fix some decorators * remove some decorator * decorator fixes * black * mypy * mypy again * mypy again * pylint * decorator * too many line * fix fred ycrv * mypy * rewrite events test * another try Co-authored-by: minhhoang1023 <40023817+minhhoang1023@users.noreply.github.com>
This commit is contained in:
@@ -10,13 +10,14 @@ import requests
|
||||
import pandas as pd
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.helper_funcs import get_user_agent
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@check_api_key(["API_GITHUB_KEY"])
|
||||
def get_github_data(url: str, **kwargs):
|
||||
"""Get repository stats
|
||||
|
||||
|
||||
@@ -8,13 +8,14 @@ import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_FINNHUB_KEY"])
|
||||
def get_sentiment_stats(ticker: str) -> Dict:
|
||||
"""Get sentiment stats [Source: finnhub]
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"""Reddit Model"""
|
||||
__docformat__ = "numpy"
|
||||
# pylint:disable=too-many-lines
|
||||
|
||||
import logging
|
||||
from datetime import datetime, timedelta
|
||||
@@ -18,7 +19,7 @@ from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.common.behavioural_analysis.reddit_helpers import find_tickers
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -36,6 +37,15 @@ l_sub_reddits = [
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(
|
||||
[
|
||||
"API_REDDIT_CLIENT_ID",
|
||||
"API_REDDIT_CLIENT_SECRET",
|
||||
"API_REDDIT_USERNAME",
|
||||
"API_REDDIT_USER_AGENT",
|
||||
"API_REDDIT_PASSWORD",
|
||||
]
|
||||
)
|
||||
def get_watchlists(
|
||||
limit: int = 5,
|
||||
) -> Tuple[List[praw.models.reddit.submission.Submission], dict, int]:
|
||||
@@ -134,6 +144,15 @@ def get_watchlists(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(
|
||||
[
|
||||
"API_REDDIT_CLIENT_ID",
|
||||
"API_REDDIT_CLIENT_SECRET",
|
||||
"API_REDDIT_USERNAME",
|
||||
"API_REDDIT_USER_AGENT",
|
||||
"API_REDDIT_PASSWORD",
|
||||
]
|
||||
)
|
||||
def get_popular_tickers(
|
||||
limit: int = 10, post_limit: int = 50, subreddits: str = ""
|
||||
) -> pd.DataFrame:
|
||||
@@ -297,6 +316,15 @@ def get_popular_tickers(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(
|
||||
[
|
||||
"API_REDDIT_CLIENT_ID",
|
||||
"API_REDDIT_CLIENT_SECRET",
|
||||
"API_REDDIT_USERNAME",
|
||||
"API_REDDIT_USER_AGENT",
|
||||
"API_REDDIT_PASSWORD",
|
||||
]
|
||||
)
|
||||
def get_spac_community(
|
||||
limit: int = 10, popular: bool = False
|
||||
) -> Tuple[pd.DataFrame, dict]:
|
||||
@@ -428,6 +456,15 @@ def get_spac_community(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(
|
||||
[
|
||||
"API_REDDIT_CLIENT_ID",
|
||||
"API_REDDIT_CLIENT_SECRET",
|
||||
"API_REDDIT_USERNAME",
|
||||
"API_REDDIT_USER_AGENT",
|
||||
"API_REDDIT_PASSWORD",
|
||||
]
|
||||
)
|
||||
def get_spac(
|
||||
limit: int = 5,
|
||||
) -> Tuple[pd.DataFrame, dict, int]:
|
||||
@@ -567,6 +604,15 @@ def get_spac(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(
|
||||
[
|
||||
"API_REDDIT_CLIENT_ID",
|
||||
"API_REDDIT_CLIENT_SECRET",
|
||||
"API_REDDIT_USERNAME",
|
||||
"API_REDDIT_USER_AGENT",
|
||||
"API_REDDIT_PASSWORD",
|
||||
]
|
||||
)
|
||||
def get_wsb_community(limit: int = 10, new: bool = False) -> pd.DataFrame:
|
||||
"""Get wsb posts [Source: reddit]
|
||||
|
||||
@@ -667,6 +713,15 @@ def get_wsb_community(limit: int = 10, new: bool = False) -> pd.DataFrame:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(
|
||||
[
|
||||
"API_REDDIT_CLIENT_ID",
|
||||
"API_REDDIT_CLIENT_SECRET",
|
||||
"API_REDDIT_USERNAME",
|
||||
"API_REDDIT_USER_AGENT",
|
||||
"API_REDDIT_PASSWORD",
|
||||
]
|
||||
)
|
||||
def get_due_dilligence(
|
||||
symbol: str, limit: int = 5, n_days: int = 3, show_all_flairs: bool = False
|
||||
) -> pd.DataFrame:
|
||||
@@ -811,6 +866,15 @@ def get_due_dilligence(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(
|
||||
[
|
||||
"API_REDDIT_CLIENT_ID",
|
||||
"API_REDDIT_CLIENT_SECRET",
|
||||
"API_REDDIT_USERNAME",
|
||||
"API_REDDIT_USER_AGENT",
|
||||
"API_REDDIT_PASSWORD",
|
||||
]
|
||||
)
|
||||
def get_posts_about(
|
||||
symbol: str,
|
||||
limit: int = 100,
|
||||
@@ -918,6 +982,15 @@ def get_posts_about(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(
|
||||
[
|
||||
"API_REDDIT_CLIENT_ID",
|
||||
"API_REDDIT_CLIENT_SECRET",
|
||||
"API_REDDIT_USERNAME",
|
||||
"API_REDDIT_USER_AGENT",
|
||||
"API_REDDIT_PASSWORD",
|
||||
]
|
||||
)
|
||||
def get_comments(
|
||||
post: praw.models.reddit.submission.Submission,
|
||||
) -> List[praw.models.reddit.comment.Comment]:
|
||||
@@ -980,6 +1053,15 @@ def clean_reddit_text(docs: List[str]) -> List[str]:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(
|
||||
[
|
||||
"API_REDDIT_CLIENT_ID",
|
||||
"API_REDDIT_CLIENT_SECRET",
|
||||
"API_REDDIT_USERNAME",
|
||||
"API_REDDIT_USER_AGENT",
|
||||
"API_REDDIT_PASSWORD",
|
||||
]
|
||||
)
|
||||
def get_sentiment(post_data: List[str]) -> float:
|
||||
"""Find the sentiment of a post and related comments
|
||||
|
||||
|
||||
@@ -31,6 +31,15 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(
|
||||
[
|
||||
"API_REDDIT_CLIENT_ID",
|
||||
"API_REDDIT_CLIENT_SECRET",
|
||||
"API_REDDIT_USERNAME",
|
||||
"API_REDDIT_USER_AGENT",
|
||||
"API_REDDIT_PASSWORD",
|
||||
]
|
||||
)
|
||||
def print_and_record_reddit_post(
|
||||
submissions_dict: Dict, submission: praw.models.reddit.submission.Submission
|
||||
):
|
||||
@@ -84,6 +93,15 @@ def print_and_record_reddit_post(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(
|
||||
[
|
||||
"API_REDDIT_CLIENT_ID",
|
||||
"API_REDDIT_CLIENT_SECRET",
|
||||
"API_REDDIT_USERNAME",
|
||||
"API_REDDIT_USER_AGENT",
|
||||
"API_REDDIT_PASSWORD",
|
||||
]
|
||||
)
|
||||
def print_reddit_post(sub: tuple):
|
||||
"""Prints reddit submission
|
||||
|
||||
|
||||
@@ -9,13 +9,14 @@ import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import log_start_end, check_api_key
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_SENTIMENTINVESTOR_TOKEN"])
|
||||
def get_historical(
|
||||
symbol: str,
|
||||
start_date: str = (datetime.utcnow() - timedelta(days=7)).strftime("%Y-%m-%d"),
|
||||
@@ -76,6 +77,7 @@ def get_historical(
|
||||
return df
|
||||
|
||||
|
||||
@check_api_key(["API_SENTIMENTINVESTOR_TOKEN"])
|
||||
def check_supported_ticker(symbol: str) -> bool:
|
||||
"""Check if the ticker is supported
|
||||
|
||||
@@ -124,6 +126,7 @@ def check_supported_ticker(symbol: str) -> bool:
|
||||
return result
|
||||
|
||||
|
||||
@check_api_key(["API_SENTIMENTINVESTOR_TOKEN"])
|
||||
def get_trending(
|
||||
start_date: datetime = datetime.today(), hour: int = 0, number: int = 10
|
||||
) -> pd.DataFrame:
|
||||
|
||||
@@ -10,7 +10,7 @@ import requests
|
||||
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.helper_funcs import clean_tweet, get_data
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
@@ -20,6 +20,7 @@ analyzer = SentimentIntensityAnalyzer()
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_TWITTER_BEARER_TOKEN"])
|
||||
def load_analyze_tweets(
|
||||
symbol: str,
|
||||
limit: int = 100,
|
||||
|
||||
@@ -8,13 +8,14 @@ from typing import Any, List, Tuple
|
||||
import requests
|
||||
import pandas as pd
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_NEWS_TOKEN"])
|
||||
def get_news(
|
||||
query: str,
|
||||
limit: int = 10,
|
||||
|
||||
@@ -5,10 +5,12 @@ from typing import Union, Dict
|
||||
import requests
|
||||
import pandas as pd
|
||||
|
||||
from openbb_terminal.decorators import check_api_key
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
|
||||
@check_api_key(["API_SMARTSTAKE_KEY", "API_SMARTSTAKE_TOKEN"])
|
||||
def get_luna_supply_stats(
|
||||
supply_type: str = "lunaSupplyChallengeStats", days: int = 30
|
||||
) -> pd.DataFrame:
|
||||
|
||||
@@ -7,7 +7,7 @@ import pandas as pd
|
||||
from coinmarketcapapi import CoinMarketCapAPI, CoinMarketCapAPIError
|
||||
|
||||
import openbb_terminal.config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import log_start_end, check_api_key
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -24,6 +24,7 @@ sort_map = {
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_CMC_KEY"])
|
||||
def get_cmc_top_n(sortby: str = "CMC_Rank", ascend: bool = True) -> pd.DataFrame:
|
||||
"""Shows top n coins. [Source: CoinMarketCap]
|
||||
|
||||
|
||||
@@ -11,13 +11,14 @@ from binance.client import Client
|
||||
from binance.exceptions import BinanceAPIException
|
||||
|
||||
import openbb_terminal.config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import log_start_end, check_api_key
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_BINANCE_KEY", "API_BINANCE_SECRET"])
|
||||
def _get_trading_pairs() -> List[dict]:
|
||||
"""Helper method that return all trading pairs on binance. Methods ause this data for input for e.g
|
||||
building dataframe with all coins, or to build dict of all trading pairs. [Source: Binance]
|
||||
@@ -54,6 +55,7 @@ def _get_trading_pairs() -> List[dict]:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_BINANCE_KEY", "API_BINANCE_SECRET"])
|
||||
def get_all_binance_trading_pairs() -> pd.DataFrame:
|
||||
"""Returns all available pairs on Binance in DataFrame format. DataFrame has 3 columns symbol, baseAsset, quoteAsset
|
||||
example row: ETHBTC | ETH | BTC
|
||||
@@ -72,6 +74,7 @@ def get_all_binance_trading_pairs() -> pd.DataFrame:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_BINANCE_KEY", "API_BINANCE_SECRET"])
|
||||
def get_binance_available_quotes_for_each_coin() -> dict:
|
||||
"""Helper methods that for every coin available on Binance add all quote assets. [Source: Binance]
|
||||
|
||||
@@ -90,6 +93,7 @@ def get_binance_available_quotes_for_each_coin() -> dict:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_BINANCE_KEY", "API_BINANCE_SECRET"])
|
||||
def check_valid_binance_str(symbol: str) -> str:
|
||||
"""Check if symbol is in defined binance. [Source: Binance]"""
|
||||
client = Client(cfg.API_BINANCE_KEY, cfg.API_BINANCE_SECRET)
|
||||
@@ -104,6 +108,7 @@ def check_valid_binance_str(symbol: str) -> str:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_BINANCE_KEY", "API_BINANCE_SECRET"])
|
||||
def show_available_pairs_for_given_symbol(
|
||||
symbol: str = "ETH",
|
||||
) -> Tuple[Union[str, None], list]:
|
||||
@@ -131,6 +136,7 @@ def show_available_pairs_for_given_symbol(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_BINANCE_KEY", "API_BINANCE_SECRET"])
|
||||
def get_order_book(
|
||||
from_symbol: str,
|
||||
limit: int = 100,
|
||||
@@ -166,6 +172,7 @@ def get_order_book(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_BINANCE_KEY", "API_BINANCE_SECRET"])
|
||||
def get_balance(
|
||||
from_symbol: str,
|
||||
to_symbol: str = "USDT",
|
||||
|
||||
@@ -6,7 +6,7 @@ import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -19,6 +19,7 @@ INTERVALS = [str(x) for x in intervals]
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_COINGLASS_KEY"])
|
||||
def get_liquidations(symbol: str) -> pd.DataFrame:
|
||||
"""Returns liquidations per day for a certain symbol
|
||||
[Source: https://coinglass.github.io/API-Reference/#liquidation-chart]
|
||||
@@ -82,6 +83,7 @@ def get_liquidations(symbol: str) -> pd.DataFrame:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_COINGLASS_KEY"])
|
||||
def get_funding_rate(symbol: str) -> pd.DataFrame:
|
||||
"""Returns open interest by exchange for a certain symbol
|
||||
[Source: https://coinglass.github.io/API-Reference/]
|
||||
@@ -144,6 +146,7 @@ def get_funding_rate(symbol: str) -> pd.DataFrame:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_COINGLASS_KEY"])
|
||||
def get_open_interest_per_exchange(symbol: str, interval: int = 0) -> pd.DataFrame:
|
||||
"""Returns open interest by exchange for a certain symbol
|
||||
[Source: https://coinglass.github.io/API-Reference/]
|
||||
|
||||
@@ -6,7 +6,7 @@ import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import log_start_end, check_api_key
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
# pylint: disable=unsupported-assignment-operation
|
||||
@@ -176,6 +176,7 @@ INTERVALS_ACTIVE_ADDRESSES = ["24h", "1w", "1month"]
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_GLASSNODE_KEY"])
|
||||
def get_close_price(
|
||||
symbol: str,
|
||||
start_date: str = "2010-01-01",
|
||||
@@ -248,6 +249,7 @@ def get_close_price(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_GLASSNODE_KEY"])
|
||||
def get_non_zero_addresses(
|
||||
symbol: str,
|
||||
start_date: int = int(datetime(2010, 1, 1).timestamp()),
|
||||
@@ -303,6 +305,7 @@ def get_non_zero_addresses(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_GLASSNODE_KEY"])
|
||||
def get_active_addresses(
|
||||
symbol: str,
|
||||
interval: str = "24h",
|
||||
@@ -360,6 +363,7 @@ def get_active_addresses(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_GLASSNODE_KEY"])
|
||||
def get_hashrate(
|
||||
symbol: str,
|
||||
interval: str = "24h",
|
||||
@@ -428,6 +432,7 @@ def get_hashrate(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_GLASSNODE_KEY"])
|
||||
def get_exchange_balances(
|
||||
symbol: str,
|
||||
exchange: str = "binance",
|
||||
@@ -507,6 +512,7 @@ def get_exchange_balances(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_GLASSNODE_KEY"])
|
||||
def get_exchange_net_position_change(
|
||||
symbol: str,
|
||||
exchange: str = "binance",
|
||||
|
||||
@@ -18,7 +18,7 @@ from openbb_terminal.cryptocurrency.dataframe_helpers import (
|
||||
from openbb_terminal.cryptocurrency.due_diligence.pycoingecko_model import (
|
||||
get_coin_tokenomics,
|
||||
)
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.helper_funcs import lambda_long_number_format
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
@@ -115,6 +115,7 @@ def get_marketcap_dominance(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_MESSARI_KEY"])
|
||||
def get_messari_timeseries(
|
||||
symbol: str,
|
||||
timeseries_id: str,
|
||||
@@ -182,6 +183,7 @@ def get_messari_timeseries(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_MESSARI_KEY"])
|
||||
def get_links(symbol: str) -> pd.DataFrame:
|
||||
"""Returns asset's links
|
||||
[Source: https://messari.io/]
|
||||
@@ -220,6 +222,7 @@ def get_links(symbol: str) -> pd.DataFrame:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_MESSARI_KEY"])
|
||||
def get_roadmap(symbol: str, ascend: bool = True) -> pd.DataFrame:
|
||||
"""Returns coin roadmap
|
||||
[Source: https://messari.io/]
|
||||
@@ -266,6 +269,7 @@ def get_roadmap(symbol: str, ascend: bool = True) -> pd.DataFrame:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_MESSARI_KEY"])
|
||||
def get_tokenomics(symbol: str, coingecko_id: str) -> Tuple[pd.DataFrame, pd.DataFrame]:
|
||||
"""Returns coin tokenomics
|
||||
[Source: https://messari.io/]
|
||||
@@ -335,6 +339,7 @@ def get_tokenomics(symbol: str, coingecko_id: str) -> Tuple[pd.DataFrame, pd.Dat
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_MESSARI_KEY"])
|
||||
def get_project_product_info(
|
||||
symbol: str,
|
||||
) -> Tuple[pd.DataFrame, pd.DataFrame, pd.DataFrame, pd.DataFrame]:
|
||||
@@ -403,6 +408,7 @@ def get_project_product_info(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_MESSARI_KEY"])
|
||||
def get_team(symbol: str) -> Tuple[pd.DataFrame, pd.DataFrame]:
|
||||
"""Returns coin team
|
||||
[Source: https://messari.io/]
|
||||
@@ -478,6 +484,7 @@ def get_team(symbol: str) -> Tuple[pd.DataFrame, pd.DataFrame]:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_MESSARI_KEY"])
|
||||
def get_investors(symbol: str) -> Tuple[pd.DataFrame, pd.DataFrame]:
|
||||
"""Returns coin investors
|
||||
[Source: https://messari.io/]
|
||||
@@ -551,6 +558,7 @@ def get_investors(symbol: str) -> Tuple[pd.DataFrame, pd.DataFrame]:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_MESSARI_KEY"])
|
||||
def get_governance(symbol: str) -> Tuple[str, pd.DataFrame]:
|
||||
"""Returns coin governance
|
||||
[Source: https://messari.io/]
|
||||
@@ -621,6 +629,7 @@ def format_addresses(x: Any):
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_MESSARI_KEY"])
|
||||
def get_fundraising(
|
||||
symbol: str,
|
||||
) -> Tuple[str, pd.DataFrame, pd.DataFrame, pd.DataFrame]:
|
||||
|
||||
@@ -6,7 +6,7 @@ import requests
|
||||
import pandas as pd
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.cryptocurrency.discovery.pycoingecko_model import read_file_data
|
||||
|
||||
@@ -25,6 +25,7 @@ def get_slug(symbol: str) -> str:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_SANTIMENT_KEY"])
|
||||
def get_github_activity(
|
||||
symbol: str,
|
||||
dev_activity: bool = False,
|
||||
|
||||
@@ -18,7 +18,7 @@ from openbb_terminal.cryptocurrency.dataframe_helpers import (
|
||||
)
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -156,6 +156,7 @@ def _extract_dex_trades(data: dict) -> pd.DataFrame:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_BITQUERY_KEY"])
|
||||
def query_graph(url: str, query: str) -> dict:
|
||||
"""Helper methods for querying graphql api. [Source: https://bitquery.io/]
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import requests
|
||||
|
||||
import openbb_terminal.config_terminal as cfg
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -40,6 +40,7 @@ class ApiKeyException(Exception):
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_WHALE_ALERT_KEY"])
|
||||
def make_request(params: Optional[dict] = None) -> Tuple[Optional[int], Any]:
|
||||
"""Helper methods for requests [Source: https://docs.whale-alert.io/]
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import requests
|
||||
|
||||
import openbb_terminal.config_terminal as cfg
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.cryptocurrency.cryptocurrency_helpers import prepare_all_coins_df
|
||||
from openbb_terminal.parent_classes import CRYPTO_SOURCES
|
||||
|
||||
@@ -55,6 +55,7 @@ class ApiKeyException(Exception):
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_CRYPTO_PANIC_KEY"])
|
||||
def make_request(**kwargs: Any) -> Optional[dict]:
|
||||
"""Helper methods for requests [Source: https://cryptopanic.com/developers/api/]
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_FINNHUB_KEY"])
|
||||
def get_economy_calendar_events() -> pd.DataFrame:
|
||||
"""Get economic calendar events
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ from fredapi import Fred
|
||||
import certifi
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.helper_funcs import get_user_agent
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
@@ -24,6 +24,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_FRED_KEY"])
|
||||
def check_series_id(series_id: str) -> Tuple[bool, Dict]:
|
||||
"""Checks if series ID exists in fred
|
||||
|
||||
@@ -65,6 +66,7 @@ def check_series_id(series_id: str) -> Tuple[bool, Dict]:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_FRED_KEY"])
|
||||
def get_series_notes(search_query: str, limit: int = -1) -> pd.DataFrame:
|
||||
"""Get series notes. [Source: FRED]
|
||||
Parameters
|
||||
@@ -116,6 +118,7 @@ def get_series_notes(search_query: str, limit: int = -1) -> pd.DataFrame:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_FRED_KEY"])
|
||||
def get_series_ids(search_query: str, limit: int = -1) -> pd.DataFrame:
|
||||
"""Get Series IDs. [Source: FRED]
|
||||
Parameters
|
||||
@@ -157,6 +160,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
|
||||
) -> pd.DataFrame:
|
||||
@@ -193,6 +197,7 @@ 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
|
||||
) -> pd.DataFrame:
|
||||
@@ -239,7 +244,10 @@ def get_aggregated_series_data(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_yield_curve(date: datetime = None) -> Tuple[pd.DataFrame, str]:
|
||||
@check_api_key(["API_FRED_KEY"])
|
||||
def get_yield_curve(
|
||||
date: datetime = None,
|
||||
) -> Tuple[pd.DataFrame, datetime]:
|
||||
"""Gets yield curve data from FRED
|
||||
|
||||
Parameters
|
||||
@@ -293,7 +301,7 @@ def get_yield_curve(date: datetime = None) -> Tuple[pd.DataFrame, str]:
|
||||
date_of_yield = date
|
||||
series = df[df.index == date]
|
||||
if series.empty:
|
||||
return pd.DataFrame(), date.strftime("%Y-%m-%d")
|
||||
return pd.DataFrame(), date_of_yield
|
||||
rates = pd.DataFrame(series.values.T, columns=["Rate"])
|
||||
|
||||
rates.insert(
|
||||
|
||||
@@ -176,7 +176,7 @@ def display_fred_series(
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_FRED_KEY"])
|
||||
def display_yield_curve(
|
||||
date: datetime = datetime.today(),
|
||||
date: datetime = None,
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
raw: bool = False,
|
||||
export: str = "",
|
||||
@@ -193,7 +193,7 @@ def display_yield_curve(
|
||||
rates, date_of_yield = fred_model.get_yield_curve(date)
|
||||
if rates.empty:
|
||||
console.print(
|
||||
f"[red]Yield data not found for {date.strftime('%Y-%m-%d')}.[/red]\n"
|
||||
f"[red]Yield data not found for {date_of_yield.strftime('%Y-%m-%d')}.[/red]\n"
|
||||
)
|
||||
return
|
||||
if external_axes is None:
|
||||
|
||||
@@ -77,7 +77,7 @@ def check_correct_country(country: str, countries: list) -> str:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_yieldcurve(country: str) -> pd.DataFrame:
|
||||
def get_yieldcurve(country: str = "United States") -> pd.DataFrame:
|
||||
"""Get yield curve for specified country. [Source: Investing.com]
|
||||
|
||||
Parameters
|
||||
|
||||
@@ -27,7 +27,7 @@ register_matplotlib_converters()
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def display_yieldcurve(
|
||||
country: str,
|
||||
country: str = "United States",
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
raw: bool = False,
|
||||
export: str = "",
|
||||
|
||||
@@ -10,7 +10,7 @@ import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal.config_terminal import API_KEY_QUANDL
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -50,7 +50,8 @@ def get_country_codes() -> List[str]:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_big_mac_index(country_code: str) -> pd.DataFrame:
|
||||
@check_api_key(["API_KEY_QUANDL"])
|
||||
def get_big_mac_index(country_code: str = "USA") -> pd.DataFrame:
|
||||
"""Gets the Big Mac index calculated by the Economist
|
||||
|
||||
Parameters
|
||||
@@ -89,7 +90,8 @@ def get_big_mac_index(country_code: str) -> pd.DataFrame:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def get_big_mac_indices(country_codes: List[str]) -> pd.DataFrame:
|
||||
@check_api_key(["API_KEY_QUANDL"])
|
||||
def get_big_mac_indices(country_codes: List[str] = None) -> pd.DataFrame:
|
||||
"""Display Big Mac Index for given countries
|
||||
|
||||
Parameters
|
||||
@@ -103,6 +105,9 @@ def get_big_mac_indices(country_codes: List[str]) -> pd.DataFrame:
|
||||
Dataframe with Big Mac indices converted to USD equivalent.
|
||||
"""
|
||||
|
||||
if country_codes is None:
|
||||
country_codes = ["USA"]
|
||||
|
||||
df_cols = ["Date"]
|
||||
df_cols.extend(country_codes)
|
||||
big_mac = pd.DataFrame(columns=df_cols)
|
||||
|
||||
@@ -26,7 +26,7 @@ logger = logging.getLogger(__name__)
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_QUANDL"])
|
||||
def display_big_mac_index(
|
||||
country_codes: List[str],
|
||||
country_codes: List[str] = None,
|
||||
raw: bool = False,
|
||||
export: str = "",
|
||||
external_axes: Optional[List[plt.Axes]] = None,
|
||||
|
||||
@@ -6,11 +6,13 @@ import requests
|
||||
import pandas as pd
|
||||
from openbb_terminal.config_terminal import API_POLYGON_KEY as api_key
|
||||
from openbb_terminal.helper_funcs import get_user_agent
|
||||
from openbb_terminal.decorators import check_api_key
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
# pylint: disable=unsupported-assignment-operation
|
||||
|
||||
|
||||
@check_api_key(["API_POLYGON_KEY"])
|
||||
def get_historical(
|
||||
fx_pair: str,
|
||||
multiplier: int = 1,
|
||||
|
||||
@@ -9,7 +9,7 @@ import finnhub
|
||||
import pandas as pd
|
||||
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.helper_funcs import similar
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
@@ -17,6 +17,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_FINNHUB_KEY"])
|
||||
def get_company_news(
|
||||
symbol: str,
|
||||
start_date: str = (datetime.now() - timedelta(days=30)).strftime("%Y-%m-%d"),
|
||||
|
||||
@@ -7,13 +7,14 @@ from typing import List
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_FINNHUB_KEY"])
|
||||
def get_similar_companies(symbol: str) -> List[str]:
|
||||
"""Get similar companies from Finhub
|
||||
|
||||
|
||||
@@ -7,13 +7,14 @@ from typing import List
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_POLYGON_KEY"])
|
||||
def get_similar_companies(symbol: str, us_only: bool = False) -> List[str]:
|
||||
"""Get similar companies from Polygon
|
||||
|
||||
|
||||
@@ -8,13 +8,14 @@ import pandas as pd
|
||||
import quandl
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_QUANDL"])
|
||||
def get_short_interest(symbol: str, nyse: bool = False) -> pd.DataFrame:
|
||||
"""Plots the short interest of a stock. This corresponds to the
|
||||
number of shares that have been sold short but have not yet been
|
||||
|
||||
@@ -26,6 +26,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_QUANDL"])
|
||||
def plot_short_interest(
|
||||
symbol: str,
|
||||
data: pd.DataFrame,
|
||||
|
||||
@@ -6,13 +6,14 @@ import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_FINNHUB_KEY"])
|
||||
def get_ipo_calendar(
|
||||
start_date: str = (datetime.now() - timedelta(days=5)).strftime("%Y-%m-%d"),
|
||||
end_date: str = datetime.now().strftime("%Y-%m-%d"),
|
||||
@@ -63,6 +64,7 @@ def get_ipo_calendar(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_FINNHUB_KEY"])
|
||||
def get_past_ipo(
|
||||
num_days_behind: int = 5,
|
||||
start_date: Optional[str] = None,
|
||||
|
||||
@@ -8,7 +8,7 @@ import pandas as pd
|
||||
import requests
|
||||
|
||||
import openbb_terminal.config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.helper_funcs import get_user_agent
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
@@ -17,6 +17,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_QUANDL"])
|
||||
def get_retail_tickers() -> pd.DataFrame:
|
||||
"""Gets the top 10 retail stocks per day
|
||||
|
||||
|
||||
@@ -7,13 +7,14 @@ import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_FINNHUB_KEY"])
|
||||
def get_rating_over_time(symbol: str) -> pd.DataFrame:
|
||||
"""Get rating over time data. [Source: Finnhub]
|
||||
|
||||
|
||||
@@ -7,13 +7,14 @@ import fundamentalanalysis as fa
|
||||
import pandas as pd
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_rating(symbol: str) -> pd.DataFrame:
|
||||
"""Get ratings for a given ticker. [Source: Financial Modeling Prep]
|
||||
|
||||
|
||||
@@ -8,13 +8,14 @@ import numpy as np
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_EODHD_TOKEN"])
|
||||
def get_financials(
|
||||
symbol: str, statement: str, quarterly: bool = False, ratios: bool = False
|
||||
) -> pd.DataFrame:
|
||||
|
||||
@@ -14,7 +14,7 @@ import valinvest
|
||||
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.helper_funcs import lambda_long_number_format
|
||||
from openbb_terminal.stocks.fundamental_analysis.fa_helper import clean_df_index
|
||||
|
||||
@@ -22,6 +22,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_score(symbol: str) -> Optional[np.number]:
|
||||
"""Gets value score from fmp
|
||||
|
||||
@@ -52,6 +53,7 @@ def get_score(symbol: str) -> Optional[np.number]:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_profile(symbol: str) -> pd.DataFrame:
|
||||
"""Get ticker profile from FMP
|
||||
|
||||
@@ -79,6 +81,7 @@ def get_profile(symbol: str) -> pd.DataFrame:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_quote(symbol: str) -> pd.DataFrame:
|
||||
"""Gets ticker quote from FMP
|
||||
|
||||
@@ -125,6 +128,7 @@ def get_quote(symbol: str) -> pd.DataFrame:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_enterprise(
|
||||
symbol: str, limit: int = 5, quarterly: bool = False
|
||||
) -> pd.DataFrame:
|
||||
@@ -166,6 +170,7 @@ def get_enterprise(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_dcf(symbol: str, limit: int = 5, quarterly: bool = False) -> pd.DataFrame:
|
||||
"""Get stocks dcf from FMP
|
||||
|
||||
@@ -205,6 +210,7 @@ def get_dcf(symbol: str, limit: int = 5, quarterly: bool = False) -> pd.DataFram
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_income(
|
||||
symbol: str,
|
||||
limit: int = 5,
|
||||
@@ -271,6 +277,7 @@ def get_income(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_balance(
|
||||
symbol: str,
|
||||
limit: int = 5,
|
||||
@@ -339,6 +346,7 @@ def get_balance(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_cash(
|
||||
symbol: str,
|
||||
limit: int = 5,
|
||||
@@ -404,6 +412,7 @@ def get_cash(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_key_metrics(
|
||||
symbol: str, limit: int = 5, quarterly: bool = False
|
||||
) -> pd.DataFrame:
|
||||
@@ -445,6 +454,7 @@ def get_key_metrics(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_key_ratios(
|
||||
symbol: str, limit: int = 5, quarterly: bool = False
|
||||
) -> pd.DataFrame:
|
||||
@@ -486,6 +496,7 @@ def get_key_ratios(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def get_financial_growth(
|
||||
symbol: str, limit: int = 5, quarterly: bool = False
|
||||
) -> pd.DataFrame:
|
||||
@@ -529,6 +540,7 @@ def get_financial_growth(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_KEY_FINANCIALMODELINGPREP"])
|
||||
def clean_metrics_df(data: pd.DataFrame, num: int, mask: bool = True) -> pd.DataFrame:
|
||||
"""Clean metrics data frame
|
||||
|
||||
|
||||
@@ -7,13 +7,14 @@ import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import check_api_key, log_start_end
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_POLYGON_KEY"])
|
||||
def get_financials(
|
||||
symbol: str, statement: str, quarterly: bool = False, ratios: bool = False
|
||||
) -> pd.DataFrame:
|
||||
|
||||
@@ -8,7 +8,7 @@ import pandas as pd
|
||||
import requests
|
||||
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
from openbb_terminal.decorators import log_start_end
|
||||
from openbb_terminal.decorators import log_start_end, check_api_key
|
||||
from openbb_terminal.rich_config import console
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -41,6 +41,7 @@ default_columns = [
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_TRADIER_TOKEN"])
|
||||
def get_historical_options(
|
||||
symbol: str,
|
||||
expiry: str,
|
||||
@@ -114,6 +115,7 @@ def get_historical_options(
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_TRADIER_TOKEN"])
|
||||
def option_expirations(symbol: str) -> List[str]:
|
||||
"""Get available expiration dates for given ticker
|
||||
|
||||
@@ -149,6 +151,7 @@ def option_expirations(symbol: str) -> List[str]:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_TRADIER_TOKEN"])
|
||||
def get_option_chains(symbol: str, expiry: str) -> pd.DataFrame:
|
||||
"""Display option chains [Source: Tradier]"
|
||||
|
||||
@@ -222,6 +225,7 @@ def process_chains(response: requests.models.Response) -> pd.DataFrame:
|
||||
|
||||
|
||||
@log_start_end(log=logger)
|
||||
@check_api_key(["API_TRADIER_TOKEN"])
|
||||
def last_price(symbol: str):
|
||||
"""Makes api request for last price
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import requests
|
||||
import pandas as pd
|
||||
import yfinance as yf
|
||||
from alpha_vantage.timeseries import TimeSeries
|
||||
from openbb_terminal.decorators import check_api_key
|
||||
|
||||
from openbb_terminal.rich_config import console
|
||||
from openbb_terminal import config_terminal as cfg
|
||||
@@ -142,6 +143,7 @@ def load_stock_eodhd(
|
||||
return df_stock_candidate
|
||||
|
||||
|
||||
@check_api_key(["API_IEX_TOKEN"])
|
||||
def load_stock_iex_cloud(symbol: str, iexrange: str) -> pd.DataFrame:
|
||||
df_stock_candidate = pd.DataFrame()
|
||||
|
||||
@@ -180,6 +182,7 @@ def load_stock_iex_cloud(symbol: str, iexrange: str) -> pd.DataFrame:
|
||||
return df_stock_candidate
|
||||
|
||||
|
||||
@check_api_key(["API_POLYGON_KEY"])
|
||||
def load_stock_polygon(
|
||||
symbol: str, start_date: datetime, end_date: datetime, weekly: bool, monthly: bool
|
||||
) -> pd.DataFrame:
|
||||
|
||||
@@ -0,0 +1,193 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: dateFrom=2022-07-07&dateTo=2022-07-08&timeZone=46&timeFilter=timeOnly¤tTab=custom&submitFilters=1&limit_from=0&country%5B%5D=5&category%5B%5D=_employment&importance%5B%5D=3
|
||||
headers:
|
||||
Accept:
|
||||
- text/html
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '178'
|
||||
Content-Type:
|
||||
- application/x-www-form-urlencoded
|
||||
User-Agent:
|
||||
- Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5
|
||||
X-Requested-With:
|
||||
- XMLHttpRequest
|
||||
method: POST
|
||||
uri: https://www.investing.com/economic-calendar/Service/getCalendarFilteredData
|
||||
response:
|
||||
body:
|
||||
string: !!binary |
|
||||
H4sIAAAAAAAAA+xYf2/bNhD9KgcCG1rAWmTZjm3NMdAkc5d0a4vWXYFNg0FLZ5sJRXrkKalX9LsP
|
||||
pPxDruvE2dZ/ihgIbPF49+6ou/ekfGQZJ85i1iPTB//pUQaplnbO1UnCugmDVHJrTxJGMzzni4SB
|
||||
yNZX9eNWu96KwjBMWH84K4zN+KIGl4VcQLsGURhFveSIMh/c/SphemTKKHiDit7o24ts1Gw1m41O
|
||||
Be/KBt4cCMIcEgb+asSJzOji/CRhUbeZMHAVLDdmnJBEjs4WRlFyFLbdH4SduBHGPsdKkUuYiTCW
|
||||
QOKEwPnClQ3cd8Kg7/02+W/7eY+J5NOzwoDS7w2fJ6zfcwcHJEi6LN4pQZjBW+KEtlJaigPJpxZK
|
||||
+2ht97WIfDq6xsXafW3uf6/Gdv5jLzlyIH149/b8zuQIP9DLIgeLylWkaJ3mOsGfxXQGv2nJSUhB
|
||||
C/jpwxxTwmw3l3EhZcMVKNYgU8MXg0LK00JKYWcXqVZuQ3Ik/t9dd9Xob3yloDMp0msgDTcCbyHX
|
||||
BkGoiQat4EIJElzCpR5LtBbOJBe5O9Yeh5nByUnCkiNMtdK5SIOUS1QZN8mRKP2Cq9IvSL1fUHYf
|
||||
cTNFOknYaCy5ul532JfB3AjwVSl7yhprmQFPCQxmA62WJQbleAQ8pYLLSsHvtbEIwxlX1Zu3Ga5n
|
||||
3mE9Xf2o0XqxD3rijmsbzy2l3BJsBR0sV6thw71h5wZvYCx5eu3r2QZwRqELuxX/9XJxE397rjxg
|
||||
/cVqEqrAu/BcoiE31kJd+fMJCosm8MtBqhVxodC4AsueVzxHOEnYvn6pMo5PucJDljgVNkDFxxKd
|
||||
bcM5AGUNFXqby8IGItUKfDKnKOVzwxevZWFhimqotRyKOWiF0qW4AiGtJYm563aDnBCeOe/PrAGX
|
||||
ri29CYR1HSVucLXJ4HSELgLPshK8nLaSWLa6s2Tt/yIQUaPT9OQ7MGIjD52HykOj1WnulQfXMNa3
|
||||
/o5KRO1DVKLzqBKPKqEVvNRqwk0Or/nCaCkP0AdVegTzpUdQdtw+ZfgcAODJZaGePkQZpgZRbWmD
|
||||
m41dbThFIjSHiEM5W/1GOzpQHDzgveKwDBsdd+4Wh5XUbYe/TxqW0beH6U1JBDAwOodGN3zhyuo0
|
||||
v7JW7HbNrkpseOibVYm7yLsbPuTZvuF4+JG1H1n7MNZ+pzCfS73wJ/GGE95P20XFJTCcMCh7bh9v
|
||||
70D8C+LePARviK4b7hL3hYJfhEK4FTRb3jdOwh3bl8nbzVa/8cPxd4eSdzc8hLzvDbvvyd4D3E/f
|
||||
Pv7Ok/0S8Cuy9Re6ZYeuKwT0zdI1q7G5yCyL/2DVd7KY1VhViLevu2HM/qwxxzoTw3NksSqkrLn/
|
||||
JKETXRZ7gg7CdhC2Wbk+1NXVjsPlhueWxR9ZqgtFZuGSaLnAKSec6nJhtLlPziTyuTbEVYrO2Fil
|
||||
8btWyGLWPGYPzcJ5D4QkNCz2F6+UXCzX/9YKL7JVXD2ZWKS3mLI4qDebYVhjwpaumLGYTIE1NvHX
|
||||
pwWRVp7YWcxeKVZjUuSCWMzCWhSGlfhnhTGoaCjcMbJ6PW41K9aBNjl3bk+e/zqEoBmH4VNWYwb/
|
||||
KtDSuavI5e93kctiqYz1MDmqR+DDxVGLfaoxo2/tSBU5ixs1Jt18O5CRTfUcWbx5SauxsVDZyKbu
|
||||
KWY04yqT7mwmXFr0N83iOSd+unDnZYb+FY99+gcAAP//AwBwTFb0RxQAAA==
|
||||
headers:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 75910393ad3c03d2-LIS
|
||||
Cache-Control:
|
||||
- no-store, no-cache, must-revalidate
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Encoding:
|
||||
- gzip
|
||||
Content-Security-Policy:
|
||||
- upgrade-insecure-requests; block-all-mixed-content
|
||||
Content-Security-Policy-Report-Only:
|
||||
- 'default-src https: data: wss: ''unsafe-inline'' ''unsafe-eval''; form-action
|
||||
https:; report-uri https://rbmeuulvihtwm2eltjhwimi2.httpschecker.net/report'
|
||||
Content-Type:
|
||||
- text/html; charset=UTF-8
|
||||
Cross-Origin-Embedder-Policy:
|
||||
- unsafe-none
|
||||
Cross-Origin-Opener-Policy:
|
||||
- cross-origin
|
||||
Cross-Origin-Resource-Policy:
|
||||
- cross-origin
|
||||
Date:
|
||||
- Wed, 12 Oct 2022 15:54:25 GMT
|
||||
Expires:
|
||||
- Thu, 19 Nov 1981 08:52:00 GMT
|
||||
Pragma:
|
||||
- no-cache
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- ses_id=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/;
|
||||
domain=.investing.com
|
||||
- upa=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=www.investing.com
|
||||
- PHPSESSID=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/;
|
||||
SameSite=none; secure; HttpOnly
|
||||
- PHPSESSID=b8orihtfua44gc3hkkgtpvb16m; path=/
|
||||
- udid=adb249370e84b997b0fbca9945711e10; Max-Age=31536000; domain=investing.com;
|
||||
Path=/
|
||||
- smd=adb249370e84b997b0fbca9945711e10-1665590065; Max-Age=1800; domain=investing.com;
|
||||
Path=/
|
||||
- firstUdid=1; Max-Age=2; domain=investing.com; Path=/
|
||||
- __cf_bm=UtOl2GwgkvZLvnhazeGLdS0hGtxwnlFbJp2qFuwCFQ8-1665590065-0-AXBvQRYOYw5zYvJS3RiJphFZee3RyS346w7HhaP0fuPNFWL3Nn6mBabW+kOBsVC+PX3esK1i068AGfvE4q44Uuc=;
|
||||
path=/; expires=Wed, 12-Oct-22 16:24:25 GMT; domain=.investing.com; HttpOnly;
|
||||
Secure; SameSite=None
|
||||
- __cflb=02DiuGRugds2TUWHMkimMbdK71gXQtrnhQnmZwXWY3jrc; SameSite=None; Secure;
|
||||
path=/; expires=Thu, 13-Oct-22 14:54:25 GMT; HttpOnly
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Accept-Encoding,User-Agent
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: dateFrom=2022-07-07&dateTo=2022-07-08&timeZone=46&timeFilter=timeOnly¤tTab=custom&submitFilters=1&limit_from=1&country%5B%5D=5&category%5B%5D=_employment&importance%5B%5D=3
|
||||
headers:
|
||||
Accept:
|
||||
- text/html
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '178'
|
||||
Content-Type:
|
||||
- application/x-www-form-urlencoded
|
||||
User-Agent:
|
||||
- Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.9b5) Gecko/2008032620 Firefox/3.0b5
|
||||
X-Requested-With:
|
||||
- XMLHttpRequest
|
||||
method: POST
|
||||
uri: https://www.investing.com/economic-calendar/Service/getCalendarFilteredData
|
||||
response:
|
||||
body:
|
||||
string: !!binary |
|
||||
H4sIAAAAAAAAA5RRTW/TQBD9K9Y7gbRR1sahsEp7KCGIA1QiOVFX1rIeE0v7YXbHoFD1v6N10ipX
|
||||
5jZvZt57M/OITrOGQnGONceb4iLW3BUm2DRqf93gfYPCWJ3SdQMfvlGaLKfCkGeKDW6+huLjb/Kc
|
||||
ip05UDdZ6tbNkrsXxpyd+CEwDl2Cun8Q4MFRH7UjKD9ZK7Ip2sbgoFDJqlrIq4W8wgnfh0v0XSbS
|
||||
UbsE9QgTJs/xCHWPFR4EjGb6GU5AS2604ejIcy4NbgyRtTeUi29wtvE9eIJC/Rb/6yJPbwfLFKHm
|
||||
5M7b4xn/Gzx97p55Q98n4h0ZqEVZ11IKDOk0Sh0Ux4kE+jm/nZiD37Hm7OrOQ8AObuBZXIpKyguF
|
||||
D1OM5Hk/5EOiLNWqvqhuQ3Q6D7769GVfLGol5WsIRPo1UeJN3ilvMHdx9jGv1yxL2SzLqpjpVLXC
|
||||
k0AMf1LrJ/f8LqsTt1mnTSaML1/8MfiuTSYGa9uD9p3Np+m1TTT/LNFGs7495nPF/YE2+oinfwAA
|
||||
AP//AwDH59OwkQIAAA==
|
||||
headers:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 75910395d80594e9-LIS
|
||||
Cache-Control:
|
||||
- no-store, no-cache, must-revalidate
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Encoding:
|
||||
- gzip
|
||||
Content-Security-Policy:
|
||||
- upgrade-insecure-requests; block-all-mixed-content
|
||||
Content-Security-Policy-Report-Only:
|
||||
- 'default-src https: data: wss: ''unsafe-inline'' ''unsafe-eval''; form-action
|
||||
https:; report-uri https://rbmeuulvihtwm2eltjhwimi2.httpschecker.net/report'
|
||||
Content-Type:
|
||||
- text/html; charset=UTF-8
|
||||
Cross-Origin-Embedder-Policy:
|
||||
- unsafe-none
|
||||
Cross-Origin-Opener-Policy:
|
||||
- cross-origin
|
||||
Cross-Origin-Resource-Policy:
|
||||
- cross-origin
|
||||
Date:
|
||||
- Wed, 12 Oct 2022 15:54:25 GMT
|
||||
Expires:
|
||||
- Thu, 19 Nov 1981 08:52:00 GMT
|
||||
Pragma:
|
||||
- no-cache
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- ses_id=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/;
|
||||
domain=.investing.com
|
||||
- upa=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/; domain=www.investing.com
|
||||
- PHPSESSID=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0; path=/;
|
||||
SameSite=none; secure; HttpOnly
|
||||
- PHPSESSID=28jebr7s1m3pjt37tc0ipmigd6; path=/
|
||||
- udid=895546fd46c5bd2208d0dd39250be54b; Max-Age=31536000; domain=investing.com;
|
||||
Path=/
|
||||
- smd=895546fd46c5bd2208d0dd39250be54b-1665590065; Max-Age=1800; domain=investing.com;
|
||||
Path=/
|
||||
- firstUdid=1; Max-Age=2; domain=investing.com; Path=/
|
||||
- __cf_bm=DGv9Y8gTi1PgZynRNRzVcpZLgxv8WS5xxvWwc1TiKY4-1665590065-0-AQj9kgu4vNbhEb8ToScOK2xJVVAahD90OZd8ESYSrci8axGxoaBTk0d1ClXlzCVIDJDk+PnsZSBnk53e09Tf4Y8=;
|
||||
path=/; expires=Wed, 12-Oct-22 16:24:25 GMT; domain=.investing.com; HttpOnly;
|
||||
Secure; SameSite=None
|
||||
- __cflb=02DiuGRugds2TUWHMkimMbdK71gXQtrnhQnmZwXWY3jrc; SameSite=None; Secure;
|
||||
path=/; expires=Thu, 13-Oct-22 14:54:25 GMT; HttpOnly
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Vary:
|
||||
- Accept-Encoding,User-Agent
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
version: 1
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,6 +24,7 @@ def test_get_yieldcurve(country):
|
||||
assert isinstance(result_df, pd.DataFrame)
|
||||
|
||||
|
||||
@pytest.mark.vcr
|
||||
@pytest.mark.parametrize(
|
||||
"country, importance, category, start_date, end_date",
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user