Comments (33)
Sure, how can I help?
from crypto.
from crypto.
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.
from crypto.
from crypto.
Can you please paste the errors as I cant view attachments
from crypto.
from crypto.
Have you installed version 1.6 from github repo? devtools::install_github("jessevent/crypto")
from crypto.
from crypto.
install.packages("devtools")
devtools::install_github("jessevent/crypto")
from crypto.
from crypto.
ahh your using windows, I think it could be an issue with the devtools library
View last comment and try that
from crypto.
from crypto.
https://cran.r-project.org/bin/windows/Rtools/
from crypto.
from crypto.
from crypto.
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.
from crypto.
from crypto.
from crypto.
from crypto.
from crypto.
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.
from crypto.
from crypto.
from crypto.
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.
from crypto.
from crypto.
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.
from crypto.
from crypto.
from crypto.
Related Issues (20)
- No package called 'plyr' issue
- no package called 'plyr' issue
- No package called 'plyr' issue
- Inconsistent and incomplete results from getCoins() and crypto_history() HOT 14
- Error in get(as.character(FUN), mode = "function", envir = envir) : object 'bind_rows' of mode 'function' was not found HOT 2
- CMC "paid" plan and API key HOT 14
- error when loading library(crypto), HOT 5
- Could not find function "daily_market" HOT 1
- Error in Sys.setlocale("LC_TIME", locale) HOT 8
- crypto_history skipping coins again HOT 3
- Include historic data as .rda file HOT 1
- Crypto History Error HOT 2
- Subscript out of bounds error HOT 24
- Coinmarketcap API deprecated, library no longer working HOT 1
- Some missing tokens
- The package is no longer available on CRAN HOT 1
- crypto_history not working HOT 16
- Still working? HOT 1
- Crypto_histoty function is not working, could you please update? Thanks HOT 1
- 1000,000
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crypto.