Metadata-Version: 2.1
Name: folioflex
Version: 0.1.3
Summary: A collection of portfolio tracking capabilities
Author-email: John Koestner <johnkoestner@outlook.com>
License: The MIT License (MIT)
        
        Copyright (c) 2023 John Koestner
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: homepage, https://github.com/jkoestner/folioflex
Project-URL: documentation, https://jkoestner.github.io/folioflex/
Project-URL: repository, https://github.com/jkoestner/folioflex
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: ipywidgets>=8.1.0
Requires-Dist: fredapi>=0.4.3
Requires-Dist: jupyter-dash>=0.4.2
Requires-Dist: jupyterlab>=4.0.5
Requires-Dist: kaleido<0.2.0,>=0.1.0
Requires-Dist: numpy>=1.22.3
Requires-Dist: openpyxl>=3.0.7
Requires-Dist: pandas>=0.25.0
Requires-Dist: pandas-market-calendars>=4.1.4
Requires-Dist: pyxirr>=0.7.2
Requires-Dist: yfinance>=0.2.32
Provides-Extra: dev
Requires-Dist: black>=23.7.0; extra == "dev"
Requires-Dist: pytest>=7.4.0; extra == "dev"
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
Requires-Dist: ruff>=0.1.5; extra == "dev"
Requires-Dist: sphinx<7.2,>=6.0; extra == "dev"
Requires-Dist: sphinx_rtd_theme>=1.2.2; extra == "dev"
Provides-Extra: gpt
Requires-Dist: beautifulsoup4>=4.12.2; extra == "gpt"
Requires-Dist: g4f>=0.1.9.2; extra == "gpt"
Requires-Dist: hugchat>=0.3.8; extra == "gpt"
Requires-Dist: openai>=1.3.7; extra == "gpt"
Requires-Dist: selenium>4.15.2; extra == "gpt"
Requires-Dist: undetected_chromedriver>=3.5.4; extra == "gpt"
Requires-Dist: webdriver-manager>=4.0.1; extra == "gpt"
Provides-Extra: web
Requires-Dist: dash>=1.0.2; extra == "web"
Requires-Dist: dash-core-components>=1.0.0; extra == "web"
Requires-Dist: dash-html-components>=1.0.0; extra == "web"
Requires-Dist: dash-renderer>=1.0.0; extra == "web"
Requires-Dist: dash-table>=4.0.2; extra == "web"
Requires-Dist: Flask>=1.1.1; extra == "web"
Requires-Dist: Flask-Compress>=1.4.0; extra == "web"
Requires-Dist: gunicorn>=19.9.0; extra == "web"
Provides-Extra: worker
Requires-Dist: celery>=5.3.1; extra == "worker"
Requires-Dist: flower>=2.0.0; extra == "worker"
Requires-Dist: redis>=3.3.8; extra == "worker"

<div align="center">
  <img src="https://user-images.githubusercontent.com/50647092/260895211-7e9a8e6e-9f85-48ed-bb61-49ff2ff805b6.png"><br>
</div>

# 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.

![workflow badge](https://github.com/jkoestner/folioflex/actions/workflows/test-and-deploy.yml/badge.svg)
[![license badge](https://img.shields.io/github/license/jkoestner/folioflex)](https://github.com/jkoestner/folioflex/blob/main/LICENSE.md)
[![codecov](https://codecov.io/gh/jkoestner/folioflex/branch/main/graph/badge.svg?token=K4RS9LX4UG)](https://codecov.io/gh/jkoestner/folioflex)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Static Badge](https://img.shields.io/badge/docs-available-green?labelColor=green&color=gray&link=https%3A%2F%2Fjkoestner.github.io%2Ffolioflex%2F)](https://jkoestner.github.io/folioflex/)


## Table of Contents
- [Overview](#overview)
- [Installation](#installation)
  - [Install packages](#install-packages)
- [Usage](#usage)
  - [CLI](#cli)
  - [Python](#python)
  - [Web Dashboard](#web-dashboard)
- [Other Tools](#other-tools)

## 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:**

- **Dashboard Helper**: Get a quick overview of your portfolio with our dashboard. 🖥️
- **Market Screener**: Filter and find trending stocks. 🔍
- **Portfolio Management**: Organize and track, your investments. 💼
- **Config Helper**: Customize your experience with easy configurations. ⚙️

**📚 Documentation:**

- [Installation Guide](https://jkoestner.github.io/folioflex/installation.html): Get started with FolioFlex in no time! 🛠️
- [Usage Guide](https://jkoestner.github.io/folioflex/usage.html): Learn how to make the most out of FolioFlex. 🤓

**🎥 See It In Action:**

- **FolioFlex Demo**: Visit a dashboard (https://invest.koestner.fun/) of FolioFlex and witness the magic! 🌟

**🔬 Jupyter Notebook:**

- [Portfolio Example](https://nbviewer.jupyter.org/github/jkoestner/folioflex/blob/main/notebook/portfolio_example.ipynb): 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:
- https://openbb.co/

## Installation

### Local Install
To install, this repository can be installed by running the following command in 
the environment of choice.

```
pip install folioflex
```

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]
```
### 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`. 

```bash
version: "3.8"
services:
  folioflex-web:
    image: dmbymdt/folioflex:latest
    container_name: folioflex-web
    command: gunicorn -b 0.0.0.0:8001 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.

<details>
  <summary>ENVIRONMENT VARIABLES</summary>

  <table>
      <tr>
          <th>Variable</th>
          <th>Description</th>
          <th>Default</th>
      </tr>
      <tr>
          <td>FFX_CONFIG_PATH</td>
          <td>The path to the configuration folder</td>
          <td>folioflex/folioflex/configs</td>
      </tr>
  </table>
</details>

## 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.

```commandline
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.

```python
from folioflex.portfolio.portfolio import Portfolio
config_path = "portfolio_demo.ini"
pf = Portfolio(
    config_path=config_path, 
    portfolio='company_a'
)
pf.get_performance()
```

### Web Dashboard

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
python app.py
```

## 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
```python
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. This is also documented in the `.coveragerc` file.
```
pytest --cov=folioflex --cov-report=html
```

<hr>

[Go to Top](#table-of-contents)
