This file contains hidden or 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
# Use Ubuntu 20.04 LTS as a base image | |
FROM ubuntu:20.04 | |
# Prevent apt from asking questions when installing packages | |
ARG DEBIAN_FRONTEND=noninteractive | |
# Set the working directory in the container | |
WORKDIR /app | |
# Install PostgreSQL, Python, Tesseract-OCR, and other necessary packages in one RUN command |
This file contains hidden or 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
# Step 1: Set the base image | |
FROM node:14 | |
# Step 2: Set working directory | |
WORKDIR /usr/src/app | |
# Step 3: Copy package.json files | |
COPY package*.json ./ | |
# Step 4: Install dependencies |
This file contains hidden or 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
import yfinance as yf | |
import pandas as pd | |
# Define tickers by sector | |
sectors = { | |
'Technology': ['AAPL', 'MSFT', 'GOOGL'], | |
'Healthcare': ['JNJ', 'PFE', 'MRK'], | |
'Consumer Discretionary': ['AMZN', 'TSLA', 'MCD'] | |
} |
This file contains hidden or 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
import yfinance as yf | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
# Fetch historical data for AAPL | |
data = yf.download('AAPL', start='2023-01-01', end='2024-01-01') | |
# Calculate RSI | |
def RSI(data, window=14): | |
delta = data['Adj Close'].diff(1) |
This file contains hidden or 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
import yfinance as yf | |
import numpy as np | |
import pandas as pd | |
# Fetch historical data for AAPL and MSFT | |
tickers = ['AAPL', 'MSFT'] | |
data = yf.download(tickers, start='2022-01-01', end='2023-01-01')['Adj Close'] | |
# Calculate daily returns | |
daily_returns = data.pct_change().dropna() |
This file contains hidden or 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
import yfinance as yf | |
import pandas as pd | |
import numpy as np | |
# Define the tickers of the stocks in the portfolio | |
tickers = ['AAPL', 'MSFT', 'AMZN'] | |
# Fetch historical data for these stocks | |
data = yf.download(tickers, start='2023-01-01', end='2024-01-01')['Adj Close'] |
This file contains hidden or 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
import yfinance as yf | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
# Define the ticker symbols for the stock and the benchmark index | |
stock_symbol = 'AAPL' | |
benchmark_symbol = '^GSPC' | |
# Fetch historical data for the past year | |
stock_data = yf.download(stock_symbol, start='2023-01-01', end='2024-01-01') |
This file contains hidden or 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
import yfinance as yfinance | |
import pandas as data_frame | |
import numpy as numerical | |
def retrieve_stock_data(symbol, begin_date, finish_date): | |
""" | |
Obtain historical stock data from Yahoo Finance. | |
""" | |
historical_data = yfinance.download(symbol, start=begin_date, end=finish_date) | |
return historical_data |
This file contains hidden or 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
import yfinance as yf | |
import pandas as pd | |
import numpy as np | |
def fetch_stock_data(ticker, start_date, end_date): | |
""" | |
Fetch historical stock data from Yahoo Finance. | |
""" | |
stock_data = yf.download(ticker, start=start_date, end=end_date) | |
return stock_data |
This file contains hidden or 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
!pip install edsl | |
# Need to set an OPENAI_API_KEY as environnement variable | |
from google.colab import userdata | |
import os | |
os.environ['OPENAI_API_KEY'] = userdata.get('OPENAI_API_KEY') | |
from edsl.questions import QuestionMultipleChoice |