lightweightchartR brings TradingView's
lightweight-charts
library to R in a package designed for quantmod users.
The goal is simple:
If you already work with quantmod, xts, and pipe-based workflows, this
package gives you a more modern interactive charting layer while keeping the
data pipeline familiar.
Instead of building chart specs by hand, you can do this:
library(quantmod)
library(lightweightchartR)
getSymbols("SPY", from = "2024-01-01")
SPY |>
lwc_chart(theme = "dark", name = "SPY") |>
add_volume() |>
add_sma(50, color = "blue") |>
add_sma(200, color = "goldenrod") |>
add_rsi()
lightweight-charts powered htmlwidgetxts, zoo, and quantmod
chartSeries()-style workflowslibrary(quantmod)
library(lightweightchartR)
getSymbols("AAPL", from = "2023-01-01")
AAPL |>
lwc_chart(theme = "dark", name = "AAPL") |>
add_volume() |>
add_sma(20, color = "#2563eb") |>
add_sma(50, color = "#f59e0b")
For users migrating from quantmod::chartSeries(), there is also a compact
wrapper:
chart_series_lwc(
AAPL,
theme = "dark",
TA = "addVo();addSMA(n = 20);addRSI()"
)
Install from GitHub once the repository is published:
# pak::pak("arkraieski/lightweightchartR")
install.packages("lightweightchartR", repos = c('https://arkraieski.r-universe.dev', 'https://cloud.r-project.org'))
The package is currently focused on:
More advanced customization can be added over time where it clearly improves real workflows.