Skip to content

Commit e2fc8b2

Browse files
Add recommended plotly configuration for plot_signals.py and plot_portfolio.py.
1 parent a229978 commit e2fc8b2

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

environment.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,12 @@ dependencies:
1919
- pytest-cov
2020
- pytest-xdist
2121

22-
# Python template project dependencies
22+
# Python project dependencies
2323
- statsmodels
2424
- numpy
2525
- pandas >=2.2
2626
- plotly >=5.2.0,<6
27-
28-
# Data dependencies
27+
- pyarrow>=10.0.1
2928
- yfinance >=0.2.54
3029

3130
# Install project

src/backtest_bay/plot/plot_portfolio.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
import plotly.graph_objects as go
33
from plotly.subplots import make_subplots
44

5+
pd.options.mode.copy_on_write = True
6+
pd.options.future.infer_string = True
7+
pd.options.plotting.backend = "plotly"
8+
59

610
def plot_portfolio(portfolio, title, tac):
711
"""Main function to plot the portfolio performance and metrics."""

src/backtest_bay/plot/plot_signals.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
import pandas as pd
12
import plotly.graph_objects as go
23
from plotly.subplots import make_subplots
34

5+
pd.options.mode.copy_on_write = True
6+
pd.options.future.infer_string = True
7+
pd.options.plotting.backend = "plotly"
8+
49

510
def plot_signals(df, title):
611
"""Create Plotly figure to plot trading signals."""

0 commit comments

Comments
 (0)