1
0
mirror of https://gitlab.com/Anson-Projects/projects.git synced 2025-08-02 19:41:38 +00:00

close to finished

This commit is contained in:
2021-11-28 22:55:58 -07:00
parent a896c9a1c3
commit a004b5e0e3
7 changed files with 739 additions and 410 deletions

View File

@@ -3,12 +3,12 @@ using DataFrames
using HTTP
using StringViews
using JSON
using Dates
using Plots
using StatsPlots
using Colors
theme(:ggplot2)
jlc = Colors.JULIA_LOGO_COLORS;
kraken = """
cryptocurrency confirmationMinutes
@@ -124,16 +124,34 @@ caps = HTTP.get(mktcap_url).body |>
df.mktcap = [caps[id]["usd_market_cap"] ./ 1e9 for id in df.id]
df = df[df.mktcap.!=0, :]
function imp_func(name)
important = ["Bitcoin" "Ethereum" "Nano" "Dogecoin" "XRP" "Solana"]
if name in important
println(name)
name |> typeof |> println
return name
else
return ""
end
end
df.important = imp_func.(df.name)
sort!(df, :confirmationMinutes)
let
scatter(df.confirmationMinutes .+ 0.1, df.mktcap, alpha = 0.5, label = nothing)
@df df[df.important.!="", :] scatter(:confirmationMinutes, :mktcap, group = :cryptocurrency, markersize = 6, alpha = 0.9)
@df df[df.important.=="", :] scatter!(:confirmationMinutes, :mktcap, alpha = 0.5, label = "Other")
title!("Market Cap vs. Confirmation Time")
xlabel!("Confirmation Time (Minutes)")
ylabel!("Market Cap (Billions USD)")
annotate!(12, 425, "Ethereum")
annotate!(45, 975, "Bitcoin")
annotate!(-1, 1000, text("Prices as of: $(today())", :left, 8))
# annotate!(12, 435, "Ethereum")
# annotate!(45, 1010, "Bitcoin")
annotate!(2, 1090, text("Prices as of: $(today())", :left, 8))
plot!(legend = :topleft)
# savefig("caps.svg")
savefig("caps.svg")
end
fast = df[df.confirmationMinutes.==0, :]
@@ -147,7 +165,7 @@ cats = [
"oxygen" "DeFi"
"raydium" "DeFi"
"serum" "DeFi"
"solana" "Smart Contract" # Only smart contract and market cap is way too high
"solana" "Smart Contract"
"stellar" "Parachain"
"ripple" "Currency"
] |> x -> DataFrame(x, [:id, :category])
@@ -167,11 +185,8 @@ let
title!("Market Caps of Fast Coins")
ylabel!("Market Cap (Billions USD)")
# savefig("fast.svg")
savefig("fast.svg")
end
currency = fast[fast.category.=="Currency", :]
@df currency pie(:cryptocurrency, :mktcap, title = "Market Cap")
currency