Spaces:
Sleeping
Sleeping
Update actor with yfinance to search actions in yahoo finance
Browse files
app.py
CHANGED
@@ -6,13 +6,14 @@ import yaml
|
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
from Gradio_UI import GradioUI
|
8 |
import yfinance as yf
|
|
|
9 |
|
10 |
@tool
|
11 |
def busqueda_valor_accion(company_ticker: str) -> str:
|
12 |
-
"""A tool that looks up the value of stocks within yahoo, this requires the
|
13 |
|
14 |
Args:
|
15 |
-
company_ticker:str
|
16 |
|
17 |
|
18 |
Example use:
|
@@ -28,8 +29,7 @@ def busqueda_valor_accion(company_ticker: str) -> str:
|
|
28 |
longname = stock_info.get("longName", "N/A")
|
29 |
exchange = stock_info.get("exchange", "N/A")
|
30 |
currency = stock_info.get("currency", "USD")
|
31 |
-
stock_price = stock.history(period="1d")["Close"].iloc[-1]
|
32 |
-
|
33 |
return f"""
|
34 |
Nombre: {longname}
|
35 |
Símbolo (Ticker): {company_ticker}
|
@@ -37,6 +37,7 @@ def busqueda_valor_accion(company_ticker: str) -> str:
|
|
37 |
Precio de la acción: {round(stock_price,3)} {currency}
|
38 |
"""
|
39 |
except Exception as e:
|
|
|
40 |
return f"Error al obtener la información de la acción: {e}"
|
41 |
|
42 |
@tool
|
|
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
from Gradio_UI import GradioUI
|
8 |
import yfinance as yf
|
9 |
+
import time
|
10 |
|
11 |
@tool
|
12 |
def busqueda_valor_accion(company_ticker: str) -> str:
|
13 |
+
"""A tool that looks up the value of stocks within yahoo, this requires the Symbol of the specific company (Amazon example would be AMZN).
|
14 |
|
15 |
Args:
|
16 |
+
company_ticker:str Symbol of the company you want to query to perform the stock search.
|
17 |
|
18 |
|
19 |
Example use:
|
|
|
29 |
longname = stock_info.get("longName", "N/A")
|
30 |
exchange = stock_info.get("exchange", "N/A")
|
31 |
currency = stock_info.get("currency", "USD")
|
32 |
+
stock_price = stock.history(period="1d")["Close"].iloc[-1]
|
|
|
33 |
return f"""
|
34 |
Nombre: {longname}
|
35 |
Símbolo (Ticker): {company_ticker}
|
|
|
37 |
Precio de la acción: {round(stock_price,3)} {currency}
|
38 |
"""
|
39 |
except Exception as e:
|
40 |
+
time.sleep(20)
|
41 |
return f"Error al obtener la información de la acción: {e}"
|
42 |
|
43 |
@tool
|