Created
June 26, 2017 04:12
-
-
Save ianfmc/84444adbfd6d27269f56cdf741a8330b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(plotly) | |
library(quantmod) | |
getSymbols("AAPL",src='yahoo') | |
# basic example of ohlc charts | |
df <- data.frame(Date=index(AAPL),coredata(AAPL)) | |
df <- tail(df, 30) | |
p <- df %>% | |
plot_ly(x = ~Date, type="candlestick", | |
open = ~AAPL.Open, close = ~AAPL.Close, | |
high = ~AAPL.High, low = ~AAPL.Low) %>% | |
layout(title = "Basic Candlestick Chart") | |
# Create a shareable link to your chart | |
# Set up API credentials: https://plot.ly/r/getting-started | |
chart_link = plotly_POST(p, filename="finance/candlestick-basic") | |
chart_link | |
Copy to clipboard! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment