ERC-4626: examine vault historical performance
This notebook serves both as a coding tutorial and a useful data analytics tool for ERC-4626 vaults.
In this notebook, we examine one ERC-4626 vault historical performance
We pick one vault by chain id and address and show its metrics
We visualise the performance with Plotly charts and
quantstatsportfolio performance metrics
Usage
Read general instructions how to run the tutorials
See
ERC-4626 scanning all vaults onchainexample in tutorials first how to build a vault database as localvault_db.picklefile.See
ERC-4626: scanning vaults' historical price and performanceexample in tutorials first how to buildvault-prices.parquetfile.
Setup
Set up notebook rendering output mode
Use static image charts so this notebook is readeable on Github / ReadTheDocs
[28]:
import pandas as pd
from plotly.offline import init_notebook_mode
import plotly.io as pio
from eth_defi.vault.base import VaultSpec
pd.options.display.float_format = "{:,.2f}".format
pd.options.display.max_columns = None
pd.options.display.max_rows = None
# Set up Plotly chart output as SVG
image_format = "png"
width = 1400
height = 800
# https://stackoverflow.com/a/52956402/315168
init_notebook_mode()
# https://stackoverflow.com/a/74609837/315168
assert hasattr(pio, "kaleido"), "Kaleido rendering backend missing. Run 'pip install kaleido' needed for this notebook"
pio.kaleido.scope.default_format = image_format
# https://plotly.com/python/renderers/#overriding-the-default-renderer
pio.renderers.default = image_format
current_renderer = pio.renderers[image_format]
# Have SVGs default pixel with
current_renderer.width = width
current_renderer.height = height