32e18cb3a3
Fills the two empty r-universe tabs (**Articles**, **Datasets**) for the R package and gives R users a runnable onboarding path. ## What - **`vignettes/getting-started.Rmd`** — Articles tab. Walks through batch vs streaming (and that they're equivalent), multi-output MACD, candle ATR, and `reset()`, all over the bundled sample series. Built strictly from the already-proven README quick-start + golden-test API (`Sma`/`Ema`/`Rsi`/`Atr`/`MacdIndicator`, `batch`/`update`/`reset`) — no new indicator logic. - **`data/sample_ohlcv.rda`** (+ `data-raw/sample_ohlcv.R` generator) — Datasets tab. A deterministic, seeded synthetic daily OHLCV series (250 rows × `date/open/high/low/close/volume`); documented via `R/data.R` + `man/sample_ohlcv.Rd`. `LazyData: true` → available right after `library(wickra)`. - **`DESCRIPTION`** — `Suggests: knitr, rmarkdown`, `VignetteBuilder: knitr`, `LazyData: true`. - **`ci.yml`** — the R job now knits the vignette (executes its R chunks, no pandoc needed) so a broken example is caught **in CI** before r-universe / CRAN `R CMD check`. The main job otherwise only `R CMD INSTALL`s. ## Verified locally (R 4.6.0 + Rtools45) - Package installs with the dev C-ABI override; dataset moves to the lazyload DB. - Vignette **knits cleanly** — every chunk runs, `batch == streaming` holds, MACD/ATR/RSI produce sensible values. ## Notes - No version bump — metadata/docs only; rides the next release. Merging triggers an r-universe rebuild → Articles + Datasets populate **and** (now that `support@wickra.org` is verified) the maintainer avatar resolves. - `data-raw/` is `.Rbuildignore`d (generator, not shipped). The `.rda` is XZ-compressed (~3 KB). Not merging — for review.
32 lines
1.1 KiB
R
32 lines
1.1 KiB
R
# Generates data/sample_ohlcv.rda — a deterministic, synthetic daily OHLCV
|
|
# series used by the examples, the getting-started vignette, and tests. It is a
|
|
# seeded random walk, NOT real market data.
|
|
#
|
|
# Regenerate (run from the R package root, bindings/r):
|
|
# Rscript data-raw/sample_ohlcv.R
|
|
|
|
set.seed(42)
|
|
n <- 250L
|
|
dates <- seq(as.Date("2023-01-02"), by = "day", length.out = n)
|
|
|
|
# Random-walk close with a mild upward drift; derive OHLC around it.
|
|
returns <- rnorm(n, mean = 0.0004, sd = 0.012)
|
|
close <- round(100 * cumprod(1 + returns), 2)
|
|
open <- round(c(100, head(close, -1)) * (1 + rnorm(n, 0, 0.003)), 2)
|
|
high <- round(pmax(open, close) * (1 + abs(rnorm(n, 0, 0.004))), 2)
|
|
low <- round(pmin(open, close) * (1 - abs(rnorm(n, 0, 0.004))), 2)
|
|
volume <- round(1e6 * exp(rnorm(n, 0, 0.3)))
|
|
|
|
sample_ohlcv <- data.frame(
|
|
date = dates,
|
|
open = open,
|
|
high = high,
|
|
low = low,
|
|
close = close,
|
|
volume = volume
|
|
)
|
|
|
|
save(sample_ohlcv, file = "data/sample_ohlcv.rda", compress = "xz", version = 2)
|
|
cat(sprintf("wrote data/sample_ohlcv.rda: %d rows x %d cols\n",
|
|
nrow(sample_ohlcv), ncol(sample_ohlcv)))
|