Test Investment Strategies with English-Like Code


[Up] [Top]

Documentation for package ‘PortfolioTesteR’ version 0.1.3

Help Pages

A B C D E F G I J L M P R S T U V W Y

-- A --

align_to_timeframe Align Data to Strategy Timeframe
analyze_by_period Period-level summary statistics
analyze_drawdowns Analyze Drawdown Characteristics
analyze_performance Analyze Backtest Performance with Daily Monitoring
analyze_vs_benchmark Benchmark-relative performance statistics
apply_regime Apply Market Regime Filter
as_selection Convert Conditions to Selection Format

-- B --

backtest_metrics Calculate Comprehensive Backtest Metrics
bucket_returns Bucketed label analysis by score rank

-- C --

calculate_daily_values Daily equity curve from positions and daily prices
calculate_drawdown_series Calculate Drawdown Time Series
calc_cci Calculate Commodity Channel Index (CCI)
calc_distance Calculate Distance from Reference
calc_market_breadth Calculate Market Breadth Percentage
calc_momentum Calculate Price Momentum
calc_moving_average Calculate Moving Average
calc_relative_strength_rank Calculate Cross-Sectional Ranking of Indicators
calc_rolling_correlation Rolling correlation of each symbol to a benchmark
calc_rolling_volatility Calculate Rolling Volatility
calc_rsi Calculate Relative Strength Index (RSI)
calc_sector_breadth Calculate Market Breadth by Sector
calc_sector_relative_indicators Calculate Indicators Relative to Sector Average
calc_stochastic_d Calculate Stochastic D Indicator
calc_stochrsi Stochastic RSI (StochRSI) for multiple price series
cap_exposure Apply post-weight exposure caps
cap_turnover Cap turnover sequentially across dates
carry_forward_weights Carry-forward weights between rebalances (validation helper)
combine_filters Combine Multiple Filter Conditions
combine_scores Combine multiple score panels (mean / weighted / rank-average / trimmed)
combine_weights Combine Multiple Weighting Schemes
convert_to_nweeks Convert Data to N-Week Frequency
coverage_by_date Count finite entries per date
create_regime_buckets Convert Continuous Indicator to Discrete Regimes
csv_adapter Load Price Data from CSV File
cv_tune_seq Purged/embargoed K-fold CV for sequence models (inside IS window)

-- D --

demo_sector_map Demo sector (group) map for examples/tests
download_sp500_sectors Download S&P 500 Sector Mappings from Wikipedia

-- E --

ensure_dt_copy Ensure Data.Table Without Mutation
evaluate_scores Evaluate scores vs labels (IC and hit-rate)

-- F --

filter_above Filter Stocks Above Threshold
filter_below Filter Stocks Below Threshold
filter_between Filter Stocks Between Two Values
filter_by_percentile Filter by Percentile
filter_rank Select Top or Bottom N Stocks by Signal
filter_threshold Filter by Threshold Value
filter_top_n Select Top N Stocks by Signal Value
filter_top_n_where Select Top N from Qualified Stocks

-- G --

get_data_frequency Detect Data Frequency from Dates

-- I --

ic_series Information Coefficient time series
invert_signal Invert Signal Values for Preference Reversal

-- J --

join_panels Join multiple panels on intersecting dates (unique symbol names)

-- L --

limit_positions Limit per-date selections to top-K (legacy API)
list_examples List available example scripts
load_mixed_symbols Load Mixed Symbols Including VIX

-- M --

make_labels Make future-return labels aligned to the decision date
manual_adapter Adapter for User-Provided Data
membership_stability Membership stability across dates
metric_sharpe Calculate Sharpe Ratio with Frequency Detection
ml_add_interactions Add interaction panels to a feature list
ml_backtest One-call backtest wrapper (tabular features)
ml_backtest_seq One-call backtest wrapper (sequence features)
ml_ic_series_on_scores Rank-IC series computed on score (rebalance) dates
ml_make_ensemble NA-tolerant ensemble blender (row-wise)
ml_make_model Model factory for tabular cross-sectional learners
ml_make_seq_model Deterministic sequence model factory (GRU/LSTM/CNN1D with linear fallback)
ml_panel_op Panel-safe binary operation on aligned wide panels
ml_panel_reduce Reduce multiple panels with a binary operator
ml_plot_ic_roll Rolling rank-IC plot (rebalance dates; leakage-safe)
ml_prepare_features Prepare tabular features (weekly + aligned daily volatility)

-- P --

panel_lag Lag each symbol column by k steps
panel_returns_simple Panel simple returns from prices
perf_metrics Portfolio performance metrics
plot.backtest_result Plot Backtest Results
plot.param_grid_result Plot Parameter Grid Results (1D/2D/3D and Facets)
plot.performance_analysis Plot Performance Analysis Results
plot.wf_optimization_result Plot Walk-Forward Results
portfolio_returns Portfolio returns from weights and prices (CASH-aware)
print.backtest_result Print Backtest Results
print.param_grid_result Print a param_grid_result
print.performance_analysis Print Performance Analysis Results
print.wf_optimization_result Print a wf_optimization_result

-- R --

rank_within_sector Rank Indicators Within Each Sector
rebalance_calendar Rebalance calendar (rows with non-zero allocation)
roll_fit_predict Rolling fit/predict for tabular features (pooled / per-symbol / per-group)
roll_fit_predict_seq Rolling fit/predict for sequence models (flattened steps-by-p features)
roll_ic_stats Rolling IC mean, standard deviation, and ICIR
run_backtest Run Portfolio Backtest
run_example Run an Example Script
run_param_grid Run Parameter Grid Optimization (safe + ergonomic)
run_walk_forward Walk-Forward Optimization Analysis

-- S --

safe_divide Safe Division with NA and Zero Handling
sample_prices_daily Sample Daily Stock Prices
sample_prices_weekly Sample Weekly Stock Prices
sample_sp500_sectors S&P 500 Sector Mappings
select_top_k_scores Select top-K scores per date
select_top_k_scores_by_group Select top-k symbols per group by score
sql_adapter Load Price Data from SQL Database
sql_adapter_adjusted Load Adjusted Price Data from SQL Database
summary.backtest_result Summary method for backtest results
switch_weights Switch Between Weighting Schemes

-- T --

transform_scores Per-date score transform (z-score or rank)
tune_ml_backtest Quick grid tuning for tabular pipeline
turnover_by_date Turnover by date

-- U --

update_vix_in_db Update VIX data in database

-- V --

validate_data_format Validate Data Format for Library Functions
validate_group_map Validate a symbol-to-group mapping
validate_no_leakage Quick leakage guard: date alignment & NA expectations
vol_target Volatility targeting (row-wise) with optional down-only cap

-- W --

weight_by_hrp Hierarchical Risk Parity Weighting
weight_by_rank Rank-Based Portfolio Weighting
weight_by_regime Regime-Based Adaptive Weighting
weight_by_risk_parity Risk Parity Weighting Suite
weight_by_signal Signal-Based Portfolio Weighting
weight_by_volatility Volatility-Based Portfolio Weighting
weight_equally Equal Weight Portfolio Construction
weight_from_scores Map scores to portfolio weights
wf_report Generate Walk-Forward Report
wf_stitch Stitch Out-of-Sample Results (overlap-safe)
wf_sweep_tabular Walk-forward sweep of tabular configs (window-wise distribution of metrics)

-- Y --

yahoo_adapter Download Price Data from Yahoo Finance