Skip to content

PortfolioTesteR

Test Investment Strategies with English-Like Code

v0.1.4 · Nov 1, 2025 · MIT + file LICENSE

Description

Design, backtest, and analyze portfolio strategies using simple, English-like function chains. Includes technical indicators, flexible stock selection, portfolio construction methods (equal weighting, signal weighting, inverse volatility, hierarchical risk parity), and a compact backtesting engine for portfolio returns, drawdowns, and summary metrics.

Downloads

212

Last 30 days

15573rd

212

Last 90 days

212

Last year

CRAN Check Status

3 ERROR
11 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-macos-arm64 OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 ERROR
r-oldrel-macos-x86_64 ERROR
r-oldrel-windows-x86_64 ERROR
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK
Check details (17 non-OK)
OK r-devel-linux-x86_64-debian-clang

*


            
OK r-devel-linux-x86_64-debian-gcc

*


            
OK r-devel-linux-x86_64-fedora-clang

*


            
OK r-devel-linux-x86_64-fedora-gcc

*


            
OK r-devel-macos-arm64

*


            
OK r-devel-windows-x86_64

*


            
ERROR r-oldrel-macos-arm64

re-building of vignette outputs

Error(s) in re-building vignettes:
--- re-building ‘Getting_Started_Advanced.Rmd’ using rmarkdown

Quitting from Getting_Started_Advanced.Rmd:84-108 [baseline_pooled]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `.roll_align_common()`:
! No common dates across panels.
---
Backtrace:
    ▆
 1. └─PortfolioTesteR::ml_backtest(...)
 2.   └─PortfolioTesteR::roll_fit_predict(...)
 3.     └─PortfolioTesteR:::.roll_align_common(c(features_list, list(label)))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: processing vignette 'Getting_Started_Advanced.Rmd' failed with diagnostics:
No common dates across panels.
--- failed re-building ‘Getting_Started_Advanced.Rmd’

--- re-building ‘getting-started.Rmd’ using rmarkdown
2026-03-10 03:16:08.519 R[31666:192626] XType: Using static font registry.
--- finished re-building ‘getting-started.Rmd’

--- re-building ‘optimization-walkforward.Rmd’ using rmarkdown
2026-03-10 03:16:11.938 R[31784:192938] XType: Using static font registry.
--- finished re-building ‘optimization-walkforward.Rmd’

SUMMARY: processing the following file failed:
  ‘Getting_Started_Advanced.Rmd’

Error: Vignette re-building failed.
Execution halted
ERROR r-oldrel-macos-arm64

