matthiasstraka / php-invest

Self-hosted stock portfolio tracking software using PHP/Symfony. It tracks portfolios across multiple brokers and automatically updates daily stock data. It allows tracking trades of raw stock and EUSIPA derivatives/instruments.
GNU General Public License v3.0
18 stars 8 forks source link
derivatives finance investing money php portfolio self-hosted stock-data stock-market stock-prices stock-trading stocks symfony trading

PHP-Invest

Symfony

About

PHP-Invest is a self-hosted stock portfolio tracking software based on PHP/Symfony framework. It can track portfolios across multiple brokers and show them in a unified interface. Daily price data can be automatically downloaded from multiple online sources for charting.

Motivation

After many unsuccessful searches for existing self-hosted open source stock portfolio tracking applications, the idea for PHP-Invest was born. Commercial/Free portfolio tracking services often are limited in their functionality and it is not possible to extend them.

What it is

What it is not

Documentation

For usage documentation, see:

docs/index.md

Status

This project is under active development. New features will be added with a priority on function over design and tracking trades over analysis. However, tracking of trades has reached a certain stability which will allow entering trades for later analysis.

The following features are already supported and have reached a usable stability:

Missing features:

Installation

To install, first clone the git repository and execute the following commands:

By default, a sqlite database is created. In order to override this behavior, create a copy of .env as .env.local and modify your configuration. So far, only standard Symfony configurations are used. Please refer to the symfony/doctrine documentation for details.

In order to use the web-app, your webserver needs to publish the php-invest/public folder.

Docker

For a quick demo, you can build a docker image using

docker build -t phpinvest:latest .

and run a non-persistent demo system using

docker run -it --rm -p 8000:8000 phpinvest:latest

You will be greeted with a login page. In order to log in, you need to create a new user using the Administration -> New user menu item. Note that this docker image uses the built-in php webserver and is not suited for a production environment.

PHP Unit

In order to execute unit tests, you need to prepare your environment and test-database. Since we populate the database with test-data, it is important to always set up a new database after any update to have predictable auto-increment keys.

cd <directory where php-invest is cloned>
composer install
bin/console --env=test doctrine:database:drop --force # Only in case there is an old version
bin/console --env=test doctrine:database:create
bin/console --env=test doctrine:schema:create
bin/console --env=test doctrine:fixtures:load -n
bin/phpunit # Runs the actual PHP unit tests

Version updates

When updating the source code to a new version, the database schema might have changed. Usually, an upgrade can be performed without migration scripts using standard console commands. Currently, migration scripts are not maintained as there is no official Release yet. Please open an Issue if there are problems when migrating your data. As always, make sure to backup the database before any upgrade or migration operation.

The upgrade procedure looks as follows:

cd <directory where php-invest is cloned>
git pull
composer install --no-dev
bin/console doctrine:schema:update --dump-sql # Optional step to find out what will change (no execution yet)
bin/console doctrine:schema:update --force # Perform the upgrade

Maintainers and Contributions

PHP-Invest is maintained by Matthias Straka. Contributions and bugfixes are welcome via pull-requests.