Module 7 Challenge
In recent years, finance has had an explosion in passive investing. Passive investing means that you invest in a basket of assets that’s called an exchange-traded fund (ETF). This way, you don’t spend time researching individual stocks or companies or take the risk of investing in a single stock. ETFs offer more diversification.
In this Challenge assignment, I’ll build a financial database and web application by using SQL, Python, and the Voilà library to analyze the performance of a hypothetical fintech ETF.
The data we're analyzing comes from a jupyter notebook that we've created and imported files to. We'll be using Python to run and read our data.
- [jupyter] - (https://github.com/jupyter/notebook) - Helps us run our code and get the information we need from the data listed in csv files.
In order for us to get the data we need we must import pandas, plots and the csv files we want to observe.
# Importing the required libraries and dependencies
import numpy as np
import pandas as pd
import hvplot.pandas
import sqlalchemy
To find the information needed we build a jupyter notebook and run various functions to pull the data from csv files.
# Write a SQL SELECT statement to select the time and daily_returns columns
# Sort the results in descending order and return only the top 10 return values
query = """
SELECT time, close
FROM PYPL
ORDER BY daily_returns DESC
LIMIT 10;
"""
# Using the query, read the data from the database into a Pandas DataFrame
pypl_top_10_returns = pd.read_sql(query, con=engine)
# Review the resulting DataFrame
display(pypl_top_10_returns.head())
Screen Recording on Loom
Brought to you by Elgin Braggs Jr.
MIT