mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
Remove broken crypto prices dashboard
This commit is contained in:
@@ -45,7 +45,6 @@ class DashboardsController(BaseController):
|
||||
"vsurf",
|
||||
"chains",
|
||||
"shortdata",
|
||||
"crypto",
|
||||
"futures",
|
||||
"forecast",
|
||||
"forecasting",
|
||||
@@ -80,7 +79,6 @@ class DashboardsController(BaseController):
|
||||
mt.add_cmd("vsurf")
|
||||
mt.add_cmd("chains")
|
||||
mt.add_cmd("shortdata")
|
||||
mt.add_cmd("crypto")
|
||||
mt.add_cmd("futures")
|
||||
mt.add_cmd("forecast")
|
||||
mt.add_raw("\nStreamlit Apps:\n")
|
||||
@@ -113,11 +111,6 @@ class DashboardsController(BaseController):
|
||||
"""Process shortdata command."""
|
||||
self.create_call_voila(other_args, "shortdata", "")
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_crypto(self, other_args: List[str]):
|
||||
"""Process crypto command."""
|
||||
self.create_call_voila(other_args, "crypto", "")
|
||||
|
||||
@log_start_end(log=logger)
|
||||
def call_futures(self, other_args: List[str]):
|
||||
"""Process futures command."""
|
||||
|
||||
163
openbb_terminal/dashboards/voila/crypto.ipynb
vendored
163
openbb_terminal/dashboards/voila/crypto.ipynb
vendored
@@ -1,163 +0,0 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "6e198e40-0c33-45b3-a79b-2d9ee9eff7b9",
|
||||
"metadata": {
|
||||
"tags": []
|
||||
},
|
||||
"source": [
|
||||
"# Cryptocurrency exchange rates to USD ($)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "da655985-c9b7-492e-aefa-fbe3bc1865d5",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import json\n",
|
||||
"import os\n",
|
||||
"\n",
|
||||
"import ipywidgets as ipw\n",
|
||||
"from IPython.display import display\n",
|
||||
"import pandas as pd\n",
|
||||
"\n",
|
||||
"from openbb_terminal.sdk import openbb, widgets\n",
|
||||
"\n",
|
||||
"ipw.HTML(f\"<style>{widgets.price_card_stylesheet()}</style>\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "dcbbf867-af50-4d06-ae5c-7c09647aa55d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"COIN_LIST = (\n",
|
||||
" \"BTC,ETH,USDT,BNB,USDC,XRP,LUNA,ADA,\"\n",
|
||||
" + \"SOL,AVAX,DOT,BUSD,DOGE,UST,SHIB,WBTC,\"\n",
|
||||
" + \"MATIC,CRO,DAI,LTC,ATOM,NEAR,LINK,BCH,\"\n",
|
||||
" + \"UNI,TRX,FTT,ETC,LEO,ALGO,XLM,MANA,\"\n",
|
||||
" + \"BTCB,HBAR,EGLD,ICP,SAND,XMR,WAVES,VET,\"\n",
|
||||
" + \"APE,FIL,FTM,AXS,THETA,KLAY,XTZ,RUNE\"\n",
|
||||
").split(\",\")\n",
|
||||
"exchange_rates = {}\n",
|
||||
"?openbb.crypto.load"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "deeeb80a-3675-44fb-9a1b-2325d8da4e7d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def get_exchange_rate(coin: str, days: int = 2):\n",
|
||||
" \"\"\"Get exchange rate for a cryptocurrency agains USD.\"\"\"\n",
|
||||
" current_df = openbb.crypto.load(\n",
|
||||
" symbol=coin,\n",
|
||||
" interval=\"1440\",\n",
|
||||
" source=\"CCXT\",\n",
|
||||
" )\n",
|
||||
" price_color = \"neutral_color\"\n",
|
||||
" if current_df[\"Close\"].iloc[-1] > current_df[\"Close\"].iloc[-2]:\n",
|
||||
" price_color = \"up_color\"\n",
|
||||
" elif current_df[\"Close\"].iloc[-1] < current_df[\"Close\"].iloc[-2]:\n",
|
||||
" price_color = \"down_color\"\n",
|
||||
" price = str(current_df[\"Close\"].iloc[-1])[:7]\n",
|
||||
"\n",
|
||||
" return price, price_color"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "18acf5cb-6cbf-484d-8042-107c030098de",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def show_rates(btn):\n",
|
||||
" \"\"\"Show exchange rates in grid box widget.\"\"\"\n",
|
||||
" grid.children = ()\n",
|
||||
" for coin in COIN_LIST:\n",
|
||||
" if coin not in exchange_rates.keys():\n",
|
||||
" exchange_rates[coin] = {\"price\": None, \"color\": None}\n",
|
||||
" try:\n",
|
||||
" price, price_color = get_exchange_rate(coin=coin)\n",
|
||||
" except Exception as e:\n",
|
||||
" price, price_color = \"-------\", \"neutral_color\"\n",
|
||||
" widgets = list(grid.children)\n",
|
||||
" widgets.append(\n",
|
||||
" ipw.HTML(\n",
|
||||
" api.widgets.price_card(\n",
|
||||
" ticker=coin,\n",
|
||||
" price=price,\n",
|
||||
" price_color=price_color,\n",
|
||||
" )\n",
|
||||
" )\n",
|
||||
" )\n",
|
||||
" grid.children = tuple(widgets)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "cf2021e9-de8a-466e-b341-fcd6abda64b5",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"update_rates = ipw.Button(description=\"Update rates\")\n",
|
||||
"update_rates.on_click(show_rates)\n",
|
||||
"header = ipw.HBox([update_rates])\n",
|
||||
"\n",
|
||||
"layout = ipw.Layout(grid_template_columns=\"1fr \" * 8)\n",
|
||||
"grid = ipw.GridBox(\n",
|
||||
" [],\n",
|
||||
" layout=layout,\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"display(header, grid)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "19dfcbfe-eaec-406e-bb3c-72d1b3538a6e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3.9.6 ('obb')",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.6"
|
||||
},
|
||||
"voila": {
|
||||
"theme": "dark"
|
||||
},
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
"hash": "cb66ba39c97f15743fbb79e204a841ea03600987d49579cfb0ffc8e8dd934c69"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user