Giter Site home page Giter Site logo

contact with JesseVent about crypto HOT 33 CLOSED

jessevent avatar jessevent commented on August 23, 2024
contact with JesseVent

from crypto.

Comments (33)

JesseVent avatar JesseVent commented on August 23, 2024

Sure, how can I help?

from crypto.

 avatar commented on August 23, 2024

from crypto.

JesseVent avatar JesseVent commented on August 23, 2024

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?

from crypto.

 avatar commented on August 23, 2024

from crypto.

 avatar commented on August 23, 2024

from crypto.

JesseVent avatar JesseVent commented on August 23, 2024

Can you please paste the errors as I cant view attachments

from crypto.

 avatar commented on August 23, 2024

from crypto.

JesseVent avatar JesseVent commented on August 23, 2024

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

from crypto.

 avatar commented on August 23, 2024

from crypto.

JesseVent avatar JesseVent commented on August 23, 2024

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

from crypto.

 avatar commented on August 23, 2024

from crypto.

JesseVent avatar JesseVent commented on August 23, 2024

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

r-lib/devtools#426

View last comment and try that

from crypto.

 avatar commented on August 23, 2024

from crypto.

JesseVent avatar JesseVent commented on August 23, 2024

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

from crypto.

 avatar commented on August 23, 2024

from crypto.

 avatar commented on August 23, 2024

from crypto.

JesseVent avatar JesseVent commented on August 23, 2024

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)
}

from crypto.

 avatar commented on August 23, 2024

from crypto.

 avatar commented on August 23, 2024

from crypto.

 avatar commented on August 23, 2024

from crypto.

 avatar commented on August 23, 2024

from crypto.

 avatar commented on August 23, 2024

from crypto.

JesseVent avatar JesseVent commented on August 23, 2024

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")

from crypto.

 avatar commented on August 23, 2024

from crypto.

 avatar commented on August 23, 2024

from crypto.

 avatar commented on August 23, 2024

from crypto.

JesseVent avatar JesseVent commented on August 23, 2024

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.

from crypto.

 avatar commented on August 23, 2024

from crypto.

 avatar commented on August 23, 2024

from crypto.

JesseVent avatar JesseVent commented on August 23, 2024

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.

from crypto.

 avatar commented on August 23, 2024

from crypto.

 avatar commented on August 23, 2024

from crypto.

 avatar commented on August 23, 2024

from crypto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.