tests

  Running ‘testthat.R’ [1s/1s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > if (requireNamespace("testthat", quietly = TRUE)) {
  +   library(testthat)
  +   library(PortfolioTesteR)
  +   test_check("PortfolioTesteR")
  + } else {
  +   message("Skipping tests: 'testthat' not installed")
  + }
  Saving _problems/test-ml-helpers-101.R
  [ FAIL 1 | WARN 0 | SKIP 3 | PASS 55 ]
  
  ══ Skipped tests (3) ═══════════════════════════════════════════════════════════
  • On CRAN (3): 'test-optimization.R:2:3', 'test-optimization.R:46:3',
    'test-walk-forward.R:2:3'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-ml-helpers.R:92:3'): backtest invariants hold on active dates (smoke, linear) ──
  Error in `.roll_align_common(c(features_list, list(label)))`: No common dates across panels.
  Backtrace:
      ▆
   1. └─PortfolioTesteR::ml_backtest(...) at test-ml-helpers.R:92:3
   2.   └─PortfolioTesteR::roll_fit_predict(...)
   3.     └─PortfolioTesteR:::.roll_align_common(c(features_list, list(label)))
  
  [ FAIL 1 | WARN 0 | SKIP 3 | PASS 55 ]
  Error:
  ! Test failures.
  Execution halted
ERROR r-oldrel-macos-x86_64

re-building of vignette outputs

Error(s) in re-building vignettes:
--- re-building ‘Getting_Started_Advanced.Rmd’ using rmarkdown

Quitting from Getting_Started_Advanced.Rmd:84-108 [baseline_pooled]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `.roll_align_common()`:
! No common dates across panels.
---
Backtrace:
    ▆
 1. └─PortfolioTesteR::ml_backtest(...)
 2.   └─PortfolioTesteR::roll_fit_predict(...)
 3.     └─PortfolioTesteR:::.roll_align_common(c(features_list, list(label)))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: processing vignette 'Getting_Started_Advanced.Rmd' failed with diagnostics:
No common dates across panels.
--- failed re-building ‘Getting_Started_Advanced.Rmd’

--- re-building ‘getting-started.Rmd’ using rmarkdown
--- finished re-building ‘getting-started.Rmd’

--- re-building ‘optimization-walkforward.Rmd’ using rmarkdown
--- finished re-building ‘optimization-walkforward.Rmd’

SUMMARY: processing the following file failed:
  ‘Getting_Started_Advanced.Rmd’

Error: Vignette re-building failed.
Execution halted
ERROR r-oldrel-macos-x86_64

tests

  Running ‘testthat.R’ [4s/9s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > if (requireNamespace("testthat", quietly = TRUE)) {
  +   library(testthat)
  +   library(PortfolioTesteR)
  +   test_check("PortfolioTesteR")
  + } else {
  +   message("Skipping tests: 'testthat' not installed")
  + }
  Saving _problems/test-ml-helpers-101.R
  [ FAIL 1 | WARN 0 | SKIP 3 | PASS 55 ]
  
  ══ Skipped tests (3) ═══════════════════════════════════════════════════════════
  • On CRAN (3): 'test-optimization.R:2:3', 'test-optimization.R:46:3',
    'test-walk-forward.R:2:3'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-ml-helpers.R:92:3'): backtest invariants hold on active dates (smoke, linear) ──
  Error in `.roll_align_common(c(features_list, list(label)))`: No common dates across panels.
  Backtrace:
      ▆
   1. └─PortfolioTesteR::ml_backtest(...) at test-ml-helpers.R:92:3
   2.   └─PortfolioTesteR::roll_fit_predict(...)
   3.     └─PortfolioTesteR:::.roll_align_common(c(features_list, list(label)))
  
  [ FAIL 1 | WARN 0 | SKIP 3 | PASS 55 ]
  Error:
  ! Test failures.
  Execution halted
ERROR r-oldrel-windows-x86_64

re-building of vignette outputs

Error(s) in re-building vignettes:
--- re-building 'Getting_Started_Advanced.Rmd' using rmarkdown

Quitting from Getting_Started_Advanced.Rmd:84-108 [baseline_pooled]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<error/rlang_error>
Error in `.roll_align_common()`:
! No common dates across panels.
---
Backtrace:
    ▆
 1. └─PortfolioTesteR::ml_backtest(...)
 2.   └─PortfolioTesteR::roll_fit_predict(...)
 3.     └─PortfolioTesteR:::.roll_align_common(c(features_list, list(label)))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Error: processing vignette 'Getting_Started_Advanced.Rmd' failed with diagnostics:
No common dates across panels.
--- failed re-building 'Getting_Started_Advanced.Rmd'

--- re-building 'getting-started.Rmd' using rmarkdown
--- finished re-building 'getting-started.Rmd'

--- re-building 'optimization-walkforward.Rmd' using rmarkdown
--- finished re-building 'optimization-walkforward.Rmd'

SUMMARY: processing the following file failed:
  'Getting_Started_Advanced.Rmd'

Error: Vignette re-building failed.
Execution halted
ERROR r-oldrel-windows-x86_64

tests

  Running 'testthat.R' [8s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > if (requireNamespace("testthat", quietly = TRUE)) {
  +   library(testthat)
  +   library(PortfolioTesteR)
  +   test_check("PortfolioTesteR")
  + } else {
  +   message("Skipping tests: 'testthat' not installed")
  + }
  Saving _problems/test-ml-helpers-101.R
  [ FAIL 1 | WARN 0 | SKIP 3 | PASS 55 ]
  
  ══ Skipped tests (3) ═══════════════════════════════════════════════════════════
  • On CRAN (3): 'test-optimization.R:2:3', 'test-optimization.R:46:3',
    'test-walk-forward.R:2:3'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-ml-helpers.R:92:3'): backtest invariants hold on active dates (smoke, linear) ──
  Error in `.roll_align_common(c(features_list, list(label)))`: No common dates across panels.
  Backtrace:
      ▆
   1. └─PortfolioTesteR::ml_backtest(...) at test-ml-helpers.R:92:3
   2.   └─PortfolioTesteR::roll_fit_predict(...)
   3.     └─PortfolioTesteR:::.roll_align_common(c(features_list, list(label)))
  
  [ FAIL 1 | WARN 0 | SKIP 3 | PASS 55 ]
  Error:
  ! Test failures.
  Execution halted
OK r-patched-linux-x86_64

*


            
OK r-release-linux-x86_64

*


            
OK r-release-macos-arm64

*


            
OK r-release-macos-x86_64

*


            
OK r-release-windows-x86_64

*


            

Check History

ERROR 11 OK · 0 NOTE · 0 WARNING · 3 ERROR · 0 FAILURE Mar 9, 2026
ERROR r-oldrel-macos-arm64

tests

  Running ‘testthat.R’ [1s/1s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > if (requireNamespace("testthat", quietly = TRUE)) {
  +   library(testthat)
  +   library(PortfolioTesteR)
  +   test_check("PortfolioTesteR")
  + } else {
  +   message("Skipping tests: 'testthat' not installed")
  + }
  Saving _problems/test-ml-helpers-101.R
  [ FAIL 1 | WARN 0 | SKIP 3 | PASS 55 ]
  
  ══ Skipped tests (3) ═══════════════════════════════════════════════════════════
  • On CRAN 
ERROR r-oldrel-macos-x86_64

tests

  Running ‘testthat.R’ [4s/9s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > if (requireNamespace("testthat", quietly = TRUE)) {
  +   library(testthat)
  +   library(PortfolioTesteR)
  +   test_check("PortfolioTesteR")
  + } else {
  +   message("Skipping tests: 'testthat' not installed")
  + }
  Saving _problems/test-ml-helpers-101.R
  [ FAIL 1 | WARN 0 | SKIP 3 | PASS 55 ]
  
  ══ Skipped tests (3) ═══════════════════════════════════════════════════════════
  • On CRAN 
ERROR r-oldrel-windows-x86_64

tests

  Running 'testthat.R' [8s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > if (requireNamespace("testthat", quietly = TRUE)) {
  +   library(testthat)
  +   library(PortfolioTesteR)
  +   test_check("PortfolioTesteR")
  + } else {
  +   message("Skipping tests: 'testthat' not installed")
  + }
  Saving _problems/test-ml-helpers-101.R
  [ FAIL 1 | WARN 0 | SKIP 3 | PASS 55 ]
  
  ══ Skipped tests (3) ═══════════════════════════════════════════════════════════
  • On CRAN (3)

Dependency Network

Dependencies Reverse dependencies data.table TTR zoo PortfolioTesteR

Version History

new 0.1.4 Mar 9, 2026