GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - anselm67/Portfolio: Portfolio simulation tool, uses yfinance to re-run a portfolio strategy over the past.

BranchesTags
Open more actions menu

Latest commit

 

History

97 Commits
97 Commits

Folders and files

NameName
Last commit message
Last commit date
.vscode
.vscode
 
 
samples
samples
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
entry.py
entry.py
 
 
parser.py
parser.py
 
 
portfolio.py
portfolio.py
 
 
psym.py
psym.py
 
 
rebalance.py
rebalance.py
 
 
requirements.txt
requirements.txt
 
 
rules.py
rules.py
 
 
stock.py
stock.py
 
 
test_parser.py
test_parser.py
 
 
test_portfolio.py
test_portfolio.py
 
 
test_rules.py
test_rules.py
 
 
test_yfcache.py
test_yfcache.py
 
 
utils.py
utils.py
 
 
yfcache.py
yfcache.py
 
 

Repository files navigation

Portfolio simulation tool.

This tool takes as input two things:

  • A portfolio as in a stock allocation and soem cash amount, described in a json file,
  • A "program" or instructions on how to handle the portfolio, it then simulates the action of the instructions on the portoflio through a given date range and outputs a yearly percentage gain.

As an example, consider the following program in sample/retires.rules

sample .rules file
\# Enable dividends tracking monthly.
dividends
        
\# Every month, deposit $100
2000-01-01 [BMS] deposit $100

balance VTI: 100%

This simulates a portfolio, with dividend tracking, in which $100 is deposited every month and stock allocation consists in 100% VTI - basically buying as much VTI as posseble through time. To simulate this we run:

# ./psym.py --from 2000-01-01 -p '*empty*' samples/retire.rules --plot
Empty Portfolio $213,654.23
        Cash: $128.90/0.06%
        VTI     $213,525.33/742/99.94%
Annual returns: 35.81%

You can manage the cachefrom psym.py, check the help with # ./psym.py --help

Here is a list of files in this directory, and their purpose:

  • psym.py Is the portfolio simulator
  • parser.py Parser for the portfolio simulator .rules file.
  • rules.py Implements the rules supported by the portfolio simulator, this is the place to go to add new rules constructs.
  • yfcache.py A very rudmentary yfinance cache, that just gets the job done.
  • test_*.py Various unit tests.
  • samples/ Has various sample portfolio and rule files.

The following files are historical and no longer used.

  • entry.py Superseeded by psym.py, simulates market entry strategies.
  • rebalance.py Superseeded by psym.py, simulates rebalancing strategies.
  • stock.py Hands on yfinance and pyplot example.

About

Portfolio simulation tool, uses yfinance to re-run a portfolio strategy over the past.

Topics

financeportfolio-simulationpythonyfinance

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.