Investment Portfolio App

Instructions for running the project

For this app, you need an .xlsx file, which needs to have two sheets:

  1. The name needs to be "weights" and with this format:
Fecha activos portfolio1_name portfolio2_name
15-02-22 asset1_name weight_value_ weight_value
15-02-22 asset2_name weight_value weight_value
15-02-22 asset3_name weight_value weight_value
  1. The name needs to be "Precios" and with this format:
Fecha asset1_name asset2_name asset3_name
15-02-22 asset1_price asset2_price asset3_price
16-02-22 asset1_price asset2_price asset3_price
17-02-22 asset1_price asset2_price asset3_price

After having this Excel file, you need to leave it at the same directory as the project with the name of datos.xlsx.

For installing all the required libraries, you can enter to a shell and go to the project directory and run this command, which will install every package needed for this project:

pip install -r requirements.txt

For populating the database of the project with the Excel file data, you need to run this command:

python manage.py populate

If you want to erase all the data stored, you need to put this command:

python manage.py flush

After populating the data, you can run the program with the following command:

python manage.py runserver

Once the project is running, you can enter the URL provided in the shell, and watch the behavior of a specific portfolio for a given date-range.

Instructions for using the API

The API for this project is pretty simple, you can retrieve the Assets, check the portfolio values through a date range and the asset weights on a specific portfolio through a date range, the following commands will help you achieve this:

For getting all the Assets

http://127.0.0.1:8000/api/assets

For getting a specific Asset

http://127.0.0.1:8000/api/assets/<name_of_the_asset>

For getting the asset weights of all the portfolios during a date range

http://127.0.0.1:8000/api/asset_weights/?fecha_inicio=<start_date>&fecha_fin=<end_date>

For getting all the portfolio values during a date range

http://127.0.0.1:8000/api/portfolio_values/?fecha_inicio=<start_date>&fecha_fin=<end_date>