Skip to content

Instantly share code, notes, and snippets.

Last active November 8, 2022 14:37
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
get ETH price
getETH <- function(){
#Read the old chart data
ETH <- read.table("", sep=",", header = T)
ETH$timestamp <- as.Date(as_datetime(ETH$timestamp))
ETH <- ETH[!grepl("undefined", ETH$open),]
ETH <- ETH[order(ETH$timestamp, decreasing = F),]
ETHd <- ETH[!duplicated(ETH$timestamp),]
#head(ETHd); tail(ETHd)
#Create dataframe
ETH01 <- data.frame(Date=as.Date(ETHd$timestamp),
Month=format(as.Date(ETHd$timestamp), "%m"),
#Data After 2022-10-21 From binance
ETH00 <- binancer::binance_klines('ETHUSDT', interval = '1d',
start_time = "2022-11-08",
end_time = lubridate::today())
ETH00A <- data.frame(Date=as.Date(ETH00$open_time),
Month=format(as.Date(ETH00$open_time), "%m"),
#rbind data frames
Dat <- rbind(ETH01, ETH00A)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment