Skip to content

Commit

Permalink
Merge pull request #12 from GamestonkTerminal/rich-crypto
Browse files Browse the repository at this point in the history
Add rich to cryptocurrency menu
  • Loading branch information
colin99d authored Jan 11, 2022
2 parents 85bdff1 + 88eabd4 commit 9ff8627
Show file tree
Hide file tree
Showing 9 changed files with 233 additions and 194 deletions.
61 changes: 32 additions & 29 deletions gamestonk_terminal/cryptocurrency/crypto_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import pandas as pd
from prompt_toolkit.completion import NestedCompleter
from binance.client import Client

from rich.panel import Panel
from gamestonk_terminal.rich_config import console
from gamestonk_terminal.parent_classes import BaseController
from gamestonk_terminal.cryptocurrency.pycoingecko_helpers import calc_change
Expand Down Expand Up @@ -93,36 +93,39 @@ def __init__(self, queue: List[str] = None):

def print_help(self):
"""Print help"""
help_text = """
load load a specific cryptocurrency for analysis
find find coins in a certain source
coins find coins and check map across multiple sources
source_txt = CRYPTO_SOURCES.get(self.source, "?") if self.source != "" else ""
has_ticker_start = "" if self.current_coin else "[unvl]"
has_ticker_end = "" if self.current_coin else "[/unvl]"
help_text = f"""[cmds]
load load a specific cryptocurrency for analysis
find find coins in a certain source
coins find coins and check map across multiple sources[/cmds]
[param]Coin: [/param]{self.current_coin}
[param]Source: [/param]{source_txt}
[cmds]
headlines crypto sentiment from 15+ major news headlines [src][Finbrain][/src]{has_ticker_start}
chart view a candle chart for a specific cryptocurrency
prt potential returns tool - check how much upside if ETH reaches BTC market cap{has_ticker_end}
[/cmds][menu]
> disc discover trending cryptocurrencies, e.g.: top gainers, losers, top sentiment
> ov overview of the cryptocurrencies, e.g.: market cap, DeFi, latest news, top exchanges, stables
> onchain information on different blockchains, e.g.: eth gas fees, whale alerts, DEXes info
> defi decentralized finance information, e.g.: dpi, llama, tvl, lending, borrow, funding
> nft non-fungible tokens, e.g.: today drops{has_ticker_start}
> dd due-diligence for loaded coin, e.g.: coin information, social media, market stats
> ta technical analysis for loaded coin, e.g.: ema, macd, rsi, adx, bbands, obv
> pred prediction techniques e.g.: regression, arima, rnn, lstm, conv1d, monte carlo[/menu]
{has_ticker_end}
"""
help_text += (
f"\nCoin: {self.current_coin}" if self.current_coin != "" else "\nCoin: ?"
)
help_text += (
f"\nSource: {CRYPTO_SOURCES.get(self.source, '?')}\n"
if self.source != ""
else "\nSource: ?\n"
console.print(
Panel(
help_text,
title="Cryptocurrency",
subtitle_align="right",
subtitle="Gamestonk Terminal",
)
)
help_text += self.price_str + "\n"
help_text += f"""
headlines crypto sentiment from 15+ major news headlines [Finbrain]{'[dim]' if not self.current_coin else ''}
chart view a candle chart for a specific cryptocurrency
prt potential returns tool e.g.: check how much upside if eth reaches btc market cap{'[/dim]' if not self.current_coin else ''}
""" # noqa
help_text += f"""
> disc discover trending cryptocurrencies, e.g.: top gainers, losers, top sentiment
> ov overview of the cryptocurrencies, e.g.: market cap, DeFi, latest news, top exchanges, stables
> onchain information on different blockchains, e.g.: eth gas fees, whale alerts, DEXes info
> defi decentralized finance information, e.g.: dpi, llama, tvl, lending, borrow, funding
> nft non-fungible tokens, e.g.: today drops{'[dim]' if not self.current_coin else ''}
> dd due-diligence for loaded coin, e.g.: coin information, social media, market stats
> ta technical analysis for loaded coin, e.g.: ema, macd, rsi, adx, bbands, obv
> pred prediction techniques e.g.: regression, arima, rnn, lstm, conv1d, monte carlo{'[/dim]' if not self.current_coin else ''}
""" # noqa
console.print(help_text)

def call_prt(self, other_args):
"""Process prt command"""
Expand Down
39 changes: 22 additions & 17 deletions gamestonk_terminal/cryptocurrency/defi/defi_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

from typing import List
from prompt_toolkit.completion import NestedCompleter

from rich.panel import Panel
from gamestonk_terminal.rich_config import console
from gamestonk_terminal.cryptocurrency.defi import graph_model, coindix_model
from gamestonk_terminal.parent_classes import BaseController
from gamestonk_terminal import feature_flags as gtff
Expand All @@ -26,7 +27,6 @@
graph_view,
coindix_view,
)
from gamestonk_terminal.rich_config import console


class DefiController(BaseController):
Expand Down Expand Up @@ -67,26 +67,31 @@ def __init__(self, queue: List[str] = None):

def print_help(self):
"""Print help"""
help_text = """
Decentralized Finance Menu:
Overview:
llama DeFi protocols listed on DeFi Llama
tvl Total value locked of DeFi protocols
newsletter Recent DeFi related newsletters
dpi DeFi protocols listed on DefiPulse
funding Funding rates - current or last 30 days average
borrow DeFi borrow rates - current or last 30 days average
lending DeFi ending rates - current or last 30 days average
vaults Top DeFi Vaults on different blockchains [Source: Coindix]
Uniswap:
help_text = """[cmds]
[info]Overview:[/info]
llama DeFi protocols listed on DeFi Llama [src][Llama][/src]
tvl Total value locked of DeFi protocols [src][Llama][/src]
newsletter Recent DeFi related newsletters [src][Substack][/src]
dpi DeFi protocols listed on DefiPulse [src][Defipulse][/src]
funding Funding rates - current or last 30 days average [src][Defirate][/src]
borrow DeFi borrow rates - current or last 30 days average [src][Defirate][/src]
lending DeFi ending rates - current or last 30 days average [src][Defirate][/src]
vaults Top DeFi Vaults on different blockchains [src][[Coindix][/src]
[src][The Graph][/src] [info]Uniswap:[/info]
tokens Tokens trade-able on Uniswap
stats Base statistics about Uniswap
pairs Recently added pairs on Uniswap
pools Pools by volume on Uniswap
swaps Recent swaps done on Uniswap
swaps Recent swaps done on Uniswap[/cmds]
"""
console.print(help_text)
console.print(
Panel(
help_text,
title="Cryptocurrency - Decentralized Finance",
subtitle_align="right",
subtitle="Gamestonk Terminal",
)
)

