{"id":32203499,"url":"https://github.com/albertopallotta/portfoliotester","last_synced_at":"2026-02-19T09:01:53.748Z","repository":{"id":313511253,"uuid":"1051666393","full_name":"AlbertoPallotta/PortfolioTesteR","owner":"AlbertoPallotta","description":"Backtest Quantitative Investment  Strategies Using Intuitive, Readable R Code","archived":false,"fork":false,"pushed_at":"2025-10-04T12:50:00.000Z","size":690,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-18T03:41:42.350Z","etag":null,"topics":["asset-allocation","backtesting","machine-learning","portfolio-construction","portfolio-optimization","quantitative-finance","time-series"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AlbertoPallotta.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-06T13:28:20.000Z","updated_at":"2025-10-03T15:01:01.000Z","dependencies_parsed_at":"2025-09-06T16:04:35.574Z","dependency_job_id":"d8a0dc16-76f9-4558-bb63-93ad8dd20417","html_url":"https://github.com/AlbertoPallotta/PortfolioTesteR","commit_stats":null,"previous_names":["alb3rtazzo/portfoliotester","albertopallotta/portfoliotester"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/AlbertoPallotta/PortfolioTesteR","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbertoPallotta%2FPortfolioTesteR","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbertoPallotta%2FPortfolioTesteR/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbertoPallotta%2FPortfolioTesteR/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbertoPallotta%2FPortfolioTesteR/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AlbertoPallotta","download_url":"https://codeload.github.com/AlbertoPallotta/PortfolioTesteR/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AlbertoPallotta%2FPortfolioTesteR/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280382975,"owners_count":26321423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-22T02:00:06.515Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asset-allocation","backtesting","machine-learning","portfolio-construction","portfolio-optimization","quantitative-finance","time-series"],"created_at":"2025-10-22T04:40:50.405Z","updated_at":"2025-10-22T04:40:55.287Z","avatar_url":"https://github.com/AlbertoPallotta.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"man/figures/logo.png\" width=\"120\" alt=\"PortfolioTesteR logo\"\u003e\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003ePortfolioTesteR\u003c/h1\u003e\n\n\n\n## Test Investment Strategies with English-Like Code\n\nPortfolioTesteR is an R package designed for students and individual investors to test investment strategies using clear, readable code. Unlike complex quantitative libraries, PortfolioTesteR uses intuitive function names that read like plain English, making strategy development accessible to everyone.\n\n## Why PortfolioTesteR?\n\n- **English-like syntax**: Functions like `filter_top_n()`, `weight_equally()`, and `run_backtest()` are self-explanatory\n- **Educational focus**: Perfect for learning quantitative investing without getting lost in code complexity  \n- **Comprehensive toolkit**: 70+ functions covering everything from technical indicators to risk analysis\n- **Fast backtesting**: Optimized for testing strategies on large stock universes\n- **Ready-to-use data**: Includes sample price data to start testing immediately\n- **Realistic results**: Handles warmup periods, transaction tracking, and proper return calculations\n\n## Installation\n\nInstall from GitHub:\n\n```r\n# install.packages(\"devtools\")\ndevtools::install_github(\"AlbertoPallotta/PortfolioTesteR\")\n```\n\n## Quick Start Example\n\n```r\nlibrary(PortfolioTesteR)\n\n# Load sample data\ndata(sample_prices_weekly)\n\n# Calculate 12-week momentum\nmomentum \u003c- calc_momentum(sample_prices_weekly, lookback = 12)\n\n# Select top 10 momentum stocks\ntop_momentum \u003c- filter_top_n(momentum, n = 10)\n\n# Weight selected stocks equally\nweights \u003c- weight_equally(top_momentum)\n\n# Run backtest\nresult \u003c- run_backtest(\n  prices = sample_prices_weekly,\n  weights = weights,\n  initial_capital = 100000,\n  name = \"Simple Momentum\"\n)\n\n# View results\nprint(result)\nsummary(result)\nplot(result)\n```\n\n## Main Functions\n\n### Data Loading\n- `sql_adapter()` - Load from SQLite databases\n- `csv_adapter()` - Load from CSV files\n- `load_mixed_symbols()` - Combine different data sources\n\n### Technical Indicators\n- `calc_momentum()` - Price momentum\n- `calc_rsi()` - Relative Strength Index\n- `calc_moving_average()` - Simple moving averages\n- `calc_stochastic_d()` - Stochastic oscillator\n- `calc_rolling_volatility()` - Rolling historical volatility (std / range / MAD / abs-return)\n- `calc_distance()` - Distance between price series\n\n### Stock Selection\n- `filter_top_n()` - Select top/bottom N stocks\n- `filter_above()` - Select above threshold\n- `filter_below()` - Select below threshold\n- `filter_between()` - Select within range\n- `combine_filters()` - Combine multiple conditions\n- `apply_regime()` - Filter based on market conditions\n\n### Portfolio Weighting\n- `weight_equally()` - Equal weight (1/N)\n- `weight_by_signal()` - Weight by signal strength\n- `weight_by_rank()` - Weight by ranking\n- `weight_by_volatility()` - Inverse volatility weighting\n- `weight_by_hrp()` - Hierarchical Risk Parity\n\n### Backtesting \u0026 Analysis\n- `run_backtest()` - Execute strategy backtest\n- `analyze_performance()` - Detailed performance metrics\n- `print()` - Display backtest results\n- `summary()` - Show detailed statistics\n- `plot()` - Visualize performance\n\n## Sample Data Included\n\nThe package includes three datasets for immediate testing:\n- `sample_prices_weekly` - Weekly prices for 20 stocks (2017-2020)\n- `sample_prices_daily` - Daily prices for detailed analysis\n- `sample_sp500_sectors` - Sector classifications\n\nLoad them with:\n```r\ndata(sample_prices_weekly)\ndata(sample_prices_daily)\ndata(sample_sp500_sectors)\n```\n\n## Documentation\n\nEvery function includes detailed documentation with examples:\n\n```r\n?run_backtest\n?calc_momentum\n?filter_top_n\n```\n\n## Disclaimer\n\nThis package is for educational and research purposes only. Past performance does not guarantee future results. Always conduct your own research before making investment decisions. The author is not responsible for any financial losses incurred from using this software.\n\n## Author\n\nAlberto Pallotta\n\n## License\n\nMIT License\n\n## Contributing\n\nWe welcome contributions! Please feel free to submit issues and pull requests on [GitHub](https://github.com/AlbertoPallotta/PortfolioTesteR).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertopallotta%2Fportfoliotester","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbertopallotta%2Fportfoliotester","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbertopallotta%2Fportfoliotester/lists"}