Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -13,12 +13,14 @@
|
|
13 |
# https://platform.openai.com/docs/assistants/tools
|
14 |
|
15 |
import gradio as gr
|
|
|
16 |
import yfinance as yf
|
17 |
|
18 |
import json, openai, os, time
|
19 |
|
20 |
from datetime import date
|
21 |
from openai import OpenAI
|
|
|
22 |
from utils import function_to_schema, show_json
|
23 |
|
24 |
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
|
@@ -32,11 +34,12 @@ def today_tool(text: str) -> str:
|
|
32 |
This function always returns today's date."""
|
33 |
return str(date.today())
|
34 |
|
35 |
-
def yfinance_download_tool(tickers: List[str], start: date, end: date) -> DataFrame:
|
36 |
-
"""Returns stock data for given tickers from a start date to an end date
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
40 |
return yf.download(tickers, start=start_date, end=end_date)
|
41 |
|
42 |
tools = {
|
|
|
13 |
# https://platform.openai.com/docs/assistants/tools
|
14 |
|
15 |
import gradio as gr
|
16 |
+
import pandas as pd
|
17 |
import yfinance as yf
|
18 |
|
19 |
import json, openai, os, time
|
20 |
|
21 |
from datetime import date
|
22 |
from openai import OpenAI
|
23 |
+
from typing import List
|
24 |
from utils import function_to_schema, show_json
|
25 |
|
26 |
client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
|
|
|
34 |
This function always returns today's date."""
|
35 |
return str(date.today())
|
36 |
|
37 |
+
def yfinance_download_tool(tickers: List[str], start: date, end: date) -> pd.DataFrame:
|
38 |
+
"""Returns historical stock data for given tickers from a start date to an end date
|
39 |
+
using the yfinance library download function.
|
40 |
+
Use this function for any questions related to getting historical stock data.
|
41 |
+
The input should be the tickers as a List of strings, a start date, and an end date.
|
42 |
+
This function always returns a pandas DataFrame."""
|
43 |
return yf.download(tickers, start=start_date, end=end_date)
|
44 |
|
45 |
tools = {
|