def call_dpi(self, other_args: List[str]):
"""Process dpi command"""
Expand Down
34 changes: 21 additions & 13 deletions gamestonk_terminal/cryptocurrency/discovery/discovery_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import argparse
from typing import List
from prompt_toolkit.completion import NestedCompleter
from rich.panel import Panel
from gamestonk_terminal.rich_config import console
from gamestonk_terminal.parent_classes import BaseController
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.helper_funcs import (
Expand All @@ -21,7 +23,6 @@
coinpaprika_view,
coinmarketcap_view,
)
from gamestonk_terminal.rich_config import console


class DiscoveryController(BaseController):
Expand Down Expand Up @@ -92,26 +93,33 @@ def __init__(self, queue: List[str] = None):

def print_help(self):
"""Print help"""
help_text = """
CoinGecko:
cgtrending trending coins on CoinGecko
cgvoted most voted coins on CoinGecko
cgvisited most visited coins on CoinGecko
cgvolume coins with highest volume on CoinGecko
cgrecently recently added on CoinGecko
help_text = """[cmds]
[src][CoinGecko][/src]
cgtrending trending coins
cgvoted most voted coins
cgvisited most visited coins
cgvolume coins with highest volume
cgrecently recently added
cgsentiment coins with most positive sentiment
cggainers top gainers - coins which price gained the most in given period
cglosers top losers - coins which price dropped the most in given period
cgyfarms top yield farms
cgdefi top defi protocols
cgdex top decentralized exchanges
cgnft top non fungible tokens
CoinPaprika:
cpsearch search on CoinPaprika
CoinMarketCap:
cmctop top coins from CoinMarketCap
[src][CoinPaprika][/src]
cpsearch search for coins
[src][CoinMarketCap][/src]
cmctop top coins[/cmds]
"""
console.print(help_text)
console.print(
Panel(
help_text,
title="Cryptocurrency - Discovery",
subtitle_align="right",
subtitle="Gamestonk Terminal",
)
)

def call_cggainers(self, other_args):
"""Process gainers command"""
Expand Down
44 changes: 23 additions & 21 deletions gamestonk_terminal/cryptocurrency/due_diligence/dd_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from datetime import datetime, timedelta
import pandas as pd
from prompt_toolkit.completion import NestedCompleter
from rich.panel import Panel
from gamestonk_terminal.rich_config import console
from gamestonk_terminal.parent_classes import BaseController
from gamestonk_terminal.cryptocurrency.due_diligence import (
coinglass_model,
Expand Down Expand Up @@ -36,7 +38,6 @@
from gamestonk_terminal.cryptocurrency.cryptocurrency_helpers import (
load,
)
from gamestonk_terminal.rich_config import console

FILTERS_VS_USD_BTC = ["usd", "btc"]

Expand Down Expand Up @@ -136,34 +137,28 @@ def __init__(

def print_help(self):
"""Print help"""
help_text = "Due Diligence Menu:\n"
help_text += """
source_txt = CRYPTO_SOURCES.get(self.source, "?") if self.source != "" else ""
help_text = f"""[cmds]
load load a specific cryptocurrency for analysis
"""
help_text += (
f"\nCoin: {self.current_coin}" if self.current_coin != "" else "\nCoin: ?"
)
help_text += (
f"\nSource: {CRYPTO_SOURCES.get(self.source, '?')}\n"
if self.source != ""
else "\nSource: ?\n"
)
help_text += """
Glassnode:
[param]Coin: [/param]{self.current_coin}
[param]Source: [/param]{source_txt}
[src]Glassnode[/src]
active active addresses
nonzero addresses with non-zero balances
change 30d change of supply held on exchange wallets
eb total balance held on exchanges (in percentage and units)
Coinglass:
[src]Coinglass[/src]
oi open interest per exchange
CoinPaprika:
[src]CoinPaprika[/src]
basic basic information about loaded coin
ps price and supply related metrics for loaded coin
mkt all markets for loaded coin
ex all exchanges where loaded coin is listed
twitter tweets for loaded coin
events events related to loaded coin
CoinGecko:
[src]CoinGecko[/src]
info basic information about loaded coin
market market stats about loaded coin
ath all time high related stats for loaded coin
Expand All @@ -173,15 +168,22 @@ def print_help(self):
score different kind of scores for loaded coin, e.g developer score, sentiment score
dev github, bitbucket coin development statistics
bc links to blockchain explorers for loaded coin
Binance:
[src]Binance[/src]
binbook show order book
balance show coin balance
Coinbase:
[src]Coinbase[/src]
cbbook show order book
trades show last trades
stats show coin stats
stats show coin stats[/cmds]
"""
console.print(help_text)
console.print(
Panel(
help_text,
title="Stocks - Due Diligence",
subtitle_align="right",
subtitle="Gamestonk Terminal",
)
)

