summaryrefslogtreecommitdiffstats
path: root/gamestonk_terminal/cryptocurrency/due_diligence/dd_controller.py
diff options
context:
space:
mode:
Diffstat (limited to 'gamestonk_terminal/cryptocurrency/due_diligence/dd_controller.py')
-rw-r--r--gamestonk_terminal/cryptocurrency/due_diligence/dd_controller.py888
1 files changed, 867 insertions, 21 deletions
diff --git a/gamestonk_terminal/cryptocurrency/due_diligence/dd_controller.py b/gamestonk_terminal/cryptocurrency/due_diligence/dd_controller.py
index 915c440ec98..658f2ec5b38 100644
--- a/gamestonk_terminal/cryptocurrency/due_diligence/dd_controller.py
+++ b/gamestonk_terminal/cryptocurrency/due_diligence/dd_controller.py
@@ -5,15 +5,26 @@ __docformat__ = "numpy"
import argparse
import os
import pandas as pd
+from binance.client import Client
from prompt_toolkit.completion import NestedCompleter
from gamestonk_terminal import feature_flags as gtff
-from gamestonk_terminal.helper_funcs import get_flair
from gamestonk_terminal.menu import session
from gamestonk_terminal.cryptocurrency.due_diligence import (
pycoingecko_view,
coinpaprika_view,
binance_view,
)
+from gamestonk_terminal.helper_funcs import (
+ get_flair,
+ parse_known_args_and_warn,
+ check_positive,
+)
+from gamestonk_terminal.cryptocurrency.due_diligence.binance_model import (
+ show_available_pairs_for_given_symbol,
+)
+from gamestonk_terminal.cryptocurrency.due_diligence.coinpaprika_view import CURRENCIES
+from gamestonk_terminal.cryptocurrency.cryptocurrency_helpers import plot_chart
+import gamestonk_terminal.config_terminal as cfg
class DueDiligenceController:
@@ -163,7 +174,38 @@ Binance:
def call_info(self, other_args):
"""Process info command"""
if self.current_coin:
- pycoingecko_view.info(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ prog="info",
+ description="""
+ Shows basic information about loaded coin like:
+ Name, Symbol, Description, Market Cap, Public Interest, Supply, and Price related metrics
+ """,
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+
+ if not ns_parser:
+ return
+
+ pycoingecko_view.display_info(
+ coin=self.current_coin, export=ns_parser.export
+ )
+
+ except Exception as e:
+ print(e, "\n")
+
else:
print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
@@ -172,7 +214,35 @@ Binance:
def call_market(self, other_args):
"""Process market command"""
if self.current_coin:
- pycoingecko_view.market(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ prog="market",
+ description="""
+ Market data for loaded coin. There you find metrics like:
+ Market Cap, Supply, Circulating Supply, Price, Volume and many others.
+ """,
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+
+ if not ns_parser:
+ return
+
+ pycoingecko_view.display_market(self.current_coin, ns_parser.export)
+
+ except Exception as e:
+ print(e, "\n")
else:
print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
@@ -181,7 +251,33 @@ Binance:
def call_web(self, other_args):
"""Process web command"""
if self.current_coin:
- pycoingecko_view.web(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ prog="web",
+ description="""Websites found for given Coin. You can find there urls to
+ homepage, forum, announcement site and others.""",
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+
+ if not ns_parser:
+ return
+
+ pycoingecko_view.display_web(self.current_coin, export=ns_parser.export)
+
+ except Exception as e:
+ print(e, "\n")
else:
print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
@@ -190,7 +286,36 @@ Binance:
def call_social(self, other_args):
"""Process social command"""
if self.current_coin:
- pycoingecko_view.social(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ prog="social",
+ description="""Shows social media corresponding to loaded coin. You can find there name of
+ telegram channel, urls to twitter, reddit, bitcointalk, facebook and discord.""",
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+
+ if not ns_parser:
+ return
+
+ pycoingecko_view.display_social(
+ self.current_coin, export=ns_parser.export
+ )
+
+ except Exception as e:
+ print(e, "\n")
+
else:
print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
@@ -199,7 +324,36 @@ Binance:
def call_dev(self, other_args):
"""Process dev command"""
if self.current_coin:
- pycoingecko_view.dev(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ prog="dev",
+ description="""
+ Developers data for loaded coin. If the development data is available you can see
+ how the code development of given coin is going on.
+ There are some statistics that shows number of stars, forks, subscribers, pull requests,
+ commits, merges, contributors on github.""",
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+
+ if not ns_parser:
+ return
+
+ pycoingecko_view.display_dev(self.current_coin, ns_parser.export)
+
+ except Exception as e:
+ print(e, "\n")
else:
print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
@@ -208,7 +362,41 @@ Binance:
def call_ath(self, other_args):
"""Process ath command"""
if self.current_coin:
- pycoingecko_view.ath(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ prog="ath",
+ description="""All time high data for loaded coin""",
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ parser.add_argument(
+ "--vs",
+ dest="vs",
+ help="currency",
+ default="usd",
+ choices=["usd", "btc"],
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+
+ if not ns_parser:
+ return
+ pycoingecko_view.display_ath(
+ self.current_coin, ns_parser.vs, ns_parser.export
+ )
+
+ except Exception as e:
+ print(e, "\n")
else:
print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
@@ -217,7 +405,43 @@ Binance:
def call_atl(self, other_args):
"""Process atl command"""
if self.current_coin:
- pycoingecko_view.atl(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ prog="atl",
+ description="""All time low data for loaded coin""",
+ )
+
+ parser.add_argument(
+ "--vs",
+ dest="vs",
+ help="currency",
+ default="usd",
+ choices=["usd", "btc"],
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+
+ if not ns_parser:
+ return
+
+ pycoingecko_view.display_atl(
+ self.current_coin, ns_parser.vs, ns_parser.export
+ )
+
+ except Exception as e:
+ print(e, "\n")
+
else:
print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
@@ -226,7 +450,37 @@ Binance:
def call_score(self, other_args):
"""Process score command"""
if self.current_coin:
- pycoingecko_view.score(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ prog="score",
+ description="""
+ In this view you can find different kind of scores for loaded coin.
+ Those scores represents different rankings, sentiment metrics, some user stats and others.
+ You will see CoinGecko scores, Developer Scores, Community Scores, Sentiment, Reddit scores
+ and many others.
+ """,
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+
+ if not ns_parser:
+ return
+
+ pycoingecko_view.display_score(self.current_coin, ns_parser.export)
+
+ except Exception as e:
+ print(e, "\n")
else:
print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
@@ -235,7 +489,36 @@ Binance:
def call_bc(self, other_args):
"""Process bc command"""
if self.current_coin:
- pycoingecko_view.bc(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ prog="bc",
+ description="""
+ Blockchain explorers URLs for loaded coin. Those are sites like etherescan.io or polkascan.io
+ in which you can see all blockchain data e.g. all txs, all tokens, all contracts...
+ """,
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+
+ if not ns_parser:
+ return
+
+ pycoingecko_view.display_bc(self.current_coin, ns_parser.export)
+
+ except Exception as e:
+ print(e, "\n")
+
else:
print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
@@ -244,23 +527,270 @@ Binance:
# binance
def call_book(self, other_args):
"""Process book command"""
- binance_view.order_book(other_args, self.current_coin)
+ limit_list = [5, 10, 20, 50, 100, 500, 1000, 5000]
+ _, quotes = show_available_pairs_for_given_symbol(self.current_coin)
+
+ parser = argparse.ArgumentParser(
+ prog="book",
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ description="Get the order book for selected coin",
+ )
+
+ parser.add_argument(
+ "-l",
+ "--limit",
+ dest="limit",
+ help="Limit parameter. Adjusts the weight",
+ default=100,
+ type=int,
+ choices=limit_list,
+ )
+
+ parser.add_argument(
+ "--vs",
+ help="Quote currency (what to view coin vs)",
+ dest="vs",
+ type=str,
+ default="USDT",
+ choices=quotes,
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+ if not ns_parser:
+ return
+
+ binance_view.display_order_book(
+ coin=self.current_coin,
+ limit=ns_parser.limit,
+ currency=ns_parser.vs,
+ export=ns_parser.export,
+ )
+
+ except Exception as e:
+ print(e, "\n")
def call_balance(self, other_args):
"""Process balance command"""
- binance_view.balance(other_args, self.current_coin)
+ _, quotes = show_available_pairs_for_given_symbol(self.current_coin)
+
+ parser = argparse.ArgumentParser(
+ prog="balance",
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ description="Chart",
+ )
+
+ parser.add_argument(
+ "--vs",
+ help="Quote currency (what to view coin vs)",
+ dest="vs",
+ type=str,
+ default="USDT",
+ choices=quotes,
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+
+ if not ns_parser:
+ return
+ binance_view.display_balance(
+ coin=self.current_coin, currency=ns_parser.vs, export=ns_parser.export
+ )
+
+ except Exception as e:
+ print(e, "\n")
def call_chart(self, other_args):
"""Process chart command"""
- getattr(self.DD_VIEWS_MAPPING[self.source], "chart")(
- self.current_coin, other_args
- )
+ if self.current_coin:
+ parser = argparse.ArgumentParser(
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ prog="ta",
+ description="""Loads data for technical analysis. You can specify currency vs which you want
+ to show chart and also number of days to get data for.
+ By default currency: usd and days: 30.
+ E.g. if you loaded in previous step Ethereum and you want to see it's price vs btc
+ in last 90 days range use `ta --vs btc --days 90`""",
+ )
+
+ if self.source == "cp":
+ parser.add_argument(
+ "--vs",
+ default="usd",
+ dest="vs",
+ help="Currency to display vs coin",
+ choices=["usd", "btc", "BTC", "USD"],
+ type=str,
+ )
+
+ parser.add_argument(
+ "-d",
+ "--days",
+ default=30,
+ dest="days",
+ help="Number of days to get data for",
+ type=check_positive,
+ )
+
+ if self.source == "cg":
+ parser.add_argument(
+ "--vs", default="usd", dest="vs", help="Currency to display vs coin"
+ )
+
+ parser.add_argument(
+ "-d",
+ "--days",
+ default=30,
+ dest="days",
+ help="Number of days to get data for",
+ )
+
+ if self.source == "bin":
+ client = Client(cfg.API_BINANCE_KEY, cfg.API_BINANCE_SECRET)
+ interval_map = {
+ "1day": client.KLINE_INTERVAL_1DAY,
+ "3day": client.KLINE_INTERVAL_3DAY,
+ "1hour": client.KLINE_INTERVAL_1HOUR,
+ "2hour": client.KLINE_INTERVAL_2HOUR,
+ "4hour": client.KLINE_INTERVAL_4HOUR,
+ "6hour": client.KLINE_INTERVAL_6HOUR,
+ "8hour": client.KLINE_INTERVAL_8HOUR,
+ "12hour": client.KLINE_INTERVAL_12HOUR,
+ "1week": client.KLINE_INTERVAL_1WEEK,
+ "1min": client.KLINE_INTERVAL_1MINUTE,
+ "3min": client.KLINE_INTERVAL_3MINUTE,
+ "5min": client.KLINE_INTERVAL_5MINUTE,
+ "15min": client.KLINE_INTERVAL_15MINUTE,
+ "30min": client.KLINE_INTERVAL_30MINUTE,
+ "1month": client.KLINE_INTERVAL_1MONTH,
+ }
+
+ _, quotes = show_available_pairs_for_given_symbol(self.current_coin)
+
+ parser.add_argument(
+ "--vs",
+ help="Quote currency (what to view coin vs)",
+ dest="vs",
+ type=str,
+ default="USDT",
+ choices=quotes,
+ )
+
+ parser.add_argument(
+ "-i",
+ "--interval",
+ help="Interval to get data",
+ choices=list(interval_map.keys()),
+ dest="interval",
+ default="1day",
+ type=str,
+ )
+
+ parser.add_argument(
+ "-l",
+ "--limit",
+ dest="limit",
+ default=100,
+ help="Number to get",
+ type=check_positive,
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+
+ if not ns_parser:
+ return
+
+ if self.source == "bin":
+ limit = ns_parser.limit
+ interval = ns_parser.interval
+ days = 0
+ else:
+ limit = 0
+ interval = "1day"
+ days = ns_parser.days
+
+ plot_chart(
+ coin=self.current_coin,
+ limit=limit,
+ interval=interval,
+ days=days,
+ currency=ns_parser.vs,
+ source=self.source,
+ )
+
+ except Exception as e:
+ print(e, "\n")
+
+ else:
+ print(
+ "No coin selected. Use 'load' to load the coin you want to look at.\n"
+ )
# paprika
def call_ps(self, other_args):
"""Process ps command"""
if self.current_coin:
- coinpaprika_view.price_supply(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ prog="ps",
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ description="""Get price and supply related metrics for given coin.""",
+ )
+
+ parser.add_argument(
+ "--vs",
+ help="Quoted currency. Default USD",
+ dest="vs",
+ default="USD",
+ type=str,
+ choices=CURRENCIES,
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+ if not ns_parser:
+ return
+
+ coinpaprika_view.display_price_supply(
+ self.current_coin, ns_parser.vs, ns_parser.export
+ )
+
+ except Exception as e:
+ print(e, "\n")
+
else:
print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
@@ -269,7 +799,33 @@ Binance:
def call_basic(self, other_args):
"""Process basic command"""
if self.current_coin:
- coinpaprika_view.basic(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ prog="basic",
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ description="""Get basic information for coin. Like:
+ name, symbol, rank, type, description, platform, proof_type,
+ contract, tags, parent""",
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+ if not ns_parser:
+ return
+
+ coinpaprika_view.display_basic(self.current_coin, ns_parser.export)
+
+ except Exception as e:
+ print(e, "\n")
else:
print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
@@ -278,7 +834,99 @@ Binance:
def call_mkt(self, other_args):
"""Process mkt command"""
if self.current_coin:
- coinpaprika_view.markets(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ prog="mkt",
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ description="""Get all markets found for given coin.
+ You can display only top N number of markets with --top parameter.
+ You can sort data by pct_volume_share, exchange, pair, trust_score, volume, price --sort parameter
+ and also with --descend flag to sort descending.
+ You can use additional flag --links to see urls for each market
+ Displays:
+ exchange, pair, trust_score, volume, price, pct_volume_share,""",
+ )
+
+ parser.add_argument(
+ "--vs",
+ help="Quoted currency. Default USD",
+ dest="vs",
+ default="USD",
+ type=str,
+ choices=CURRENCIES,
+ )
+
+ parser.add_argument(
+ "-t",
+ "--top",
+ default=20,
+ dest="top",
+ help="Limit of records",
+ type=check_positive,
+ )
+
+ parser.add_argument(
+ "-s",
+ "--sort",
+ dest="sortby",
+ type=str,
+ help="Sort by given column. Default: pct_volume_share",
+ default="pct_volume_share",
+ choices=[
+ "pct_volume_share",
+ "exchange",
+ "pair",
+ "trust_score",
+ "volume",
+ "price",
+ ],
+ )
+
+ parser.add_argument(
+ "--descend",
+ action="store_false",
+ help="Flag to sort in descending order (lowest first)",
+ dest="descend",
+ default=False,
+ )
+
+ parser.add_argument(
+ "-l",
+ "--links",
+ dest="links",
+ action="store_true",
+ help="""Flag to show urls. If you will use that flag you will see only:
+ exchange, pair, trust_score, market_url columns""",
+ default=False,
+ )
+
+ parser.add_argument(
+ "--export",
+ choices=["csv", "json", "xlsx"],
+ default="",
+ type=str,
+ dest="export",
+ help="Export dataframe data to csv,json,xlsx file",
+ )
+
+ try:
+ ns_parser = parse_known_args_and_warn(parser, other_args)
+ if not ns_parser:
+ return
+
+ coinpaprika_view.display_markets(
+ coin_id=self.current_coin,
+ currency=ns_parser.vs,
+ top=ns_parser.top,
+ sortby=ns_parser.sortby,
+ descend=ns_parser.descend,
+ links=ns_parser.links,
+ export=ns_parser.export,
+ )
+
+ except Exception as e:
+ print(e, "\n")
+
else:
print(
"No coin selected. Use 'load' to load the coin you want to look at.\n"
@@ -287,7 +935,69 @@ Binance:
def call_ex(self, other_args):
"""Process ex command"""
if self.current_coin:
- coinpaprika_view.exchanges(self.current_coin, other_args)
+ parser = argparse.ArgumentParser(
+ add_help=False,
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
+ prog="ex",
+ description="""Get all exchanges found for