Final Project

CS181/DA210: Data Systems

Submitted To: Dr. Tanya Amert

Submitted By: Suryansh Agrawal

17th April 2022


Since the start of 2019, I have been interested in finaces and specially intrigued with the concept of Crypto and decentralization. I started investing in 2020, and I wanted to set a comparison between my most invested cryptos and stocks respectively.

To dot this, I chose all the four different websites to extract all my data to have a better practice of webscrapping.

Using the downloaded HTML of Bitcoin (BTC), making a parser so that we can extract the tabular data from the web page using XPATH.

Using the downloaded HTML of Ethereum (ETH), making a parser so that we can extract the tabular data from the web page using XPATH.

Using the downloaded HTML of Microsoft Corporation (MSFT), making a parser so that we can extract the tabular data from the web page using XPATH.

Using the downloaded HTML of Meta Platforms Inc. (FB), making a parser so that we can extract the tabular data from the web page using XPATH.

Now, using XPATH, we will extract the tables and all the necesarry columns for our Bitcoin database


Now, using XPATH, we will extract the tables and all the necesarry columns for our Ethereum database


Now, using XPATH, we will extract the tables and all the necesarry columns for our Microsoft Corporation database


Now, using XPATH, we will extract the tables and all the necesarry columns for our Meta Platforms Inc. database



Setting Credentials







Establish Connection from Client to Server

The above function will help achieve any data from any of the tables from our data base. It asks for just two variables, asset and data, asset is the name of the table (example: btc/msft) and data is the columns inside the table (example: High/Volume). Inputing the desired variable, we will obtain a grapgh of that data for one year. This is handy for a side by side comparision between different assests and for immidiate information that can be helpful in further analysis. Below are some demonstrated examples and why the graph can be useful.


Explanation of BTC Volume plot

This line plot of the BTC Volume data shows the relationship between the date from 6th April 2021 to 5th April 2022 (using the date_list variable which is extracted through the Databse is SQL) and the Volume in one of the most important asstes of my portfolio. There looks to be a negative correlation between the two variables: as the date increases, the volume in the Dollar price decreses. After about 2021-04, there was a sudden spike in the prices, which factually makes sense as there was a rise in the BTC price and Volume because of the policy of Tesla accepting BTC as their payment method. We also see a spike around 2022-01. There is a fall in the Volume around 2021-12. Noticing these patterns can be extremely beneficial to predict the prices for the coming year or to see the patterns in the currency's nature. Overall we could conclude that our independent variable, date, negatively correlates with our dependent variable, volume, for most of the time in the year therefore that as dates increases, volume dcreases.


Let's now switch to a stock. Now we would try and analyze the price of the stock. This is extremely simple because of the above function where I can just change the asset and the data I want to extract the plot for.

Explanation of MSFT Open price plot

This line plot of the MSFT Open price data shows the relationship between the date from 6th April 2021 to 5th April 2022 (using the date_list variable which is extracted through the Databse is SQL) and the Open price. There looks to be a (mostly) positive correlation between the two variables: as the date increases, the Open Price in the Dollar price decreases. This is true only till the begaining of 2022 becuase after the corelation changes and we see a fall in the prices. Microsoft is a diversified and resilient business protected by strong barriers to entry. The company is well positioned and poised for growth over the coming years. Such high-quality business should be a core holding for long-term becuase the stock prices can still go up becuase from the above pattern we see that the company perforns the best after the first quater and stays on the top till the end of the third quater. Overall we could conclude that our independent variable, date, positively correlates with our dependent variable, volume, for most of the time in the year therefore that as dates increases, volume also increases.

Just like that we can choose any number of data from any of our assets for or analysis.


The above function will help achieve any data from any of the two tables from our data base and compare them as per the desired plot. It asks for four variables, asset1 and asset1, the assets thatt you wish to compare (example: btc and eth), and data is the columns inside the table (example: High/Volume) on which you want to compare the two assets. Inputing the desired variables, we will obtain a plot of that data for one year on a plot of given type in chart_type. This is handy for a one on one comparision between two different assests and for immidiate information that can be helpful in further analysis. Below are some demonstrated examples and why the graph can be useful.



Explanation of Volume plot comparision between BTC and ETH

This area plot of the Volume of the BTC and ETH shows the relationship between the date from 6th April 2021 to 5th April 2022 (using the date_list variable which is extracted through the Databse is SQL) and the Volume among the two highest volume cryptocurrencies. There looks to be a strong correlation between the two assets: as the BTC's Volume increases, the volume of ETH also increases. This is a good significance that both of these cryptos move together. If the overall volume of the market is up, it will mostly because of these two cryptos as they cover the maximum of volume in cryptos and a strong corelation among these two give it more power. Overall we could conclude that our independent variable, date, is not a factor that affetcs the volume but the corelation between these two cryptos is extremely storng.


Even the above regretion test shows how highly these two cryptos are related because of the cluster of these points in the above scatterplot and the straight line with just a few outliers.

Just like that we can choose any data from any of our two assets for or analysis.





The main goal to show the first 14 values in the above query is to show that there is a difference in the size of the data sets because cryptocurrency is marketable for 365 days wheras stock market has 253 legal days to operate. Weekends and Government holidays are not included for MSFT and FB


The above DataFrame shows us all the statistically significant measures for the assets.


Intorduction of NFT

Let's try something interesting, to make my DB design clean and tidy, I will introduce a data set representing Sales of Non-fungible token (NFT). I have no experience with NFTs, and this is why I had a quick thought of comparing the volume of BTC and ETH on each day and the sales of NFTs to compare to see if NFTs also have a strong corelation with the Volume of BTC and ETH. As we concluded with the above graph, ETH is highly similr to how BTC is acting. With the same hypothesis in mind, let's see if NFT sales are also dependent on the BTC or ETH's Volume.

Explanation of Corelation and Regression of NFT and BTC

This linear regression model looks at the effect NFT Sales in the past year has on BTC's Volume for the sane days. Looking at both the graphs, area and regression, it suggests a negative relationship: for increase in the volume of BTC's Volume, there is a decrease in the NFT Sale. While this result is statistically significant, I am unsure that it’s practically signficant. For an increase in the Volume of BTC, NFT shoudl not matter as it is on a different blockchain, but it is interesting to see a relationship like that as it can suggest useage of BTC's blockchain for future NFTs. (see the scatter plot with regression line, above).

Explanation of Corelation and Regression of NFT and ETH

This linear regression model looks at the effect NFT Sales in the past year has on ETH's Volume for the sane days. Looking at both the graphs, area and regression, it suggests a negative relationship: for increase in the volume of ETH's Volume, there is a decrease in the NFT Sale. While this result is statistically significant, I am unsure that it’s practically signficant. For an increase in the Volume of ETH, NFT shoudl not matter as it is on a different blockchain, but it is interesting to see a relationship like that as it can suggest useage of ETH's blockchain for future NFTs. (see the scatter plot with regression line, above).


Data Base Explanation

Adhereing to the TidyData Rules that are

I designed my DataBase. I do not tend to follow the rules in the begaining as working with multilevel indexing could have been challending and this is why I divided my data in various tables, but as the project progresses, I start following the three above mentioned rules. At the very end of the project, I am technically left with 2 tables, combined and nft. In the below diagram, I wanna show all the tables I used to give a better clarity, but the tables within the green box are the final two table that my DataBase should consist.

The Conclusion