Simple investment portfolio tool that will track stock and provide returns and other metrics. It also contains a web dashboard to view the data.
🚀 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:
To install, this repository can be installed by running the following command in the environment of choice.
pip install folioflex
Other options can be installed if using more functionality
pip install folioflex
pip install folioflex[dev] # if needing to develop or lint
Or could be done using GitHub.
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.
pip install -e .
pip install -e .[dev]
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 |
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 {}
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()
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
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
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
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")
To see the test coverage the following command is run in the root directory.
pytest --cov=folioflex --cov-report=html