mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
Fixed ccxt (#2666)
* Fixed ccxt * Tells you when a bad source is sent Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
This commit is contained in:
@@ -310,8 +310,8 @@ def load(
|
||||
exchange: str = "binance",
|
||||
vs_currency: str = "usdt",
|
||||
end_date: datetime = datetime.now(),
|
||||
source: str = "ccxt",
|
||||
):
|
||||
source: str = "CCXT",
|
||||
) -> pd.DataFrame:
|
||||
"""Load crypto currency to perform analysis on CoinGecko is used as source for price and
|
||||
YahooFinance for volume.
|
||||
|
||||
@@ -330,7 +330,7 @@ def load(
|
||||
Dataframe consisting of price and volume data
|
||||
"""
|
||||
df = pd.DataFrame()
|
||||
if source == "ccxt":
|
||||
if source == "CCXT":
|
||||
pair = f"{symbol.upper()}/{vs_currency.upper()}"
|
||||
try:
|
||||
df = fetch_ccxt_ohlc(
|
||||
@@ -410,6 +410,8 @@ def load(
|
||||
console.print(f"\nPair {pair} not found in Yahoo Finance\n")
|
||||
return pd.DataFrame()
|
||||
df.index.name = "date"
|
||||
else:
|
||||
console.print("[red]Invalid source sent[/red]\n")
|
||||
return df
|
||||
|
||||
|
||||
|
||||
@@ -262,6 +262,9 @@ def load(
|
||||
df_stock_candidate = load_stock_polygon(
|
||||
symbol, start_date, end_date, weekly, monthly
|
||||
)
|
||||
else:
|
||||
console.print("[red]Invalid source for stock[/red]\n")
|
||||
return
|
||||
if df_stock_candidate.empty:
|
||||
return df_stock_candidate
|
||||
|
||||
|
||||
Reference in New Issue
Block a user