-
Notifications
You must be signed in to change notification settings - Fork 633
Candlestick charts in R #630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hey @debsush - Have you seen this? It might help to get you started. |
Thanks Jack. I have seen the implementation - it is definitely a good start. While there is a ton of work to be done on this chart which I can take up on my own, what bothers me is the render speed. TODO:
All of the above is very much doable but I am a bit concerned about the render speed. Currently a 10 yr daily OHLC data takes 8-12 seconds to render. Compare this with ChartSeries in quantmod, render time is in milliseconds which is so cool. @timelyportfolio Your feedback will be most welcome on this. Regards |
When #628 is finished, you'll be able to do something like: library(plotly)
library(quantmod)
library(dplyr)
prices <- getSymbols("MSFT", auto.assign = F)
dat <- as.data.frame(prices)
dat$date <- index(prices)
names(dat) <- sub("^MSFT\\.", "", names(dat))
# create variable with hovertext displaying values of every variable
vars <- Map(function(x, y) paste0(x, ": ", y), names(dat), dat)
dat$txt <- Reduce(function(x, y) paste0(x, "<br />", y), vars)
plot_ly(dat, x = ~date, xend = ~date, color = ~Close > Open,
colors = c("red", "forestgreen"), hoverinfo = "none") %>%
add_segments(y = ~Low, yend = ~High, line = list(width = 1)) %>%
add_segments(y = ~Open, yend = ~Close, line = list(width = 3)) %>%
add_markers(y = ~(Close + Open)/2, text = ~txt, hoverinfo = "text", opacity = 0) %>%
toWebGL() %>%
layout(showlegend = FALSE, yaxis = list(title = "Price")) |
Closed via d2bf2a1. |
Hi,
I am new to plotly and was wondering if the following is doable with the package:
import plotly.plotly as py
from plotly.tools import FigureFactory as FF
from datetime import datetime
import pandas.io.data as web
df = web.DataReader("aapl", 'yahoo', datetime(2007, 10, 1), datetime(2009, 4, 1))
fig = FF.create_candlestick(df.Open, df.High, df.Low, df.Close, dates=df.index)
py.iplot(fig, filename='finance/aapl-candlestick', validate=False)
Even if it is still not in place, was wondering if you could guide me as to how can I start developing these R charting functions within plotly?
Regards,
SD
The text was updated successfully, but these errors were encountered: