Test Investment Strategies with English-Like Code


[Up] [Top]

Documentation for package ‘PortfolioTesteR’ version 0.1.2

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_drawdowns Analyze Drawdown Characteristics
analyze_performance Analyze Backtest Performance with Daily Monitoring
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_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 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 the number of positions in a selection matrix
list_examples List available example scripts
load_mixed_symbols Load Mixed Symbols Including VIX

-- M --

make_labels Make future-return labels aligned to decision date
manual_adapter Adapter for User-Provided Data
membership_stability Membership stability across dates
metric_sharpe Calculate Sharpe Ratio with Frequency Detection
ml_backtest One-call backtest wrapper (tabular features)
ml_backtest_seq One-call backtest wrapper (sequence features)

-- P --

panel_lag Lag all symbol columns by k
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
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 / sd / 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 per date with group caps
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 or synthesize a group map
validate_no_leakage Quick leakage guard: date alignment & NA expectations

-- 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