This is a PHP implementation of the Modern Portfolio Theory. I made this as part of a Seminar essay and presentation. This Project is based on Laravel 5.8 and PHP 7.1 and the medium articles about the MPT by Bernard Brenyah. Really worth a read!
- Markowitz’s Efficient Frontier in Python [Part 1/2]
- Efficient Frontier & Portfolio Optimization with Python [Part 2/2]
All the commands are suited for use under Linux, specifically tested under Ubuntu 19.04.
In root directory:
composer install
The .env.example
to .env
and app key generation should be done automatically.
Edit the .env
File to your needs. Dont forget to input an APIKEY!
You can get your free APIKEY at Alpha Vantage
Start the debugserver with the command php artisan serve
in the root directory of the Project.
In a browser, open:
127.0.0.1:8000/?stocks=XXX,XXX,XXX,XXX
where XXX is a valid stock symbol. you can use up to 5 stocks. Optionally you can use timeseries to change the requested data between monthly adjusted (monthly) and daily adjusted (daily) stock prices. This defaults to daily.
- I have to check the monthly timeseries again, they are apparently broken
- A good validator would be great for the data to be in the same timespan or else the whole program will break down
- Lots of stuff I probably forgot and will add here when I remember it.
Set up grumPHP to sniff commits.
php ./vendor/bin/grumphp git:init --config=./grumphp.yml
To autofix possible Codestyle errors, use:
composer autofix-phpcs