Skip to content

chrisdurheim/investsim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InvestSim

A simple tool to simulate stock market returns using S&P 500 data from January 1871 through today

Usage

  1. Load libraries:
$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib")
$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "data")
require 'investsim'
  1. Parse data from Robert Shiller's S&P 500 spreadsheet:
data_table = ShillerParser.new.data_table
  1. Create an investment account; optionally load with an initial investment:
account = InvestmentAccount.new(data_table, {amount: 100})
  1. Manipulate the account through investment, withdrawal, or no action through each month
account.invest_and_advance 10
account.withdraw_and_advance 10
account.advance
account.advance_to account.last_date
  1. Check account balance at any point
puts account.balance

Current Scripts

scripts/trinity_extended analyzes stock market portfolio success probabilities for different drawdown terms and withdrawal rates. The script also provides for optional adjustable expense ratio and toggling between monthly and annual withdrawals

Contributing

This tool was scraped together by @chrisdurheim and could use some TLC. I may do some updates on my own, but if you'd like to get involved, let me know.

About

Investment simulator using S&P 500 data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages