Compare commits

..

3 Commits

Author SHA1 Message Date
kingchenc b1653e2107 release: bump 0.8.6 -> 0.8.7 (#263)
Version bump `0.8.6` → `0.8.7`.

### Added
- R binding: a *Getting started* vignette and a synthetic `sample_ohlcv` example dataset, giving new users a runnable, self-contained walkthrough and populating the R-universe Articles and Datasets tabs. The vignette's code is exercised in CI so a broken example is caught before the published build. (#262)

Bump touches the manual release touchpoints only; docs/webpage version strings are left to `sync-about.yml` on the tag.
2026-06-11 21:47:50 +02:00
kingchenc 32e18cb3a3 feat(r): getting-started vignette + sample_ohlcv dataset (#262)
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.
2026-06-11 21:44:56 +02:00
kingchenc dc0c3d1736 docs(readme): serve footer social badges + star-history from snapshots (#261)
Pairs with **wickra-lib/.github#32**. The README footer (GitHub stars / forks / issues) hot-linked `img.shields.io` directly, so it showed shields' transient **"unable to select next github token from pool"** error live; the star-history chart hot-linked `star-history.com` and **froze** behind GitHub's Camo image cache (the embedded `<img>` is proxied + cached, while the linked page renders fresh).

All four now point at the committed snapshots in the `.github` repo (`raw.githubusercontent.com/wickra-lib/.github/main/profile/badges/{stars,forks,issues,star-history}.svg`), refreshed hourly by the new `refresh-social.yml` — so a broken upstream never reaches the page and the last good SVG is always served. The `<a>` links and the visual style are unchanged.

## Merge order
Merge **.github#32 first** (it creates the snapshot SVGs), then this one — otherwise the footer would briefly point at missing raw URLs.

Not merging yet — for review.
2026-06-11 19:28:04 +02:00
27 changed files with 277 additions and 68 deletions
+10
View File
@@ -926,6 +926,16 @@ jobs:
R CMD INSTALL bindings/r
Rscript -e 'library(testthat); library(wickra); test_dir("bindings/r/tests/testthat", stop_on_failure = TRUE)'
- name: Build the vignette code
shell: bash
# The getting-started vignette runs at R CMD check time on r-universe /
# CRAN (with pandoc); this job only INSTALLs, so execute the vignette's R
# chunks here (knit, no pandoc needed) to catch a broken example before it
# reaches the published build.
run: |
Rscript -e 'install.packages("knitr", repos = Sys.getenv("RSPM", unset = "https://cloud.r-project.org"))'
Rscript -e 'knitr::knit("bindings/r/vignettes/getting-started.Rmd", output = tempfile(fileext = ".md"), quiet = TRUE); cat("vignette code OK\n")'
- name: Run the offline R examples
shell: bash
# No loader-path exports: the installed package is self-contained (bundled
+9 -1
View File
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.8.7] - 2026-06-11
### Added
- R binding: a *Getting started* vignette and a synthetic `sample_ohlcv` example
dataset, giving new users a runnable, self-contained walkthrough and populating
the R-universe Articles and Datasets tabs. The vignette's code is exercised in
CI so a broken example is caught before the published build.
## [0.8.6] - 2026-06-11
### Changed
- Package registry metadata for better discoverability:
@@ -1559,7 +1566,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
optional Binance live feed.
- Bindings for Python, Node.js, and WebAssembly.
[Unreleased]: https://github.com/wickra-lib/wickra/compare/v0.8.6...HEAD
[Unreleased]: https://github.com/wickra-lib/wickra/compare/v0.8.7...HEAD
[0.8.7]: https://github.com/wickra-lib/wickra/compare/v0.8.6...v0.8.7
[0.8.6]: https://github.com/wickra-lib/wickra/compare/v0.8.5...v0.8.6
[0.8.5]: https://github.com/wickra-lib/wickra/compare/v0.8.4...v0.8.5
[0.8.4]: https://github.com/wickra-lib/wickra/compare/v0.8.3...v0.8.4
Generated
+9 -9
View File
@@ -1944,7 +1944,7 @@ dependencies = [
[[package]]
name = "wickra"
version = "0.8.6"
version = "0.8.7"
dependencies = [
"approx",
"criterion",
@@ -1955,7 +1955,7 @@ dependencies = [
[[package]]
name = "wickra-bench"
version = "0.8.6"
version = "0.8.7"
dependencies = [
"criterion",
"kand",
@@ -1967,14 +1967,14 @@ dependencies = [
[[package]]
name = "wickra-c"
version = "0.8.6"
version = "0.8.7"
dependencies = [
"wickra-core",
]
[[package]]
name = "wickra-core"
version = "0.8.6"
version = "0.8.7"
dependencies = [
"approx",
"proptest",
@@ -1984,7 +1984,7 @@ dependencies = [
[[package]]
name = "wickra-data"
version = "0.8.6"
version = "0.8.7"
dependencies = [
"approx",
"csv",
@@ -2001,7 +2001,7 @@ dependencies = [
[[package]]
name = "wickra-examples"
version = "0.8.6"
version = "0.8.7"
dependencies = [
"serde_json",
"tokio",
@@ -2011,7 +2011,7 @@ dependencies = [
[[package]]
name = "wickra-node"
version = "0.8.6"
version = "0.8.7"
dependencies = [
"napi",
"napi-build",
@@ -2021,7 +2021,7 @@ dependencies = [
[[package]]
name = "wickra-python"
version = "0.8.6"
version = "0.8.7"
dependencies = [
"numpy",
"pyo3",
@@ -2030,7 +2030,7 @@ dependencies = [
[[package]]
name = "wickra-wasm"
version = "0.8.6"
version = "0.8.7"
dependencies = [
"console_error_panic_hook",
"js-sys",
+2 -2
View File
@@ -14,7 +14,7 @@ members = [
exclude = ["fuzz"]
[workspace.package]
version = "0.8.6"
version = "0.8.7"
authors = ["kingchenc <support@wickra.org>"]
edition = "2021"
rust-version = "1.86"
@@ -26,7 +26,7 @@ keywords = ["finance", "trading", "indicators", "technical-analysis", "ta"]
categories = ["finance", "mathematics", "science"]
[workspace.dependencies]
wickra-core = { path = "crates/wickra-core", version = "0.8.6" }
wickra-core = { path = "crates/wickra-core", version = "0.8.7" }
thiserror = "2"
rayon = "1.10"
+4 -4
View File
@@ -419,13 +419,13 @@ The library is provided **as is**, without warranty of any kind; see
<p align="center">
<a href="https://github.com/wickra-lib/wickra/stargazers">
<img alt="GitHub stars" src="https://img.shields.io/github/stars/wickra-lib/wickra?style=for-the-badge&logo=github&logoColor=white&color=ffd866">
<img alt="GitHub stars" src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/badges/stars.svg">
</a>
<a href="https://github.com/wickra-lib/wickra/network/members">
<img alt="GitHub forks" src="https://img.shields.io/github/forks/wickra-lib/wickra?style=for-the-badge&logo=github&logoColor=white&color=78dce8">
<img alt="GitHub forks" src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/badges/forks.svg">
</a>
<a href="https://github.com/wickra-lib/wickra/issues">
<img alt="GitHub issues" src="https://img.shields.io/github/issues/wickra-lib/wickra?style=for-the-badge&logo=github&logoColor=white&color=ff6188">
<img alt="GitHub issues" src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/badges/issues.svg">
</a>
</p>
@@ -436,6 +436,6 @@ The library is provided **as is**, without warranty of any kind; see
<p align="center">
<a href="https://star-history.com/#wickra-lib/wickra&Date">
<img alt="Wickra star history" width="640"
src="https://api.star-history.com/svg?repos=wickra-lib/wickra&type=Date&theme=dark">
src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/badges/star-history.svg">
</a>
</p>
+3 -3
View File
@@ -2,13 +2,13 @@
## Supported versions
Wickra is pre-1.0. Security fixes are applied to the latest released `0.8.6`
Wickra is pre-1.0. Security fixes are applied to the latest released `0.8.7`
version only; please upgrade to the newest release before reporting an issue.
| Version | Supported |
| --- | --- |
| 0.8.6 (latest) | :white_check_mark: |
| < 0.8.6 | :x: |
| 0.8.7 (latest) | :white_check_mark: |
| < 0.8.7 | :x: |
## Reporting a vulnerability
+1 -1
View File
@@ -11,7 +11,7 @@
<!-- NuGet package metadata -->
<PackageId>Wickra</PackageId>
<Version>0.8.6</Version>
<Version>0.8.7</Version>
<Authors>kingchenc</Authors>
<Description>High-performance streaming technical-analysis indicators (514 indicators) for .NET, backed by the native Rust core via the Wickra C ABI.</Description>
<PackageLicenseExpression>MIT OR Apache-2.0</PackageLicenseExpression>
+2 -2
View File
@@ -30,14 +30,14 @@ Maven:
<dependency>
<groupId>org.wickra</groupId>
<artifactId>wickra</artifactId>
<version>0.8.6</version>
<version>0.8.7</version>
</dependency>
```
Gradle:
```kotlin
implementation("org.wickra:wickra:0.8.6")
implementation("org.wickra:wickra:0.8.7")
```
The native library ships prebuilt per platform (Linux, macOS, Windows — x64 and
+1 -1
View File
@@ -6,7 +6,7 @@
<groupId>org.wickra</groupId>
<artifactId>wickra</artifactId>
<version>0.8.6</version>
<version>0.8.7</version>
<packaging>jar</packaging>
<name>Wickra</name>
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "wickra-darwin-arm64",
"version": "0.8.6",
"version": "0.8.7",
"description": "Native binding for wickra (macOS Apple Silicon). Installed automatically as an optional dependency of wickra on matching platforms.",
"main": "wickra.darwin-arm64.node",
"files": [
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "wickra-darwin-x64",
"version": "0.8.6",
"version": "0.8.7",
"description": "Native binding for wickra (macOS Intel). Installed automatically as an optional dependency of wickra on matching platforms.",
"main": "wickra.darwin-x64.node",
"files": [
@@ -1,6 +1,6 @@
{
"name": "wickra-linux-arm64-gnu",
"version": "0.8.6",
"version": "0.8.7",
"description": "Native binding for wickra (linux arm64 GNU). Installed automatically as an optional dependency of wickra on matching platforms.",
"main": "wickra.linux-arm64-gnu.node",
"files": [
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "wickra-linux-x64-gnu",
"version": "0.8.6",
"version": "0.8.7",
"description": "Native binding for wickra (linux x64 GNU). Installed automatically as an optional dependency of wickra on matching platforms.",
"main": "wickra.linux-x64-gnu.node",
"files": [
@@ -1,6 +1,6 @@
{
"name": "wickra-win32-arm64-msvc",
"version": "0.8.6",
"version": "0.8.7",
"description": "Native binding for wickra (Windows arm64 MSVC). Installed automatically as an optional dependency of wickra on matching platforms.",
"main": "wickra.win32-arm64-msvc.node",
"files": [
@@ -1,6 +1,6 @@
{
"name": "wickra-win32-x64-msvc",
"version": "0.8.6",
"version": "0.8.7",
"description": "Native binding for wickra (Windows x64 MSVC). Installed automatically as an optional dependency of wickra on matching platforms.",
"main": "wickra.win32-x64-msvc.node",
"files": [
+20 -20
View File
@@ -1,12 +1,12 @@
{
"name": "wickra",
"version": "0.8.6",
"version": "0.8.7",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wickra",
"version": "0.8.6",
"version": "0.8.7",
"license": "MIT OR Apache-2.0",
"devDependencies": {
"@napi-rs/cli": "^2.18.0"
@@ -15,12 +15,12 @@
"node": ">= 18"
},
"optionalDependencies": {
"wickra-darwin-arm64": "0.8.6",
"wickra-darwin-x64": "0.8.6",
"wickra-linux-arm64-gnu": "0.8.6",
"wickra-linux-x64-gnu": "0.8.6",
"wickra-win32-arm64-msvc": "0.8.6",
"wickra-win32-x64-msvc": "0.8.6"
"wickra-darwin-arm64": "0.8.7",
"wickra-darwin-x64": "0.8.7",
"wickra-linux-arm64-gnu": "0.8.7",
"wickra-linux-x64-gnu": "0.8.7",
"wickra-win32-arm64-msvc": "0.8.7",
"wickra-win32-x64-msvc": "0.8.7"
}
},
"node_modules/@napi-rs/cli": {
@@ -41,8 +41,8 @@
}
},
"node_modules/wickra-darwin-arm64": {
"version": "0.8.6",
"resolved": "https://registry.npmjs.org/wickra-darwin-arm64/-/wickra-darwin-arm64-0.8.6.tgz",
"version": "0.8.7",
"resolved": "https://registry.npmjs.org/wickra-darwin-arm64/-/wickra-darwin-arm64-0.8.7.tgz",
"integrity": "sha512-4eZiBR/yGUdr4nzhEUFy2i69XgNx64iI2ax/LPamsThgylC0KpHOZKK19QzJ2d9KbK4C8nMjME5FLuR+4GNEwQ==",
"cpu": [
"arm64"
@@ -57,8 +57,8 @@
}
},
"node_modules/wickra-darwin-x64": {
"version": "0.8.6",
"resolved": "https://registry.npmjs.org/wickra-darwin-x64/-/wickra-darwin-x64-0.8.6.tgz",
"version": "0.8.7",
"resolved": "https://registry.npmjs.org/wickra-darwin-x64/-/wickra-darwin-x64-0.8.7.tgz",
"integrity": "sha512-6hf8zI3QPjTFp4zCpmgUwDvNtu6jHqNUHKD5e55POo0CgA52HkpyxSPtVm8TGTIZDI7kPjlbOdBM8CJ76mmXwA==",
"cpu": [
"x64"
@@ -73,8 +73,8 @@
}
},
"node_modules/wickra-linux-arm64-gnu": {
"version": "0.8.6",
"resolved": "https://registry.npmjs.org/wickra-linux-arm64-gnu/-/wickra-linux-arm64-gnu-0.8.6.tgz",
"version": "0.8.7",
"resolved": "https://registry.npmjs.org/wickra-linux-arm64-gnu/-/wickra-linux-arm64-gnu-0.8.7.tgz",
"integrity": "sha512-kSe6y0xBMSiqdPLXNjwop5WZdHtvdBNKSEBCwZ4hFq33p4apW25/wrlzv9/oDuyD4kuPabJEhCCnFOplh58CUg==",
"cpu": [
"arm64"
@@ -89,8 +89,8 @@
}
},
"node_modules/wickra-linux-x64-gnu": {
"version": "0.8.6",
"resolved": "https://registry.npmjs.org/wickra-linux-x64-gnu/-/wickra-linux-x64-gnu-0.8.6.tgz",
"version": "0.8.7",
"resolved": "https://registry.npmjs.org/wickra-linux-x64-gnu/-/wickra-linux-x64-gnu-0.8.7.tgz",
"integrity": "sha512-tWBWS4qz7hxM4xnpFb59bhf6TaLwXq0Z3jEa/2l7r8PiHA94g8r8S53NRMiT+4yiL5hSWe/nUiC/YXdRrhEZ4g==",
"cpu": [
"x64"
@@ -105,8 +105,8 @@
}
},
"node_modules/wickra-win32-arm64-msvc": {
"version": "0.8.6",
"resolved": "https://registry.npmjs.org/wickra-win32-arm64-msvc/-/wickra-win32-arm64-msvc-0.8.6.tgz",
"version": "0.8.7",
"resolved": "https://registry.npmjs.org/wickra-win32-arm64-msvc/-/wickra-win32-arm64-msvc-0.8.7.tgz",
"integrity": "sha512-EXIckHxAtF75PUGDKRzXyqMe9ldP0JjSdu68WFN6iJfp+McYrGu6h40TEJlQ/oUEIoPqiZB/xhVyo/el5Lg7zw==",
"cpu": [
"arm64"
@@ -121,8 +121,8 @@
}
},
"node_modules/wickra-win32-x64-msvc": {
"version": "0.8.6",
"resolved": "https://registry.npmjs.org/wickra-win32-x64-msvc/-/wickra-win32-x64-msvc-0.8.6.tgz",
"version": "0.8.7",
"resolved": "https://registry.npmjs.org/wickra-win32-x64-msvc/-/wickra-win32-x64-msvc-0.8.7.tgz",
"integrity": "sha512-Yfsqq1Xwp6hdxMyLze411vNdo7BDwI6+lPSe7A9XdqyPecNDbtKwYLpsal2r8EHbNzqM+R8XnuRtUaEQS5VlUQ==",
"cpu": [
"x64"
+7 -7
View File
@@ -1,6 +1,6 @@
{
"name": "wickra",
"version": "0.8.6",
"version": "0.8.7",
"description": "Streaming-first technical indicators: incremental, fast, install-free. Node bindings powered by Rust.",
"author": "kingchenc <support@wickra.org>",
"main": "index.js",
@@ -47,12 +47,12 @@
"node": ">= 18"
},
"optionalDependencies": {
"wickra-linux-x64-gnu": "0.8.6",
"wickra-linux-arm64-gnu": "0.8.6",
"wickra-darwin-x64": "0.8.6",
"wickra-darwin-arm64": "0.8.6",
"wickra-win32-x64-msvc": "0.8.6",
"wickra-win32-arm64-msvc": "0.8.6"
"wickra-linux-x64-gnu": "0.8.7",
"wickra-linux-arm64-gnu": "0.8.7",
"wickra-darwin-x64": "0.8.7",
"wickra-darwin-arm64": "0.8.7",
"wickra-win32-x64-msvc": "0.8.7",
"wickra-win32-arm64-msvc": "0.8.7"
},
"scripts": {
"build": "napi build --platform --release",
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "maturin"
[project]
name = "wickra"
version = "0.8.6"
version = "0.8.7"
description = "Streaming-first technical indicators: incremental, fast, install-free."
readme = "README.md"
license = "MIT OR Apache-2.0"
+1
View File
@@ -11,3 +11,4 @@
^src/wickra-c$
^src/Makevars$
^\.gitignore$
^data-raw$
+4 -2
View File
@@ -1,7 +1,7 @@
Package: wickra
Type: Package
Title: Streaming-First Technical Indicators
Version: 0.8.6
Version: 0.8.7
Authors@R: person("Wickra contributors", role = c("aut", "cre"), email = "support@wickra.org")
Description: R bindings for the Wickra technical-analysis library over its C ABI
hub. Exposes 514 indicators, each an O(1) streaming state machine shared with
@@ -21,6 +21,8 @@ SystemRequirements: the Wickra C ABI shared library, downloaded automatically at
Set WICKRA_INCLUDE_DIR and WICKRA_LIB_DIR to build against a locally built C
ABI instead (e.g. after `cargo build -p wickra-c --release`).
Roxygen: list(markdown = TRUE)
Suggests: testthat (>= 3.0.0)
Suggests: testthat (>= 3.0.0), knitr, rmarkdown
VignetteBuilder: knitr
LazyData: true
Config/testthat/edition: 3
Config/roxygen2/version: 8.0.0
+17
View File
@@ -0,0 +1,17 @@
#' Synthetic daily OHLCV sample series
#'
#' A deterministic, synthetic daily OHLCV (open / high / low / close / volume)
#' price series for use in the examples, the *Getting started* vignette, and
#' tests. It is a seeded random walk, **not** real market data. Regenerate with
#' `data-raw/sample_ohlcv.R`.
#'
#' @format A data frame with 250 rows and 6 columns:
#' \describe{
#' \item{date}{Trading date (`Date`).}
#' \item{open}{Opening price.}
#' \item{high}{Session high.}
#' \item{low}{Session low.}
#' \item{close}{Closing price.}
#' \item{volume}{Traded volume.}
#' }
"sample_ohlcv"
+31
View File
@@ -0,0 +1,31 @@
# 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)))
Binary file not shown.
+27
View File
@@ -0,0 +1,27 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data.R
\docType{data}
\name{sample_ohlcv}
\alias{sample_ohlcv}
\title{Synthetic daily OHLCV sample series}
\format{
A data frame with 250 rows and 6 columns:
\describe{
\item{date}{Trading date (\code{Date}).}
\item{open}{Opening price.}
\item{high}{Session high.}
\item{low}{Session low.}
\item{close}{Closing price.}
\item{volume}{Traded volume.}
}
}
\usage{
sample_ohlcv
}
\description{
A deterministic, synthetic daily OHLCV (open / high / low / close / volume)
price series for use in the examples, the \emph{Getting started} vignette, and
tests. It is a seeded random walk, \strong{not} real market data. Regenerate with
\code{data-raw/sample_ohlcv.R}.
}
\keyword{datasets}
+113
View File
@@ -0,0 +1,113 @@
---
title: "Getting started with wickra"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Getting started with wickra}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
```
`wickra` exposes the Wickra technical-analysis library in R over its C ABI hub.
Every indicator is a constructor returning a `wickra_indicator`; you feed it data
one observation at a time with `update()` (an O(1) streaming step) or run a whole
series at once with `batch()`. Both paths share the exact same Rust core, so a
live feed and a historical backtest compute identical values.
```{r}
library(wickra)
```
## A sample series
The package ships a small synthetic OHLCV series, `sample_ohlcv`, for examples
(a seeded random walk — not real market data).
```{r}
head(sample_ohlcv)
```
## Batch: a whole series at once
Scalar indicators run over a vector with `batch()`. Warmup positions are `NA`.
```{r}
sma <- Sma(20)
sma_values <- batch(sma, sample_ohlcv$close)
tail(sma_values)
```
## Streaming: one observation at a time
The same indicator fed tick-by-tick with `update()` returns the identical
values — an equivalence the test suite enforces for every indicator.
```{r}
sma_stream <- Sma(20)
streamed <- vapply(sample_ohlcv$close, function(p) update(sma_stream, p), numeric(1))
same_warmup <- all(is.na(streamed) == is.na(sma_values))
same_values <- all(streamed == sma_values, na.rm = TRUE)
c(batch_equals_streaming = same_warmup && same_values)
```
A typical streaming loop reacts to each value as it arrives:
```{r}
rsi <- Rsi(14)
overbought_days <- 0L
for (price in sample_ohlcv$close) {
v <- update(rsi, price) # NA during warmup
if (!is.na(v) && v > 70) overbought_days <- overbought_days + 1L
}
overbought_days
```
## Multi-output indicators
Indicators with several outputs return a *named* numeric vector (`NA` while
warming up). MACD is the classic example — line, signal, and histogram:
```{r}
macd <- MacdIndicator(12, 26, 9)
last_macd <- c(macd = NA, signal = NA, histogram = NA)
for (price in sample_ohlcv$close) last_macd <- update(macd, price)
last_macd
```
## Candle indicators
Indicators that need the whole bar take the OHLCV fields plus a timestamp:
```{r}
atr <- Atr(14)
last_atr <- NA_real_
for (i in seq_len(nrow(sample_ohlcv))) {
last_atr <- update(
atr,
sample_ohlcv$open[i], sample_ohlcv$high[i], sample_ohlcv$low[i],
sample_ohlcv$close[i], sample_ohlcv$volume[i], i - 1
)
}
last_atr
```
## Resetting state
`reset()` returns an indicator to its warmup state so the same object can be
reused on a fresh series:
```{r}
reset(sma)
update(sma, 100) # NaN — warming up again
```
## Next steps
- Full indicator catalogue, guides, and per-indicator reference:
<https://docs.wickra.org>.
- Every constructor (`Sma()`, `Rsi()`, `MacdIndicator()`, `Atr()`, …) is listed
in this package's help index.
+2 -2
View File
@@ -6,7 +6,7 @@
<groupId>org.wickra.examples</groupId>
<artifactId>wickra-examples</artifactId>
<version>0.8.6</version>
<version>0.8.7</version>
<packaging>jar</packaging>
<name>Wickra Java examples</name>
@@ -21,7 +21,7 @@
<dependency>
<groupId>org.wickra</groupId>
<artifactId>wickra</artifactId>
<version>0.8.6</version>
<version>0.8.7</version>
</dependency>
<!-- Only the network examples (fetch_btcusdt) parse JSON. -->
<dependency>
+7 -7
View File
@@ -17,7 +17,7 @@
},
"../../bindings/node": {
"name": "wickra",
"version": "0.8.6",
"version": "0.8.7",
"license": "MIT OR Apache-2.0",
"devDependencies": {
"@napi-rs/cli": "^2.18.0"
@@ -26,12 +26,12 @@
"node": ">= 18"
},
"optionalDependencies": {
"wickra-darwin-arm64": "0.8.6",
"wickra-darwin-x64": "0.8.6",
"wickra-linux-arm64-gnu": "0.8.6",
"wickra-linux-x64-gnu": "0.8.6",
"wickra-win32-arm64-msvc": "0.8.6",
"wickra-win32-x64-msvc": "0.8.6"
"wickra-darwin-arm64": "0.8.7",
"wickra-darwin-x64": "0.8.7",
"wickra-linux-arm64-gnu": "0.8.7",
"wickra-linux-x64-gnu": "0.8.7",
"wickra-win32-arm64-msvc": "0.8.7",
"wickra-win32-x64-msvc": "0.8.7"
}
},
"node_modules/wickra": {