Portfolio
Simple investment portfolio tool that will track stock and provide returns and other metrics. It also contains a web dashboard to view the data.
Table of Contents
Overview
🚀 Welcome to FolioFlex! 🚀
📖 Description:
- FolioFlex is your go-to toolkit for portfolio management and market analysis! Dive into the world of stocks, bonds, and more with our user-friendly tools. 📈📊
🔧 Features:
- Market Screener: Filter and find trending stocks. 🔍
- Portfolio Management: Organize and track, your investments. 💼
- Budget Tool: Create and monitor a budget. 💰
📚 Documentation:
- Installation Guide: Get started with FolioFlex in no time! 🛠️
🎥 See It In Action:
- FolioFlex Demo: Visit a dashboard (https://invest.koestner.fun) of FolioFlex and witness the magic! 🌟
🔬 Jupyter Notebook:
- Portfolio Example: Explore a sample portfolio and see FolioFlex in action! 📔
🤝 Contribute:
- Love FolioFlex? Feel free to contribute and make it even better! Every bit of help is appreciated. ❤️
Data sources:
- https://pypi.org/project/yahoo-finance/
- https://fred.stlouisfed.org/docs/api/fred/ (need an API key)
- https://finviz.com/api
Inspiration:
Installation
Local Install
To install, this repository can be installed by running the following command in the environment of choice.
uv pip install folioflex
Other options can be installed if using more functionality
uv pip install folioflex
uv pip install folioflex[dev] # if needing to develop or lint
Or could be done using GitHub.
uv pip install git+https://github.com/jkoestner/folioflex.git
If wanting to do more and develop on the code, the following command can be run to install the packages in the requirements.txt file.
uv sync
uv sync --extra dev
Docker Install
The package can also be run in docker which provides a containerized environment, and can host the web dashboard.
To run the web dashboard there are a few prerequisites.
- Docker
- Redis
- Worker
- Flower (optional)
The following can be used in a docker-compose.yml.
version: "3.8"
services:
folioflex-web:
image: dmbymdt/folioflex:latest
container_name: folioflex-web
command: gunicorn -b 0.0.0.0:8001 folioflex.dashboard.app:server
restart: unless-stopped
environment:
FFX_CONFIG_PATH: /code/folioflex/configs
ports:
- '8001:8001'
volumes:
- $DOCKERDIR/folioflex-web/configs:/code/folioflex/configs
The docker container has a configuration file that can read in environment variables or could specify within file.
There is also an environment variable that can specify the path to the configuration folder.
ENVIRONMENT VARIABLES
| Variable | Description | Default |
|---|---|---|
| FFX_CONFIG_PATH | The path to the configuration folder | folioflex/folioflex/configs |
Usage
CLI
CLI can be used for easier commands of python scripts for both portfolio or manager. An example of a CLI command is shown below.
ffx email --email_list "['yourname@outlook.com']" --heatmap_market {}
Python
When using the portfolio class, the following code can be used to get the returns of a portfolio.
from folioflex.portfolio.portfolio import Portfolio
config_path = "portfolio_demo.yml"
pf = Portfolio(config_path=config_path, portfolio="company_a")
pf.get_performance()
Web Dashboard - Invest
A demo of the app can be seen at https://invest.koestner.fun/.
It also can be run locally by going to the project root folder and running below. There are a number of environment variables listed in constants to be able to run locally.
python -m folioflex.dashboard.app
Plaid Dashboard
A separate dashboard can be run for transaction aggregation.
The transactions are sourced from Plaid. To be able to use the dashboard there needs to be one other service:
- folioflex db: this is holding the data
The Plaid Pattern repository was used as a reference for the docker-compose setup.
folioflex-db:
container_name: folioflex-db
image: postgres:latest
restart: unless-stopped
volumes:
- $DOCKERDIR/folioflex/database/init:/docker-entrypoint-initdb.d
- $DOCKERDIR/folioflex/data:/var/lib/postgresql/data
ports:
- $PLAID_DB_PORT:5432
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: $PLAID_POSTGRES
Other Tools
Jupyter Lab Usage
To have conda environments work with Jupyter Notebooks a kernel needs to be defined. This can be done defining a kernel, shown below when in the conda environment.
python -m ipykernel install --user --name=folioflex
Logging
If wanting to get more detail in output of messages the logging can increased
from folioflex.utils import config_helper
config_helper.set_log_level("DEBUG")
Coverage
To see the test coverage the following command is run in the root directory.
pytest --cov=folioflex --cov-report=html
Metadata
Release files for folioflex 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| folioflex-1.5.1.tar.gz | 1.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| folioflex-1.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.2 MB
Release files / folioflex-1.5.1.tar.gz
| Download URL | folioflex-1.5.1.tar.gz |
|---|---|
| Size | 1.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
68c00bdf68e05c5b6cb0fc6a5e8da29607ffb628813cde003df3139afd0868a9
|
|
BLAKE2b-256 checksum How to use checksums |
2e58c64e3b5c3649c98ef61ec58f44416d20027fa5dad2004a56ca055103508b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / folioflex-1.5.1-py3-none-any.whl
| Download URL | folioflex-1.5.1-py3-none-any.whl |
|---|---|
| Size | 1.1 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
67b7afda048bb5c334d5079c688eb25712e7b120358f79878fdb7de90679caa5
|
|
BLAKE2b-256 checksum How to use checksums |
7f09ab16ae27129c996c92ae3188279640c8d005f53ea55b3525f887d1c74150
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|