In this project, I gathered price data off a cryptocurrency exchange (web scraping using pyhon beautiful soup), and used Tableau and R for visuals and predictive analysis.
Web Scraping Cryptocurrency price
Packages
import requests
from bs4 import BeautifulSoup
Code
url = 'https://coinmarketcap.com/currencies/electroneum/'
response = requests.get(url)
html = response.content
#print(html)
soup = BeautifulSoup(html, 'html.parser')
price = soup.find(class_="priceValue")
print(price.text)
Tableau Visuals and predictive analytics
Unfortunately, I am not able to display my tableau workbook here. The visuals and dashboard work can be surmised from a review of the finished presentation at the bottom of the post.
R code and visuals
Code
"Quinton Carter" <-Sys.info()
install.packages("ggplot2")
library(ggplot2)
Crypto_Data <- read.csv(file.choose())
Crypto2 <- read.csv(file.choose())
str(Crypto_Data)
CData <- Crypto_Data
summary(CData)
CData$BTC_open_price <- as.factor(CData$BTC_open_price)
CData$BTC_high_price <- as.factor(CData$BTC_high_price)
CData$BTC_low_price <- as.factor(CData$BTC_low_price)
CData$BTC_close_price <- as.factor(CData$BTC_close_price)
CData$BTC_volume <- as.factor(CData$BTC_volume)
CData$BTC_Hi_Lo_range <- as.factor(CData$BTC_Hi_Lo_range)
CData$BTC_Daily_range <- as.factor(CData$BTC_Daily_range)
CData$ETH_open_price <- as.factor(CData$ETH_open_price)
CData$ETH_high_price <- as.factor(CData$ETH_high_price)
CData$ETH_low_price <- as.factor(CData$ETH_low_price)
CData$ETH_close_price <- as.factor(CData$ETH_close_price)
CData$ETH_volume <- as.factor(CData$ETH_volume)
CData$ETH_Hi_Lo_range <- as.factor(CData$ETH_Hi_Lo_range)
CData$ETH_Daily_range <- as.factor(CData$ETH_Daily_range)
CData$MANA_open_price <- as.factor(CData$MANA_open_price)
CData$MANA_high_price <- as.factor(CData$MANA_high_price)
CData$MANA_low_price <- as.factor(CData$MANA_low_price)
CData$MANA_close_price <- as.factor(CData$MANA_close_price)
CData$MANA_volume <- as.factor(CData$MANA_volume)
CData$MANA_Hi_Lo_range <- as.factor(CData$MANA_Hi_Lo_range)
CData$MANA_Daily_range <- as.factor(CData$MANA_Daily_range)
CData$BTC_AVG <- as.factor(CData$BTC_AVG)
CData$ETH_AVG <- as.factor(CData$ETH_AVG)
CData$MANA_AVG <- as.factor(CData$MANA_AVG)
ggplot(data = CData,aes(x=BTC_volume, y=WeekDay)) +
geom_bar(stat = "identity")
ggplot(aes(x = BTC_AVG, color = Month) ,data = CData) +
geom_density()
ggplot(CData, aes(x=Day,y=BTC_AVG))+
geom_point(aes(color = factor(Year)))
ggplot(CData, aes(x=Day,y=BTC_AVG))+
geom_point(aes(color = factor(WeekDay)))
DVizBTC <- ggplot(data=CData, aes(x=BTC_AVG)) +
geom_histogram(aes(y=..density..),
col='black',
fill='dodgerblue1',
alpha=0.3) +
geom_density(adjust=3)
print(DVizBTC + theme(plot.title=element_text(face="bold")) + ggtitle('Distribution AVG BTC'))
DVizETH <- ggplot(data=CData, aes(x=ETH_AVG)) +
geom_histogram(aes(y=..density..),
col='black',
fill='dodgerblue1',
alpha=0.3) +
geom_density(adjust=3)
print(DVizETH + theme(plot.title=element_text(face="bold")) + ggtitle('Distribution AVG ETH'))
DVizMANA <- ggplot(data=CData, aes(x=MANA_AVG)) +
geom_histogram(aes(y=..density..),
col='black',
fill='dodgerblue1',
alpha=0.3) +
geom_density(adjust=3)
print(DVizMANA + theme(plot.title=element_text(face="bold")) + ggtitle('Distribution AVG MANA'))
ggplot(data=CData, aes(x=Day,y=BTC_AVG,color=BTC_volume))+
geom_point()+
stat_smooth(method= "lm", col = "green")+
geom_smooth()+
ggtitle('BTC Preds')
ggplot(data=CData, aes(x=Month,y=ETH_AVG,color=ETH_volume))+
geom_point()+
stat_smooth(method= "lm", col = "green")+
geom_smooth()+
ggtitle('ETH Preds')
ggplot(data=CData, aes(x=Day,y=MANA_AVG,color=MANA_volume))+
geom_point()+
stat_smooth(method= "lm", col = "green")+
geom_smooth()+
ggtitle('MANA Preds')
corVizBTC <- select(CData, Date,Day,WeekDay,Month,Year,BTC_open_price,BTC_high_price,BTC_low_price,BTC_close_price,BTC_volume,BTC_Hi_Lo_range,BTC_Daily_range,BTC_AVG)
str(corVizBTC)
corVizBTC$Day <- as.numeric(corVizBTC$DAY)
corVizBTC$Year <- as.numeric(corVizBTC$Year)
numcolBTC <- sapply(corVizBTC,is.numeric)
pearsoncorBTC <- cor(corVizBTC[numcolBTC], use="complete.obs")
corrplot(pearsoncorBTC, "number")
corVizETH <- select(CData, Date,Day,WeekDay,Month,Year,ETH_open_price,ETH_high_price,ETH_low_price,ETH_close_price,ETH_volume,ETH_Hi_Lo_range,ETH_Daily_range,ETH_AVG)
str(corVizETH)
corVizETH$Day <- as.numeric(corVizETH$DAY)
corVizETH$Year <- as.numeric(corVizETH$Year)
numcolETH <- sapply(corVizETH,is.numeric)
pearsoncorETH <- cor(corVizETH[numcolETH], use="complete.obs")
corrplot(pearsoncorETH, "number")
corVizMANA <- select(CData, Date,Day,WeekDay,Month,Year,MANA_open_price,MANA_high_price,MANA_low_price,MANA_close_price,MANA_volume,MANA_Hi_Lo_range,MANA_Daily_range,MANA_AVG)
str(corVizMANA)
corVizMANA$Day <- as.numeric(corVizMANA$DAY)
corVizMANA$Year <- as.numeric(corVizMANA$Year)
numcolMANA <- sapply(corVizMANA,is.numeric)
pearsoncorMANA <- cor(corVizMANA[numcolMANA], use="complete.obs")
corrplot(pearsoncorMANA, "number")
corVizAll <- select(CData, Date,Day,WeekDay,Month,Year,BTC_open_price,BTC_high_price,BTC_low_price,BTC_close_price,BTC_volume,BTC_Hi_Lo_range,BTC_Daily_range,BTC_AVG,ETH_open_price,ETH_high_price,ETH_low_price,ETH_close_price,ETH_volume,ETH_Hi_Lo_range,ETH_Daily_range,ETH_AVG,MANA_open_price,MANA_high_price,MANA_low_price,MANA_close_price,MANA_volume,MANA_Hi_Lo_range,MANA_Daily_range,MANA_AVG)
str(corVizAll)
corVizAll$Day <- as.numeric(corVizAll$DAY)
corVizAll$Year <- as.numeric(corVizAll$Year)
numcolAll <- sapply(corVizAll,is.numeric)
pearsoncorAll <- cor(corVizAll[numcolAll], use="complete.obs")
corrplot(pearsoncorAll, "number")
#Crypto2 charts
Crypto2$BTC_Day_Up <- as.factor(Crypto2$BTC_Day_Up)
Crypto2$BTC_DOD_Up <- as.factor(Crypto2$BTC_DOD_Up)
Crypto2$ETH_Day_Up <- as.factor(Crypto2$ETH_Day_Up)
Crypto2$ETH_DOD_Up <- as.factor(Crypto2$ETH_DOD_Up)
Crypto2$MANA_Day_Up <- as.factor(Crypto2$MANA_Day_Up)
Crypto2$MANA_DOD_Up <- as.factor(Crypto2$MANA_DOD_Up)
Crypto2 <- filter(Crypto2, Crypto2$BTC_volume < )
plot(BTC_AVG ~ ETH_Day_Up, data=Crypto2)
plot(ETH_AVG ~ MANA_Day_Up, data=Crypto2)
ggplot(Crypto2, aes(x = BTC_volume, y = BTC_AVG)) +
geom_point(aes(color = factor(BTC_Day_Up))) +
stat_smooth(method = "lm", col = "blue")+
labs(title="BTC Vol to AVG")
ggplot(Crypto2, aes(x = ETH_volume, y = ETH_AVG)) +
geom_point(aes(color = factor(ETH_Day_Up))) +
stat_smooth(method = "lm", col = "blue")+
labs(title="ETH Vol to AVG")
ggplot(Crypto2, aes(x = MANA_volume, y = MANA_AVG)) +
geom_point(aes(color = factor(MANA_Day_Up))) +
stat_smooth(method = "lm", col = "blue")+
labs(title="MANA Vol to AVG")
NAVGdist <- ggplot(data=Crypto2, aes(x=Crypto2$WeekDay, fill=BTC_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdist + theme(plot.title=element_text(face="bold")) + ggtitle('BTC WeekDay'))
#Monthly
NAVGdistBMonth <- ggplot(data=Crypto2, aes(x=Crypto2$Month, fill=BTC_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdistBMonth + theme(plot.title=element_text(face="bold")) + ggtitle('BTC Monthly'))
NAVGdistEMonth <- ggplot(data=Crypto2, aes(x=Crypto2$Month, fill=ETH_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdistEMonth + theme(plot.title=element_text(face="bold")) + ggtitle('ETH Monthly'))
NAVGdistMMonth <- ggplot(data=Crypto2, aes(x=Crypto2$Month, fill=MANA_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdistMMonth + theme(plot.title=element_text(face="bold")) + ggtitle('MANA Monthly'))
#Year
NAVGdistBYear <- ggplot(data=Crypto2, aes(x=Crypto2$Year, fill=BTC_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdistBYear + theme(plot.title=element_text(face="bold")) + ggtitle('BTC Year'))
NAVGdistEYear <- ggplot(data=Crypto2, aes(x=Crypto2$Year, fill=ETH_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdistEYear + theme(plot.title=element_text(face="bold")) + ggtitle('ETH Year'))
NAVGdistMYear <- ggplot(data=Crypto2, aes(x=Crypto2$Year, fill=MANA_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdistMYear + theme(plot.title=element_text(face="bold")) + ggtitle('MANA Year'))
#WeekDay
NAVGdistBWeekDay <- ggplot(data=Crypto2, aes(x=Crypto2$WeekDay, fill=BTC_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdistBWeekDay + theme(plot.title=element_text(face="bold")) + ggtitle('BTC WeekDay'))
NAVGdistEWeekDay <- ggplot(data=Crypto2, aes(x=Crypto2$WeekDay, fill=ETH_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdistEWeekDay + theme(plot.title=element_text(face="bold")) + ggtitle('ETH WeekDay'))
NAVGdistMWeekDay <- ggplot(data=Crypto2, aes(x=Crypto2$WeekDay, fill=MANA_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdistMWeekDay + theme(plot.title=element_text(face="bold")) + ggtitle('MANA WeekDay'))
#Day
NAVGdistBDay <- ggplot(data=Crypto2, aes(x=Crypto2$Day, fill=BTC_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdistBDay + theme(plot.title=element_text(face="bold")) + ggtitle('BTC Day'))
NAVGdistEDay <- ggplot(data=Crypto2, aes(x=Crypto2$Day, fill=ETH_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdistEDay + theme(plot.title=element_text(face="bold")) + ggtitle('ETH Day'))
NAVGdistMDay <- ggplot(data=Crypto2, aes(x=Crypto2$Day, fill=MANA_Day_Up)) +
geom_bar(aes(y = (..count..)/sum(..count..)), position='stack', alpha=0.5) + scale_y_continuous(labels=scales::percent)
print(NAVGdistMDay + theme(plot.title=element_text(face="bold")) + ggtitle('MANA Day'))
Visuals output aligned with their code
Final presentation
Recording
Written analysis
Slide deck