[R-br] RES: Grafico Open High Loss Close (OHLC) de barras

Mauro Sznelwar sznelwar em uol.com.br
Quinta Fevereiro 4 23:51:56 BRST 2016


Eu não consegui rodar isto, o que aconteceu?

 

> library(Quandl)

> Facebook = Quandl('GOOG/NASDAQ_FB', type = "xts")

Error in headers$value()[["X-RateLimit-Remaining"]] : 

  subscript out of bounds

In addition: Warning message:

In Quandl("GOOG/NASDAQ_FB", type = "xts") :

  It would appear you aren't using an authentication token. Please visit http://www.quandl.com/help/r or your usage may be limited.

> candleChart(Facebook["2016-01::2016-01"])

Error in do.call("chartSeries", list(x, subset = subset, name = name,  : 

  object 'Facebook' not found

 

 

Senhores, bom dia!

 

Há um tutorial interativo sobre o Quandl/R no site Datacamp. É possível fazer em menos de uma hora e é muito útil.

< <https://www.datacamp.com/courses/how-to-work-with-quandl-in-r> https://www.datacamp.com/courses/how-to-work-with-quandl-in-r>. Entre outras coisas, ensina fazer o gráfico OHLC com o pacote {quantmod}.

 

Embora o curso ensine a obter os dados diretamente da web, você pode gerar o gráfico a partir de dados próprios, se converter para algum formato aceito pelo pacote, como xts, por exemplo. 

 

### <code r>

my.df <- data.frame(

Day=c("2015-01-02", "2015-01-05", "2015-01-06", "2015-01-07", "2015-01-08", "2015-01-09"),

Open =c(50.7, 49.7, 49.2, 49.6, 49.0, 50.3),

High =c(50.8, 49.9, 49.9, 49.6, 50.2, 50.4),

Low  =c(49.5, 48.9, 48.3, 48.5, 48.7, 49.6),

Close=c(50.2, 49.1, 49.2, 48.6, 50.2, 49.7))

my.df

 

require(quantmod)

my.xts <- xts(my.df[,2:5], order.by=as.Date(my.df$Day))

candleChart(my.xts, theme="white")

chartSeries(my.xts)

 

library(Quandl)

Facebook = Quandl('GOOG/NASDAQ_FB', type = "xts")

candleChart(Facebook["2016-01::2016-01"])

### </code>

 




​

================================================
Éder Comunello

PhD Student in Agricultural Systems Engineering (USP/Esalq)

Brazilian Agricultural Research Corporation (Embrapa)

Dourados, MS, Brazil [22 16.5'S, 54 49.0'W]

 

 

 

 



---
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20160204/2d73382d/attachment.html>


Mais detalhes sobre a lista de discussão R-br