-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add crypto dd functions to sdk (#3888)
* 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
1 parent
26a59f3
commit 1aebf48
Showing
2 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
openbb_terminal/cryptocurrency/due_diligence/sdk_helper.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters