JesseVent / crypto

Cryptocurrency Historical Market Data R Package
https://CRAN.R-project.org/package=crypto
Other
143 stars 34 forks source link

contact with JesseVent #15

Closed ghost closed 6 years ago

ghost commented 6 years ago

Dear Jesse,

I am writting because I am a student that is currently involved in R studio for an empirical papper at my University. The papper name is "Portfolio Management and Investment Strategies for Crypto-Assets". We are also using your tools from: https://github.com/JesseVent/crypto/.

Will you be so kind and would you like to have a small conversation with me because I have some questions to the code regarding my papper and I am stuck in the coding process.

kind regards mprekr

JesseVent commented 6 years ago

Sure, how can I help?

ghost commented 6 years ago

Dear Jesse,

I would like to kindly ask you about the code that I am developing, based on your crypto package, for my paper at my University. Below you can find the assignment and in attachment you can find my code.

"For now you have the data in a panel format. Next, you should get a matrix for each data type (prices, open, close, volume, etc.) where each column represents a currency.

All these datatype should be available at a daily, weekly and monthly frequency.

Make sure you use the functions in a way that the data has only got to be downloaded once in the beginning, as it is rather time consuming."

My problem is:

Also in near future this code will be expanded for calculating market factors such as: Value at Risk or Sharpe Ratio for cryptocurrencies.

kind regards mprekr

2018-04-12 23:41 GMT+02:00 Jesse notifications@github.com:

Sure, how can I help?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-380953070, or mute the thread https://github.com/notifications/unsubscribe-auth/AkjjliS7rrm5OcmHiCiYILz_OQh4Z17Xks5tn8oMgaJpZM4TSh7l .

JesseVent commented 6 years ago

Hi,

I added a new function tonight to the package that should do what you're after

Try give the following code a try.

devtools::install_github("jessevent/crypto")
library(crypto)
df        <- getCoins()
day_xts   <- crypto2xts(df, "day")
week_xts  <- crypto2xts(df, "week")
month_xts <- crypto2xts(df, "month")

Out of curiosity has your university directed you to this package or did you choose it yourself?

ghost commented 6 years ago

Hey Jesse,

The University directed us to your page becasue as Finance students we need also to code. By the way, are you searching for someone to your company currently that is mixing finance and data science? I would be more than happy to apply if its possible.

kind regards mprekr

2018-04-15 18:01 GMT+02:00 Jesse notifications@github.com:

Closed #15 https://github.com/JesseVent/crypto/issues/15.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#event-1575001232, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlov-jzqnuMhm5gzPyk9t9xBtvlJ0ks5to27ngaJpZM4TSh7l .

ghost commented 6 years ago

Dear Jesse,

I have some errors after applying the new code. In attachment the code and a print screen from errors. I am currently working on it but for now I do not have a solution to it. Do you have maybe any suggestions?

kind regards mprekr

2018-04-15 18:50 GMT+02:00 MP PM mprekr@gmail.com:

Hey Jesse,

The University directed us to your page becasue as Finance students we need also to code. By the way, are you searching for someone to your company currently that is mixing finance and data science? I would be more than happy to apply if its possible.

kind regards mprekr

2018-04-15 18:01 GMT+02:00 Jesse notifications@github.com:

Closed #15 https://github.com/JesseVent/crypto/issues/15.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#event-1575001232, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlov-jzqnuMhm5gzPyk9t9xBtvlJ0ks5to27ngaJpZM4TSh7l .

JesseVent commented 6 years ago

Can you please paste the errors as I cant view attachments

ghost commented 6 years ago

day_xts <- crypto2xts(df, "day")Error in crypto2xts(df, "day") : could not find function "crypto2xts"> week_xts <- crypto2xts(df, "week")Error in crypto2xts(df, "week") : could not find function "crypto2xts"> month_xts <- crypto2xts(df, "month")Error in crypto2xts(df, "month") : could not find function "crypto2xts"

2018-04-16 0:28 GMT+02:00 Jesse notifications@github.com:

Can you please paste the errors as I cant view attachments

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381443117, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlg870N3XHh0JcnN-Yyq8gVC1L5OSks5to8mJgaJpZM4TSh7l .

JesseVent commented 6 years ago

Have you installed version 1.6 from github repo? devtools::install_github("jessevent/crypto")

ghost commented 6 years ago

another error

devtools::install_github("jessevent/crypto")Error in loadNamespace(name) : there is no package called ‘devtools’

2018-04-16 0:39 GMT+02:00 Jesse notifications@github.com:

Have you installed version 1.6 from github repo? devtools::install_github("jessevent/crypto")

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381443731, or mute the thread https://github.com/notifications/unsubscribe-auth/AkjjlmOpV8yGlFYll0Zbfnvn6itmL8CVks5to8wIgaJpZM4TSh7l .

JesseVent commented 6 years ago

install.packages("devtools") devtools::install_github("jessevent/crypto")

ghost commented 6 years ago

Downloading GitHub repo jessevent/crypto@master from URL https://api.github.com/repos/jessevent/crypto/zipball/masterInstalling crypto"E:/Program Files/R/R-3.4.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \ "C:/Users/Cesar/AppData/Local/Temp/Rtmp8UQTZ4/devtools125075b66459/JesseVent-crypto-8046b42" \ --library="E:/Program Files/R/R-3.4.1/library" --install-tests 'E:\Program' is not recognized as an internal or external command, operable program or batch file.Installation failed: Command failed (1)

2018-04-16 0:42 GMT+02:00 Jesse notifications@github.com:

install.packages("devtools") devtools::install_github("jessevent/crypto")

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381443983, or mute the thread https://github.com/notifications/unsubscribe-auth/AkjjlpmFHhmiZcTBWOc90EYI1X11KdABks5to8zcgaJpZM4TSh7l .

JesseVent commented 6 years ago

ahh your using windows, I think it could be an issue with the devtools library

https://github.com/r-lib/devtools/issues/426

View last comment and try that

ghost commented 6 years ago

Dear Jesse,

I am an IT noob (sadly) therefore the majority of this last comment is unclear to me what should I do. I am currently installing the java package but from point 2 "Install "Rtools34" its getting unclear what should I do.

Therefore, could you please kindly help me how should I proceed with this?

kind regards mprekr

2018-04-16 0:51 GMT+02:00 Jesse notifications@github.com:

ahh your using windows, I think it could be an issue with the devtools library

r-lib/devtools#426 https://github.com/r-lib/devtools/issues/426

View last comment and try that

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381444554, or mute the thread https://github.com/notifications/unsubscribe-auth/AkjjljSx4xkI9Z7XI007t-6b-tXJYVn3ks5to87lgaJpZM4TSh7l .

JesseVent commented 6 years ago

https://cran.r-project.org/bin/windows/Rtools/

ghost commented 6 years ago

ok Im installing Rtools34.exe https://cran.r-project.org/bin/windows/Rtools/Rtools34.exe

2018-04-16 1:13 GMT+02:00 Jesse notifications@github.com:

https://cran.r-project.org/bin/windows/Rtools/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381445853, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlt2y2xf0BhPw9Qh_Ta8yZdrMEHrPks5to9QAgaJpZM4TSh7l .

ghost commented 6 years ago

Dear Jesse,

I can't find: basic-miktex-2.9.6236-x64

do you know where I can find it? The comand from this webpage does not work (https://chocolatey.org/packages/miktex.install/2.9.6236)

kr mprekr

2018-04-16 1:16 GMT+02:00 MP PM mprekr@gmail.com:

ok Im installing Rtools34.exe https://cran.r-project.org/bin/windows/Rtools/Rtools34.exe

2018-04-16 1:13 GMT+02:00 Jesse notifications@github.com:

https://cran.r-project.org/bin/windows/Rtools/

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381445853, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlt2y2xf0BhPw9Qh_Ta8yZdrMEHrPks5to9QAgaJpZM4TSh7l .

JesseVent commented 6 years ago

This is the raw function, try this

crypto2xts <- function(df, frequency = NULL) {
  slug        <- ""
  symbol      <- ""
  name        <- ""
  ranknow     <- ""
  high        <- ""
  low         <- ""
  market      <- ""
  volume      <- ""
  freq        <- frequency
  df$date     <- lubridate::round_date(df$date, freq)
  data        <-
    df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise(
      open   = dplyr::first(open),
      high   = max(high),
      low    = min(low),
      close  = dplyr::last(close),
      volume = sum(volume),
      market = dplyr::last(market))
  data$volume <- round(data$volume, digits = 0)
  data$market <- round(data$market, digits = 0)
  data        <- as.data.frame(data)
  results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S"))
  return(results)
}
ghost commented 6 years ago

install.packages("Rtools34")Warning in install.packages : package ‘Rtools34’ is not available (for R version 3.4.1)

2018-04-16 1:54 GMT+02:00 Jesse notifications@github.com:

This is the raw function, try this

crypto2xts <- function(df, frequency = NULL) { slug <- "" symbol <- "" name <- "" ranknow <- "" high <- "" low <- "" market <- "" volume <- "" freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381448168, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlgc5uEjU6BP2kHt3rRVA9rk1xe3Wks5to92dgaJpZM4TSh7l .

ghost commented 6 years ago

I used the code that you provided from the email " This is the raw function, try this" its creating a function. How should I proceed further?

kr mprekr

2018-04-16 2:01 GMT+02:00 MP PM mprekr@gmail.com:

install.packages("Rtools34")Warning in install.packages : package ‘Rtools34’ is not available (for R version 3.4.1)

2018-04-16 1:54 GMT+02:00 Jesse notifications@github.com:

This is the raw function, try this

crypto2xts <- function(df, frequency = NULL) { slug <- "" symbol <- "" name <- "" ranknow <- "" high <- "" low <- "" market <- "" volume <- "" freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381448168, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlgc5uEjU6BP2kHt3rRVA9rk1xe3Wks5to92dgaJpZM4TSh7l .

ghost commented 6 years ago

The whole code looks like this currently:

install.packages("crypto") install.packages("xts") install.packages("tidyr")

require(crypto) require(xts) require(tidyr)

crypto2xts <- function(df, frequency = NULL) { slug <- "" symbol <- "" name <- "" ranknow <- "" high <- "" low <- "" market <- "" volume <- "" freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

install.packages("devtools") devtools::install_github("jessevent/crypto") df <- getCoins() day_xts <- crypto2xts(df, "day") week_xts <- crypto2xts(df, "week") month_xts <- crypto2xts(df, "month")

but it still gives me an error at line:

devtools::install_github("jessevent/crypto")Downloading GitHub repo jessevent/crypto@master from URL https://api.github.com/repos/jessevent/crypto/zipball/masterInstalling crypto"E:/Program Files/R/R-3.4.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \ "C:/Users/Cesar/AppData/Local/Temp/Rtmp2XMb68/devtoolsac45b3744cf/JesseVent-crypto-8046b42" \ --library="E:/Program Files/R/R-3.4.1/library" --install-tests 'E:\Program' is not recognized as an internal or external command, operable program or batch file.Installation failed: Command failed (1)

2018-04-16 2:04 GMT+02:00 MP PM mprekr@gmail.com:

I used the code that you provided from the email " This is the raw function, try this" its creating a function. How should I proceed further?

kr mprekr

2018-04-16 2:01 GMT+02:00 MP PM mprekr@gmail.com:

install.packages("Rtools34")Warning in install.packages : package ‘Rtools34’ is not available (for R version 3.4.1)

2018-04-16 1:54 GMT+02:00 Jesse notifications@github.com:

This is the raw function, try this

crypto2xts <- function(df, frequency = NULL) { slug <- "" symbol <- "" name <- "" ranknow <- "" high <- "" low <- "" market <- "" volume <- "" freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381448168, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlgc5uEjU6BP2kHt3rRVA9rk1xe3Wks5to92dgaJpZM4TSh7l .

ghost commented 6 years ago

Dear Jesse,

I runed the code once more. It trigers an error at line devtools::install_github("hadley/devtools"):

Installation failed: Command failed (1)Downloading GitHub repo r-lib/pkgload@master from URL https://api.github.com/repos/r-lib/pkgload/zipball/mastertrying URL 'https://cran.rstudio.com/bin/windows/Rtools/Rtools34.exe'Content type 'application/x-msdos-program' length 108085090 bytes (103.1 MB)downloaded 103.1 MB

also the line: devtools::install_github("jessevent/crypto") trigers an error:

devtools::install_github("jessevent/crypto")Downloading GitHub repo jessevent/crypto@master from URL https://api.github.com/repos/jessevent/crypto/zipball/masterInstalling crypto"E:/Program Files/R/R-3.4.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \ "C:/Users/Cesar/AppData/Local/Temp/RtmpILvzyh/devtools2c42df7f8c/JesseVent-crypto-8046b42" \ --library="E:/Program Files/R/R-3.4.1/library" --install-tests 'E:\Program' is not recognized as an internal or external command, operable program or batch file.Installation failed: Command failed (1)

The whole code is below. Currently I have no idea what is wrong (I updated the system as it was posted on the webpage provided by you). I am also very thankfull for your help with providing me the links. I am workind on Windows 10.

install.packages("crypto") install.packages("xts") install.packages("tidyr")

require(crypto) require(xts) require(tidyr)

crypto2xts <- function(df, frequency = NULL) { slug <- "" symbol <- "" name <- "" ranknow <- "" high <- "" low <- "" market <- "" volume <- "" freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

normalizePath("C:/Rtools/bin") devtools::install_github("hadley/devtools")

install.packages("devtools") devtools::install_github("jessevent/crypto") df <- getCoins() day_xts <- crypto2xts(df, "day") week_xts <- crypto2xts(df, "week") month_xts <- crypto2xts(df, "month")

2018-04-16 2:13 GMT+02:00 MP PM mprekr@gmail.com:

The whole code looks like this currently:

install.packages("crypto") install.packages("xts") install.packages("tidyr")

require(crypto) require(xts) require(tidyr)

crypto2xts <- function(df, frequency = NULL) { slug <- "" symbol <- "" name <- "" ranknow <- "" high <- "" low <- "" market <- "" volume <- "" freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

install.packages("devtools") devtools::install_github("jessevent/crypto") df <- getCoins() day_xts <- crypto2xts(df, "day") week_xts <- crypto2xts(df, "week") month_xts <- crypto2xts(df, "month")

but it still gives me an error at line:

devtools::install_github("jessevent/crypto")Downloading GitHub repo jessevent/crypto@master from URL https://api.github.com/repos/jessevent/crypto/zipball/masterInstalling crypto"E:/Program Files/R/R-3.4.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \ "C:/Users/Cesar/AppData/Local/Temp/Rtmp2XMb68/devtoolsac45b3744cf/JesseVent-crypto-8046b42" \ --library="E:/Program Files/R/R-3.4.1/library" --install-tests 'E:\Program' is not recognized as an internal or external command, operable program or batch file.Installation failed: Command failed (1)

2018-04-16 2:04 GMT+02:00 MP PM mprekr@gmail.com:

I used the code that you provided from the email " This is the raw function, try this" its creating a function. How should I proceed further?

kr mprekr

2018-04-16 2:01 GMT+02:00 MP PM mprekr@gmail.com:

install.packages("Rtools34")Warning in install.packages : package ‘Rtools34’ is not available (for R version 3.4.1)

2018-04-16 1:54 GMT+02:00 Jesse notifications@github.com:

This is the raw function, try this

crypto2xts <- function(df, frequency = NULL) { slug <- "" symbol <- "" name <- "" ranknow <- "" high <- "" low <- "" market <- "" volume <- "" freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381448168, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlgc5uEjU6BP2kHt3rRVA9rk1xe3Wks5to92dgaJpZM4TSh7l .

ghost commented 6 years ago

I still can't find a working "basic-miktex-2.9.6236-x64" package and I think that can be the issue. What is your opinion?

kind regards mprekr

2018-04-16 13:45 GMT+02:00 MP PM mprekr@gmail.com:

Dear Jesse,

I runed the code once more. It trigers an error at line devtools::install_github("hadley/devtools"):

Installation failed: Command failed (1)Downloading GitHub repo r-lib/pkgload@master from URL https://api.github.com/repos/r-lib/pkgload/zipball/mastertrying URL 'https://cran.rstudio.com/bin/windows/Rtools/Rtools34.exe'Content type 'application/x-msdos-program' length 108085090 bytes (103.1 MB)downloaded 103.1 MB

also the line: devtools::install_github("jessevent/crypto") trigers an error:

devtools::install_github("jessevent/crypto")Downloading GitHub repo jessevent/crypto@master from URL https://api.github.com/repos/jessevent/crypto/zipball/masterInstalling crypto"E:/Program Files/R/R-3.4.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \ "C:/Users/Cesar/AppData/Local/Temp/RtmpILvzyh/devtools2c42df7f8c/JesseVent-crypto-8046b42" \ --library="E:/Program Files/R/R-3.4.1/library" --install-tests 'E:\Program' is not recognized as an internal or external command, operable program or batch file.Installation failed: Command failed (1)

The whole code is below. Currently I have no idea what is wrong (I updated the system as it was posted on the webpage provided by you). I am also very thankfull for your help with providing me the links. I am workind on Windows 10.

install.packages("crypto") install.packages("xts") install.packages("tidyr")

require(crypto) require(xts) require(tidyr)

crypto2xts <- function(df, frequency = NULL) { slug <- "" symbol <- "" name <- "" ranknow <- "" high <- "" low <- "" market <- "" volume <- "" freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

normalizePath("C:/Rtools/bin") devtools::install_github("hadley/devtools")

install.packages("devtools") devtools::install_github("jessevent/crypto") df <- getCoins() day_xts <- crypto2xts(df, "day") week_xts <- crypto2xts(df, "week") month_xts <- crypto2xts(df, "month")

2018-04-16 2:13 GMT+02:00 MP PM mprekr@gmail.com:

The whole code looks like this currently:

install.packages("crypto") install.packages("xts") install.packages("tidyr")

require(crypto) require(xts) require(tidyr)

crypto2xts <- function(df, frequency = NULL) { slug <- "" symbol <- "" name <- "" ranknow <- "" high <- "" low <- "" market <- "" volume <- "" freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

install.packages("devtools") devtools::install_github("jessevent/crypto") df <- getCoins() day_xts <- crypto2xts(df, "day") week_xts <- crypto2xts(df, "week") month_xts <- crypto2xts(df, "month")

but it still gives me an error at line:

devtools::install_github("jessevent/crypto")Downloading GitHub repo jessevent/crypto@master from URL https://api.github.com/repos/jessevent/crypto/zipball/masterInstalling crypto"E:/Program Files/R/R-3.4.1/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \ "C:/Users/Cesar/AppData/Local/Temp/Rtmp2XMb68/devtoolsac45b3744cf/JesseVent-crypto-8046b42" \ --library="E:/Program Files/R/R-3.4.1/library" --install-tests 'E:\Program' is not recognized as an internal or external command, operable program or batch file.Installation failed: Command failed (1)

2018-04-16 2:04 GMT+02:00 MP PM mprekr@gmail.com:

I used the code that you provided from the email " This is the raw function, try this" its creating a function. How should I proceed further?

kr mprekr

2018-04-16 2:01 GMT+02:00 MP PM mprekr@gmail.com:

install.packages("Rtools34")Warning in install.packages : package ‘Rtools34’ is not available (for R version 3.4.1)

2018-04-16 1:54 GMT+02:00 Jesse notifications@github.com:

This is the raw function, try this

crypto2xts <- function(df, frequency = NULL) { slug <- "" symbol <- "" name <- "" ranknow <- "" high <- "" low <- "" market <- "" volume <- "" freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381448168, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlgc5uEjU6BP2kHt3rRVA9rk1xe3Wks5to92dgaJpZM4TSh7l .

JesseVent commented 6 years ago

Try running the first part of this statement. If there are no errors, then run the last two one at a time (select the statement and click run on just that line of code.

My opinion is that its probably to do with where R is trying to install the packages (On your C:// drive) compared to where R appears to be installed (E://) drive.. but try the below. I don't have any experience using R with windows so can't be much help in that department.


### RUN FROM HERE -----------------------------------------------------
install.packages("dplyr", dependencies = TRUE)
install.packages("tidyverse", dependencies = TRUE)
install.packages("magrittr") 
library(magrittr)
library(dplyr)
library(tidyverse)
library(crypto)
library(lubridate)
library(xts)

df <- getCoins(limit = 50)

yourfunction <- function(df, frequency = NULL) {
  freq        <- frequency
  df$date     <- lubridate::round_date(df$date, freq)
  data        <-
    df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>%
    dplyr::summarise(
      open   = dplyr::first(open),
      high   = max(high),
      low    = min(low),
      close  = dplyr::last(close),
      volume = sum(volume),
      market = dplyr::last(market))
  data$volume <- round(data$volume, digits = 0)
  data$market <- round(data$market, digits = 0)
  data        <- as.data.frame(data)
  results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format =
                                                         "%d.%m.%Y %H:%M:%S"))
  return(results)
}

### TO HERE ---------------------------------------------------------------

#### IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------
week_xts  <- yourfunction(df, frequency = "week")

#### IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------
month_xts <- yourfunction(df, frequency = "month")
ghost commented 6 years ago

Dear Jesse,

For windows it does not metter where tou dawnload the packages because you can set a destination place for the code e.g:

setwd("E:/User/Desktop/studies/year I/semester II/seminar finance") getwd()

I am currently running the code and I will come to you latter back with my findings.

kind regards mprekr

2018-04-16 18:41 GMT+02:00 Jesse notifications@github.com:

Try running the first part of this statement. If there are no errors, then run the last two one at a time (select the statement and click run on just that line of code.

My opinion is that its probably to do with where R is trying to install the packages (On your C:// drive) compared to where R appears to be installed (E://) drive.. but try the below. I don't have any experience using R with windows so can't be much help in that department.

RUN FROM HERE -----------------------------------------------------

install.packages("dplyr", dependencies = TRUE) install.packages("tidyverse", dependencies = TRUE) install.packages("magrittr") library(magrittr) library(dplyr) library(tidyverse) library(crypto) library(lubridate) library(xts) df <- getCoins(limit = 50) yourfunction <- function(df, frequency = NULL) { freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

TO HERE ---------------------------------------------------------------

IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------week_xts <- yourfunction(df, frequency = "week")

IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------month_xts <- yourfunction(df, frequency = "month")

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381669142, or mute the thread https://github.com/notifications/unsubscribe-auth/AkjjlhCYUKnzrGmagFvpXHddhshKXmAqks5tpMm0gaJpZM4TSh7l .

ghost commented 6 years ago

Dear Jesse,

From what I see the code is working correctly. Below you can find the code. Now I am trying to crack this:

"Best way is for all return calculation (weekly and monthly) to refer back to the original Index and calculate the returns based on the date series (last trading day of the week/month). As coins are traded 24/7 this makes things easier."

kind regards mprekr

setwd("E:/User/Desktop/studies/year I/semester II/seminar finance") getwd()

RUN FROM HERE -----------------------------------------------------

install.packages("dplyr", dependencies = TRUE) install.packages("tidyverse", dependencies = TRUE) install.packages("magrittr") install.packages("xts")

library(magrittr) library(dplyr) library(tidyverse) library(crypto) library(lubridate) library(xts)

require(magrittr) require(dplyr) require(tidyverse) require(crypto) require(lubridate)

df <- getCoins(limit = 50)

yourfunction <- function(df, frequency = NULL) { freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------

week_xts <- yourfunction(df, frequency = "week")

IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------

month_xts <- yourfunction(df, frequency = "month")

2018-04-16 21:13 GMT+02:00 MP PM mprekr@gmail.com:

Dear Jesse,

For windows it does not metter where tou dawnload the packages because you can set a destination place for the code e.g:

setwd("E:/User/Desktop/studies/year I/semester II/seminar finance") getwd()

I am currently running the code and I will come to you latter back with my findings.

kind regards mprekr

2018-04-16 18:41 GMT+02:00 Jesse notifications@github.com:

Try running the first part of this statement. If there are no errors, then run the last two one at a time (select the statement and click run on just that line of code.

My opinion is that its probably to do with where R is trying to install the packages (On your C:// drive) compared to where R appears to be installed (E://) drive.. but try the below. I don't have any experience using R with windows so can't be much help in that department.

RUN FROM HERE -----------------------------------------------------

install.packages("dplyr", dependencies = TRUE) install.packages("tidyverse", dependencies = TRUE) install.packages("magrittr") library(magrittr) library(dplyr) library(tidyverse) library(crypto) library(lubridate) library(xts) df <- getCoins(limit = 50) yourfunction <- function(df, frequency = NULL) { freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

TO HERE ---------------------------------------------------------------

IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------week_xts <- yourfunction(df, frequency = "week")

IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------month_xts <- yourfunction(df, frequency = "month")

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381669142, or mute the thread https://github.com/notifications/unsubscribe-auth/AkjjlhCYUKnzrGmagFvpXHddhshKXmAqks5tpMm0gaJpZM4TSh7l .

ghost commented 6 years ago

Dear Jesse,

I se that this part: " "Best way is for all return calculation (weekly and monthly) to refer back to the original Index and calculate the returns based on the date series (last trading day of the week/month). As coins are traded 24/7 this makes things easier."

Has been already done by you. Thank you once more for your help. Can I come to you back if I will have more questions? I would also like to make a donation for you.

kind regards mprekr

2018-04-16 21:22 GMT+02:00 MP PM mprekr@gmail.com:

Dear Jesse,

From what I see the code is working correctly. Below you can find the code. Now I am trying to crack this:

"Best way is for all return calculation (weekly and monthly) to refer back to the original Index and calculate the returns based on the date series (last trading day of the week/month). As coins are traded 24/7 this makes things easier."

kind regards mprekr

setwd("E:/User/Desktop/studies/year I/semester II/seminar finance") getwd()

RUN FROM HERE -----------------------------------------------------

install.packages("dplyr", dependencies = TRUE) install.packages("tidyverse", dependencies = TRUE) install.packages("magrittr") install.packages("xts")

library(magrittr) library(dplyr) library(tidyverse) library(crypto) library(lubridate) library(xts)

require(magrittr) require(dplyr) require(tidyverse) require(crypto) require(lubridate)

df <- getCoins(limit = 50)

yourfunction <- function(df, frequency = NULL) { freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------

week_xts <- yourfunction(df, frequency = "week")

IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------

month_xts <- yourfunction(df, frequency = "month")

2018-04-16 21:13 GMT+02:00 MP PM mprekr@gmail.com:

Dear Jesse,

For windows it does not metter where tou dawnload the packages because you can set a destination place for the code e.g:

setwd("E:/User/Desktop/studies/year I/semester II/seminar finance") getwd()

I am currently running the code and I will come to you latter back with my findings.

kind regards mprekr

2018-04-16 18:41 GMT+02:00 Jesse notifications@github.com:

Try running the first part of this statement. If there are no errors, then run the last two one at a time (select the statement and click run on just that line of code.

My opinion is that its probably to do with where R is trying to install the packages (On your C:// drive) compared to where R appears to be installed (E://) drive.. but try the below. I don't have any experience using R with windows so can't be much help in that department.

RUN FROM HERE -----------------------------------------------------

install.packages("dplyr", dependencies = TRUE) install.packages("tidyverse", dependencies = TRUE) install.packages("magrittr") library(magrittr) library(dplyr) library(tidyverse) library(crypto) library(lubridate) library(xts) df <- getCoins(limit = 50) yourfunction <- function(df, frequency = NULL) { freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

TO HERE ---------------------------------------------------------------

IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------week_xts <- yourfunction(df, frequency = "week")

IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------month_xts <- yourfunction(df, frequency = "month")

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381669142, or mute the thread https://github.com/notifications/unsubscribe-auth/AkjjlhCYUKnzrGmagFvpXHddhshKXmAqks5tpMm0gaJpZM4TSh7l .

JesseVent commented 6 years ago

Its good to hear you got it working, yeah the function should make it pretty easy to work out the stochastic indicators, and now that its in the xts format you should pretty easily be able to answer most financial based calculations using functions from the quantmod package but happy to try help out.

ghost commented 6 years ago

Dear Jesse,

I would like to make a data frame for each data type (open, high, close, volume, market, close_ratio and spread) for daily, monthly and weekly frequencies. These data frames should be constructed in a way that each column represents one currency and the rows would represent observations.

However, when I try to use spread function for weekly and monthly frequencies in order to do this,it gives an error. How should I proceed? Thank you in advance and have a pleasant day.

Error:

weekly_open <- spread(weekxts[,c(1,5)],slug,open)Error in UseMethod("spread") : no applicable method for 'spread_' applied to an object of class "c('matrix', 'character')"> monthly_open <- spread(monthxts[,c(1,5)],slug,open)Error in UseMethod("spread") : no applicable method for 'spread_' applied to an object of class "c('matrix', 'character')"

kind regards mprekr

2018-04-17 12:20 GMT+02:00 Jesse notifications@github.com:

Its good to hear you got it working, yeah the function should make it pretty easy to work out the stochastic indicators, and now that its in the xts format you should pretty easily be able to answer most financial based calculations using functions from the quantmod package but happy to try help out.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381936916, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlr91PhfTKby75qUjR4jlC8ShmWRGks5tpcH5gaJpZM4TSh7l .

ghost commented 6 years ago

Bellow the code:

setwd("E:/User/Desktop/studies/year I/semester II/seminar finance") getwd()

install.packages("dplyr", dependencies = TRUE) install.packages("tidyverse", dependencies = TRUE) install.packages("magrittr") install.packages("xts") install.packages("PerformanceAnalytics") install.packages("quantmod") install.packages("tidyr")

library(magrittr) library(dplyr) library(tidyverse) library(crypto) library(lubridate) library(xts) library(PerformanceAnalytics) library(quantmod) library(tidyr)

require(magrittr) require(dplyr) require(tidyverse) require(crypto) require(lubridate) require(xts) require(PerformanceAnalytics) require(quantmod) require(tidyr)

df <- getCoins(limit = 50)

yourfunction <- function(df, frequency = NULL) { freq <- frequency df$date <- lubridate::round_date(df$date, freq) data <- df %>% dplyr::group_by(date, slug, symbol, name, ranknow) %>% dplyr::summarise( open = dplyr::first(open), high = max(high), low = min(low), close = dplyr::last(close), volume = sum(volume), market = dplyr::last(market)) data$volume <- round(data$volume, digits = 0) data$market <- round(data$market, digits = 0) data <- as.data.frame(data) results <- xts::xts(data[, 2:ncol(data)], as.POSIXct(data[, 1], format = "%d.%m.%Y %H:%M:%S")) return(results) }

IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------

week_xts <- yourfunction(df, frequency = "week")

IF NO ERRORS IN ABOVE RUN THESE INDIVIDUALLY------

month_xts <- yourfunction(df, frequency = "month")

daily_open <- spread(df[,c(1,4,6)],slug,open) weekly_open <- spread(week_xts[,c(1,5)],slug,open) monthly_open <- spread(month_xts[,c(1,5)],slug,open)

2018-04-29 22:50 GMT+02:00 MP PM mprekr@gmail.com:

Dear Jesse,

I would like to make a data frame for each data type (open, high, close, volume, market, close_ratio and spread) for daily, monthly and weekly frequencies. These data frames should be constructed in a way that each column represents one currency and the rows would represent observations.

However, when I try to use spread function for weekly and monthly frequencies in order to do this,it gives an error. How should I proceed? Thank you in advance and have a pleasant day.

Error:

weekly_open <- spread(weekxts[,c(1,5)],slug,open)Error in UseMethod("spread") : no applicable method for 'spread_' applied to an object of class "c('matrix', 'character')"> monthly_open <- spread(monthxts[,c(1,5)],slug,open)Error in UseMethod("spread") : no applicable method for 'spread_' applied to an object of class "c('matrix', 'character')"

kind regards mprekr

2018-04-17 12:20 GMT+02:00 Jesse notifications@github.com:

Its good to hear you got it working, yeah the function should make it pretty easy to work out the stochastic indicators, and now that its in the xts format you should pretty easily be able to answer most financial based calculations using functions from the quantmod package but happy to try help out.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-381936916, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlr91PhfTKby75qUjR4jlC8ShmWRGks5tpcH5gaJpZM4TSh7l .

JesseVent commented 6 years ago

Sorry not a use case I've come across before, look up transposing xts or matrix or maybe stackoverflow is a good place to ask.

ghost commented 6 years ago

Dear Jesse,

I will try what you sugested. Have a pleasant day.

kind regards mprekr

2018-04-30 16:15 GMT+02:00 Jesse notifications@github.com:

Sorry not a use case I've come across before, look up transposing xts or matrix or maybe stackoverflow is a good place to ask.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-385410820, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlpovcl6MYAKdCLE0OGl5ie-Y4mshks5ttxx4gaJpZM4TSh7l .

ghost commented 6 years ago

Dear Jesse,

I went with my issue public on github becasue I think that will make it faster. I am just checking the solutions that you have given to me. Have a pleasant day.

kind regards mprekr

2018-05-01 12:48 GMT+02:00 MP PM mprekr@gmail.com:

Dear Jesse,

I will try what you sugested. Have a pleasant day.

kind regards mprekr

2018-04-30 16:15 GMT+02:00 Jesse notifications@github.com:

Sorry not a use case I've come across before, look up transposing xts or matrix or maybe stackoverflow is a good place to ask.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/JesseVent/crypto/issues/15#issuecomment-385410820, or mute the thread https://github.com/notifications/unsubscribe-auth/Akjjlpovcl6MYAKdCLE0OGl5ie-Y4mshks5ttxx4gaJpZM4TSh7l .

ghost commented 6 years ago

Dear Jesse,

Thank you once more for your valuable input I solved the most issues that I had with my code and I am proceeding with it.

kind regards mprekr