Skip to content

Instantly share code, notes, and snippets.

@clauswilke
Created March 29, 2024 19:14
Show Gist options
  • Save clauswilke/7a8b515123932f1ffcd4b94570b220ab to your computer and use it in GitHub Desktop.
Save clauswilke/7a8b515123932f1ffcd4b94570b220ab to your computer and use it in GitHub Desktop.
DEGEN token price chart
library(tidyverse)
library(cowplot)
# download historical data in csv format from here:
# https://www.coingecko.com/en/coins/degen-base/historical_data
data <- read_csv("degen-usd-max.csv")
make_date_number <- function(x) {
as.numeric(difftime(x, ymd_hms(data$snapped_at[1]), units="days"))
}
make_date_label <- function(x) {
d <- make_date_number(x)
format(ymd_hms(data$snapped_at[1]) + days(d), "%b. %Y")
}
breaks1 <- ymd_hms(
glue::glue('{c("2024-02-01", "2024-03-01", "2024-04-01")} 00:00:00 UTC')
)
breaks2 <- ymd_hms(
glue::glue('{c("2024-02-01", "2024-04-01", "2024-06-01")} 00:00:00 UTC')
)
plot_base <- data %>%
mutate(
date = ymd_hms(snapped_at),
days = make_date_number(date)
) %>%
ggplot(aes(days, price)) +
geom_point(aes(color = "price"), size = 1) +
geom_line(aes(color = "price"), linewidth = .5) +
geom_function(
aes(color = "fit"),
fun = \(x) (3e-5*1.09^x),
linewidth = 1,
) +
scale_color_manual(
values = c(price = "black", fit = "#3147CD"),
guide = "none"
) +
labs(
title = "$DEGEN price grows at 9% per day"
) +
theme_minimal_grid(12) +
theme(
plot.margin = margin(6, 24, 6, 6),
plot.title.position = "plot",
plot.title = element_text(face = "plain", size = 12),
plot.background = element_rect(fill = "white")
)
p <- plot_base +
scale_y_log10(
name = "price (USD)",
breaks = c(0.0001, 0.001, 0.01),
labels = c("0.0001", "0.001", "0.01"),
) +
scale_x_continuous(
name = NULL,
breaks = make_date_number(breaks1),
labels = make_date_label(breaks1)
)
ggsave("degen-plot1.png", p, width = 6, height = 4)
p <- plot_base +
scale_y_log10(
name = "price (USD)",
breaks = c(0.001, 0.1, 10),
labels = c("0.001", "0.1", "10"),
) +
scale_x_continuous(
name = NULL,
breaks = make_date_number(breaks2),
labels = make_date_label(breaks2),
limits = c(0, 170)
)
ggsave("degen-plot2.png", p, width = 6, height = 4)
snapped_at price market_cap total_volume
2024-01-15 00:00:00 UTC 3.357435563002712e-05 0.0 35224.21988674275
2024-01-16 00:00:00 UTC 3.357435563002712e-05 0.0 35224.21988674275
2024-01-17 00:00:00 UTC 6.706292408406547e-05 0.0 42600.60356292729
2024-01-18 00:00:00 UTC 0.00010380007961657561 0.0 123412.28532335159
2024-01-19 00:00:00 UTC 0.00012303770458324366 0.0 122489.78672228329
2024-01-20 00:00:00 UTC 0.00017878302533673324 0.0 158619.04554778442
2024-01-21 00:00:00 UTC 0.00020474213702078355 0.0 72423.18235964004
2024-01-22 00:00:00 UTC 0.00020931605008643416 0.0 118607.60717720396
2024-01-23 00:00:00 UTC 0.00024077600057553886 0.0 219268.28301763991
2024-01-24 00:00:00 UTC 0.00023053129704896498 0.0 331967.353521184
2024-01-25 00:00:00 UTC 0.00020479765152671815 0.0 150681.039767274
2024-01-26 00:00:00 UTC 0.00018769300191593484 0.0 46612.047785361094
2024-01-27 00:00:00 UTC 0.00023328863108407528 0.0 117765.00376116665
2024-01-28 00:00:00 UTC 0.00023619864483437114 0.0 118265.6562122428
2024-01-29 00:00:00 UTC 0.0002590655096021537 0.0 138099.36546514233
2024-01-30 00:00:00 UTC 0.00044411949307093356 0.0 489470.106753039
2024-01-31 00:00:00 UTC 0.000974916730335495 0.0 3378781.019407601
2024-02-01 00:00:00 UTC 0.0007741141190521999 0.0 1015605.0097254737
2024-02-02 00:00:00 UTC 0.001021580532751292 0.0 794481.2296754246
2024-02-03 00:00:00 UTC 0.0015278501271287638 0.0 1530747.5578091745
2024-02-04 00:00:00 UTC 0.0019003006051184427 0.0 2190347.767675133
2024-02-05 00:00:00 UTC 0.003649697366815172 0.0 6713561.222138955
2024-02-06 00:00:00 UTC 0.002253487918521762 0.0 7642017.477074601
2024-02-07 00:00:00 UTC 0.0022730688953285514 0.0 2852173.542952983
2024-02-08 00:00:00 UTC 0.004195341583667748 0.0 10880493.52634456
2024-02-09 00:00:00 UTC 0.003400643127520321 0.0 6065828.477102704
2024-02-10 00:00:00 UTC 0.003193164472581963 0.0 6686763.498895225
2024-02-11 00:00:00 UTC 0.002631538526578335 0.0 3772407.5790496087
2024-02-12 00:00:00 UTC 0.0024550556610691563 0.0 1991089.8713882775
2024-02-13 00:00:00 UTC 0.001783211446709335 0.0 3990265.0699177557
2024-02-14 00:00:00 UTC 0.001740859087925891 0.0 2541442.2421582723
2024-02-15 00:00:00 UTC 0.002729524980225553 0.0 3479758.5492853466
2024-02-16 00:00:00 UTC 0.002643472546151836 0.0 2419808.7111940994
2024-02-17 00:00:00 UTC 0.002048342794914598 0.0 1837153.2672472042
2024-02-18 00:00:00 UTC 0.0019210005323438439 0.0 971471.6188131841
2024-02-19 00:00:00 UTC 0.001895142013153624 0.0 644713.620845733
2024-02-20 00:00:00 UTC 0.0018120371038448306 0.0 692843.9179469331
2024-02-21 00:00:00 UTC 0.0017006731929314902 0.0 1536894.5614984576
2024-02-22 00:00:00 UTC 0.0014138401732184866 0.0 1514262.366942178
2024-02-23 00:00:00 UTC 0.0009485152576962388 0.0 2068489.0417312647
2024-02-24 00:00:00 UTC 0.0009211127211786851 0.0 1120117.8972140255
2024-02-25 00:00:00 UTC 0.0010297127399443164 0.0 655062.5364693685
2024-02-26 00:00:00 UTC 0.0011731395519259087 0.0 522325.4620660962
2024-02-27 00:00:00 UTC 0.0008049262550026794 0.0 715755.835825766
2024-02-28 00:00:00 UTC 0.0008799355022031149 0.0 910880.814677748
2024-02-29 00:00:00 UTC 0.001203195249215855 0.0 1670229.5246887598
2024-03-01 00:00:00 UTC 0.0010890670041736154 0.0 2214256.030360117
2024-03-02 00:00:00 UTC 0.0016722795036889422 0.0 1820870.837269633
2024-03-03 00:00:00 UTC 0.0016293147252299605 0.0 2018006.7312810766
2024-03-04 00:00:00 UTC 0.0024090570787626176 0.0 1449124.4659855983
2024-03-05 00:00:00 UTC 0.0028696744607935717 0.0 3593447.015959201
2024-03-06 00:00:00 UTC 0.0023868975154648048 0.0 4939543.047924565
2024-03-07 00:00:00 UTC 0.0022213241467545523 0.0 2125631.8987819455
2024-03-08 00:00:00 UTC 0.0021977309101172825 0.0 1577642.0736822323
2024-03-09 00:00:00 UTC 0.001702115416458348 0.0 1247380.564423808
2024-03-10 00:00:00 UTC 0.0018779921548119083 0.0 1113757.8995046944
2024-03-11 00:00:00 UTC 0.00211764542680789 0.0 1170027.1474009731
2024-03-12 00:00:00 UTC 0.0018653885413100054 0.0 865055.718797185
2024-03-13 00:00:00 UTC 0.0017862511430742866 0.0 732390.4944007286
2024-03-14 00:00:00 UTC 0.001750818205702547 0.0 459888.20213183196
2024-03-15 00:00:00 UTC 0.003841680109812274 48033568.3119584 9869894.040001215
2024-03-16 00:00:00 UTC 0.004995345845484737 62292842.627528235 6602978.281319727
2024-03-17 00:00:00 UTC 0.003909541301535428 48736634.82151573 6560599.702817014
2024-03-18 00:00:00 UTC 0.005178053220949044 64458523.11930122 3295900.0053912257
2024-03-19 00:00:00 UTC 0.003909888505021296 48908483.9157447 3566618.246870461
2024-03-20 00:00:00 UTC 0.0037312224096503416 45151632.23929116 4895529.449142476
2024-03-21 00:00:00 UTC 0.006567078613438352 81967895.02186115 19278400.92035058
2024-03-22 00:00:00 UTC 0.009120205794259754 113746514.94665031 12266620.73018766
2024-03-23 00:00:00 UTC 0.008070805297635047 100758141.23030777 13753195.253541037
2024-03-24 00:00:00 UTC 0.010201407170760714 127199430.47069432 5734866.79090608
2024-03-25 00:00:00 UTC 0.011600570719369277 144396567.36236575 19450496.255845167
2024-03-26 00:00:00 UTC 0.017204210323760804 211165774.68015924 42159612.00078876
2024-03-27 00:00:00 UTC 0.017011091864505803 212077921.35814843 26097229.376909558
2024-03-28 00:00:00 UTC 0.014123185944320372 176164552.79248872 19895445.09367254
2024-03-29 00:00:00 UTC 0.022960343435670626 287467076.8126654 43383306.10942498
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment