Path: blob/main/examples/gallery/portfolio_analyzer.ipynb
2011 views
The Portfolio Analysis App demonstrates the powerful Tabulator table that ships with Panel.
This app is heavily inspired by the Dash AG Grid App here. Having both enables you to compare pros and cons of Panel w. Tabulator versus Dash w. AG Grid.
Lets define our list of equities
Extract the data
We would be using caching (pn.cache
) to improve the performance of the app if we where loading data from a live data source like yfinance
.
Transform the data
Let us calculate the summary_data
to show in the Table.
Define the Summary Table
We define the configuration of the Tabulator below.
Here we define the summary_table
widget.
Now lets style the table using the Pandas styler api.
For later we also need a function to handle when a user edits a cell in the table
Define the plots
Bind the widgets and functions
We want the candlestick
plot to depend on the selection in summary_table
We want the portfolio_distribution
to be updated when ever a cell value changes in the table
Test the app
Layout the app in a nice template
We will use the FastGridTemplate
which provides a nice dashboard layout with Panels you can resize and move around interactively.
Lets add the plots and table to the template
The template does not display in a notebook so we only output it when in a server context.