Use ruff linter.
This commit is contained in:
@@ -1,11 +1,9 @@
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
from datetime import datetime, timedelta
|
||||
from datetime import timedelta
|
||||
import matplotlib.pyplot as plt
|
||||
import seaborn as sns
|
||||
from scipy.stats import norm
|
||||
from scipy.signal import savgol_filter
|
||||
from multiprocessing import Process, Pool
|
||||
from multiprocessing import Pool
|
||||
|
||||
|
||||
# Utility functions
|
||||
@@ -455,7 +453,7 @@ def create_plots(df, start=None, end=None, project_days=365):
|
||||
plt.style.use("seaborn-v0_8")
|
||||
|
||||
# Create figure with adjusted size for additional subplot
|
||||
fig = plt.figure(figsize=(15, 15)) # Increased height to accommodate new subplot
|
||||
_ = plt.figure(figsize=(15, 15)) # Increased height to accommodate new subplot
|
||||
|
||||
# Date range for titles
|
||||
hist_date_range = f" ({plot_df['Date'].min().strftime('%Y-%m-%d')} to {plot_df['Date'].max().strftime('%Y-%m-%d')})"
|
||||
@@ -850,7 +848,7 @@ def create_backtest_plot(
|
||||
|
||||
# Set up the plot
|
||||
plt.style.use("seaborn-v0_8")
|
||||
fig, ax = plt.figure(figsize=(15, 10)), plt.gca()
|
||||
_, ax = plt.figure(figsize=(15, 10)), plt.gca()
|
||||
|
||||
# Plot training data
|
||||
heading_label = f'Historical Price (Training: {start_date.strftime("%Y-%m-%d")} to {backtest_date.strftime("%Y-%m-%d")})'
|
||||
@@ -1015,7 +1013,7 @@ def create_backtest_plot(
|
||||
|
||||
def run_projection(args):
|
||||
df, start = args
|
||||
projections = create_plots(df, start=start, project_days=365 * 4)
|
||||
_ = create_plots(df, start=start, project_days=365 * 4)
|
||||
|
||||
|
||||
def run_projections(df):
|
||||
@@ -1205,7 +1203,7 @@ def run_systematic_backtests(df, validation_years=1, min_training_years=8):
|
||||
# Sort periods by backtest date for clearer analysis
|
||||
unique_periods.sort(key=lambda x: pd.Timestamp(x["backtest_date"]))
|
||||
|
||||
print(f"\nRunning backtests with:")
|
||||
print("\nRunning backtests with:")
|
||||
print(
|
||||
f"- Start dates range: {unique_periods[0]['start_date']} to {unique_periods[-1]['start_date']}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user