-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4126ae7
commit 1fcac6e
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
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,18 @@ | ||
# filename: stock_price_chart.py | ||
import yfinance as yf | ||
import matplotlib.pyplot as plt | ||
|
||
# Define the ticker symbols for NVDA and TESLA | ||
tickers = ['NVDA', 'TSLA'] | ||
|
||
# Fetch the historical stock price data for YTD | ||
data = yf.download(tickers, start='2021-01-01', end='2021-12-31') | ||
|
||
# Extract the 'Close' price column for each ticker | ||
close_prices = data['Close'] | ||
|
||
# Plot the stock price change YTD | ||
close_prices.plot(title='Stock Price Change YTD', ylabel='Price (USD)') | ||
|
||
# Display the chart | ||
plt.show() |
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,19 @@ | ||
|
||
# filename: stock_price_chart.py | ||
import yfinance as yf | ||
import matplotlib.pyplot as plt | ||
|
||
# Define the ticker symbols for NVDA and TESLA | ||
tickers = ['NVDA', 'TSLA'] | ||
|
||
# Fetch the historical stock price data for YTD | ||
data = yf.download(tickers, start='2021-01-01', end='2021-12-31') | ||
|
||
# Extract the 'Close' price column for each ticker | ||
close_prices = data['Close'] | ||
|
||
# Plot the stock price change YTD | ||
close_prices.plot(title='Stock Price Change YTD', ylabel='Price (USD)') | ||
|
||
# Display the chart | ||
plt.show() |
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,38 @@ | ||
import sys | ||
from autogen import AssistantAgent, UserProxyAgent | ||
from dotenv import load_dotenv | ||
import os | ||
|
||
# Load the .env info | ||
load_dotenv() | ||
api_key = os.getenv('OPENAI_API_KEY') | ||
|
||
print(sys.path) | ||
print("pyautogen imported successfully") | ||
|
||
config_list = [ | ||
{ | ||
"model": "gpt-3.5-turbo", | ||
"api_key": api_key | ||
} | ||
# Add more configurations if needed | ||
] | ||
|
||
# Create AssistantAgent with the llm_config | ||
assistant = AssistantAgent( | ||
name="assistant", | ||
llm_config={ | ||
"seed": 42, | ||
"config_list": config_list, | ||
"temperature": 0, | ||
} | ||
) | ||
|
||
# Create a UserProxyAgent with configuration for code execution | ||
user_proxy = UserProxyAgent( | ||
name="user_proxy", | ||
code_execution_config={"work_dir": "coding", "use_docker": False} # Set to True to run code in docker | ||
) | ||
|
||
# Initiate a chat between the two agents to perform a task | ||
user_proxy.initiate_chat(assistant, message="Plot a chart of NVDA and TESLA stock price change YTD.") |