Skip to content

Commit

Permalink
Add crypto dd functions to sdk (#3888)
Browse files Browse the repository at this point in the history
* Fix plot look when using eval and add query to choices (#3881)

* convert index to datetime and update choices

* uncomment economy integration test

* fix treasury concat bug

* fix datasets concat on duplciates

* Add crypto dd functions to sdk

* Lock ruff version so that new lints dont break our CI (#3905)

* Lock ruff version so that new lints dont break our CI

* Bumped pre-commit ruff version

* Fixes currency and trailmap

Co-authored-by: montezdesousa <[email protected]>
Co-authored-by: Colin Delahunty <[email protected]>
  • Loading branch information
3 people authored Jan 10, 2023
1 parent 26a59f3 commit 1aebf48
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 0 deletions.
115 changes: 115 additions & 0 deletions openbb_terminal/cryptocurrency/due_diligence/sdk_helper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
"""Crypto DD SDK helper"""
__docformat__ = "numpy"

import pandas as pd
import openbb_terminal.cryptocurrency.due_diligence.pycoingecko_model as gecko


def dev_stats(symbol: str) -> pd.DataFrame:
"""Get developer stats for a coin
Parameters
----------
symbol : str
Coin to get stats for
Returns
-------
pd.DataFrame
Dataframe of stats
Examples
--------
>>> from openbb_terminal.sdk import openbb
>>> btc_dev_stats = openbb.crypto.dd.dev("btc")
"""
coin = gecko.Coin(symbol)
return coin.get_developers_data()


def score(symbol: str) -> pd.DataFrame:
"""Get scores for a coin from CoinGecko
Parameters
----------
symbol : str
Coin to get scores for
Returns
-------
pd.DataFrame
Dataframe of scores
Examples
--------
>>> from openbb_terminal.sdk import openbb
>>> btc_scores = openbb.crypto.dd.score("btc")
"""
return gecko.Coin(symbol).get_scores()


def social(symbol: str) -> pd.DataFrame:
"""Get social media stats for a coin
Parameters
----------
symbol : str
Coin to get social stats for
Returns
-------
pd.DataFrame
Dataframe of social stats
Examples
--------
>>> from openbb_terminal.sdk import openbb
>>> btc_socials = openbb.crypto.dd.social("btc")
"""
return gecko.Coin(symbol).get_social_media()


def ath(symbol: str, currency: str = "USD") -> pd.DataFrame:
"""Get all time high for a coin in a given currency
Parameters
----------
symbol : str
Coin to get all time high for
currency: str
Currency to get all time high in
Returns
-------
pd.DataFrame
Dataframe of all time high
Examples
--------
>>> from openbb_terminal.sdk import openbb
>>> btc_ath = openbb.crypto.dd.ath("btc")
"""
return gecko.Coin(symbol).get_all_time_high(currency=currency.lower())


def atl(symbol: str, currency: str = "USD") -> pd.DataFrame:
"""Get all time low for a coin in a given currency
Parameters
----------
symbol : str
Coin to get all time low for
currency: str
Currency to get all time low in
Returns
-------
pd.DataFrame
Dataframe of all time low
Examples
--------
>>> from openbb_terminal.sdk import openbb
>>> btc_atl = openbb.crypto.dd.atl("btc")
"""
return gecko.Coin(symbol).get_all_time_low(currency=currency.lower())
5 changes: 5 additions & 0 deletions openbb_terminal/miscellaneous/library/trail_map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ crypto.dd.coin_market_chart,openbb_terminal.cryptocurrency.due_diligence.pycoing
crypto.dd.pr,openbb_terminal.cryptocurrency.due_diligence.pycoingecko_model.get_coin_potential_returns,openbb_terminal.cryptocurrency.due_diligence.pycoingecko_view.display_coin_potential_returns
crypto.dd.tokenomics,openbb_terminal.cryptocurrency.due_diligence.pycoingecko_model.get_coin_tokenomics,
crypto.dd.gh,openbb_terminal.cryptocurrency.due_diligence.santiment_model.get_github_activity,openbb_terminal.cryptocurrency.due_diligence.santiment_view.display_github_activity
crypto.dd.dev,openbb_terminal.cryptocurrency.due_diligence.sdk_helper.dev_stats,
crypto.dd.score,openbb_terminal.cryptocurrency.due_diligence.sdk_helper.score,
crypto.dd.social,openbb_terminal.cryptocurrency.due_diligence.sdk_helper.social,
crypto.dd.ath,openbb_terminal.cryptocurrency.due_diligence.sdk_helper.ath,
crypto.dd.atl,openbb_terminal.cryptocurrency.due_diligence.sdk_helper.atl,
crypto.nft.stats,openbb_terminal.cryptocurrency.nft.opensea_model.get_collection_stats,openbb_terminal.cryptocurrency.nft.opensea_view.display_collection_stats
crypto.nft.fp,openbb_terminal.cryptocurrency.nft.nftpricefloor_model.get_floor_price,openbb_terminal.cryptocurrency.nft.nftpricefloor_view.display_floor_price
crypto.nft.collections,openbb_terminal.cryptocurrency.nft.nftpricefloor_model.get_collections,openbb_terminal.cryptocurrency.nft.nftpricefloor_view.display_collections
Expand Down

0 comments on commit 1aebf48

Please sign in to comment.