def custom_reset(self):
"""Class specific component of reset command"""
Expand Down
20 changes: 14 additions & 6 deletions gamestonk_terminal/cryptocurrency/nft/nft_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from typing import List

from prompt_toolkit.completion import NestedCompleter
from rich.panel import Panel
from gamestonk_terminal.rich_config import console
from gamestonk_terminal.parent_classes import BaseController
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.menu import session
Expand All @@ -12,7 +14,6 @@
)

from gamestonk_terminal.cryptocurrency.nft import nftcalendar_view, opensea_view
from gamestonk_terminal.rich_config import console


class NFTController(BaseController):
Expand All @@ -31,16 +32,23 @@ def __init__(self, queue: List[str] = None):
def print_help(self):
"""Print help"""

help_text = """
nftcalendar.io:
help_text = """[cmds]
[src][Nftcalendar.io][/src]
today today's NFT drops
upcoming upcoming NFT drops
ongoing Ongoing NFT drops
newest Recently NFTs added
opensea.io
stats check open sea collection stats
[src][Opensea.io][/src]
stats check open sea collection stats[/cmds]
"""
console.print(help_text)
console.print(
Panel(
help_text,
title="Cryptocurrency - Non Fungible Token",
subtitle_align="right",
subtitle="Gamestonk Terminal",
)
)

def call_stats(self, other_args: List[str]):
"""Process stats command"""
Expand Down
Loading

0 comments on commit 9ff8627

Please sign in to comment.