-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vault share price to dashboard (#1733)
- Loading branch information
Showing
8 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
"""Dashboard utilities""" | ||
|
||
from .build_dashboard_dfs import build_pool_dashboard, build_wallet_dashboard | ||
from .plot_fixed_rate import plot_rates | ||
from .plot_ohlcv import plot_ohlcv | ||
from .plot_outstanding_positions import plot_outstanding_positions | ||
from .plot_rates import plot_rates | ||
from .plot_share_price import plot_share_price | ||
from .plot_utils import reduce_plot_data | ||
from .usernames import abbreviate_address, build_user_mapping, map_addresses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
"""Builds the variable rate dataframe to be plotted.""" | ||
|
||
import pandas as pd | ||
|
||
|
||
def build_vault_share_price(pool_info: pd.DataFrame) -> pd.DataFrame: | ||
"""Gets the proper columns from pool info for plotting variable rate. | ||
Arguments | ||
--------- | ||
pool_info: pd.DataFrame | ||
The pool analysis object from `get_pool_info` | ||
Returns | ||
------- | ||
pd.DataFrame | ||
The ready to plot variable rate | ||
""" | ||
vault_share_price = pool_info[["timestamp", "vault_share_price"]].copy() | ||
vault_share_price["vault_share_price"] = vault_share_price["vault_share_price"].astype(float) | ||
# Return here as float for plotting | ||
return vault_share_price |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Plot the fixed rate.""" | ||
|
||
from __future__ import annotations | ||
|
||
import pandas as pd | ||
from matplotlib.axes import Axes | ||
|
||
|
||
def plot_share_price(vault_share_price: pd.DataFrame, axes: Axes) -> None: | ||
"""Plots the vault share price. | ||
Arguments | ||
--------- | ||
vault_share_price: pd.DataFrame | ||
The vault_share_price dataframe. | ||
axes: Axes | ||
The matplotlib axes to plot on. | ||
""" | ||
# TODO add lp share price to this plot | ||
axes.plot(vault_share_price["timestamp"], vault_share_price["vault_share_price"], label="Vault Share Price") | ||
axes.yaxis.set_label_position("right") | ||
axes.yaxis.tick_right() | ||
axes.set_xlabel("Timestamp") | ||
axes.set_ylabel("Share Price") | ||
axes.set_title("Share Price") | ||
axes.legend() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters