chore: update plugins to modern typing syntax

This commit is contained in:
Matthias
2024-10-04 07:02:20 +02:00
parent e9a6ba03f9
commit d8e41fa8b1
24 changed files with 116 additions and 122 deletions

View File

@@ -1,7 +1,7 @@
import logging
from datetime import datetime, timezone
from pathlib import Path
from typing import Dict, List, Optional
from typing import Optional
import pandas as pd
@@ -43,7 +43,7 @@ except ImportError:
exit(1)
def init_plotscript(config, markets: List, startup_candles: int = 0):
def init_plotscript(config, markets: list, startup_candles: int = 0):
"""
Initialize objects needed for plotting
:return: Dict with candle (OHLCV) data, trades and pairs
@@ -103,7 +103,7 @@ def init_plotscript(config, markets: List, startup_candles: int = 0):
}
def add_indicators(fig, row, indicators: Dict[str, Dict], data: pd.DataFrame) -> make_subplots:
def add_indicators(fig, row, indicators: dict[str, dict], data: pd.DataFrame) -> make_subplots:
"""
Generate all the indicators selected by the user for a specific row, based on the configuration
:param fig: Plot figure to append to
@@ -301,8 +301,8 @@ def plot_trades(fig, trades: pd.DataFrame) -> make_subplots:
def create_plotconfig(
indicators1: List[str], indicators2: List[str], plot_config: Dict[str, Dict]
) -> Dict[str, Dict]:
indicators1: list[str], indicators2: list[str], plot_config: dict[str, dict]
) -> dict[str, dict]:
"""
Combines indicators 1 and indicators 2 into plot_config if necessary
:param indicators1: List containing Main plot indicators
@@ -434,9 +434,9 @@ def generate_candlestick_graph(
data: pd.DataFrame,
trades: Optional[pd.DataFrame] = None,
*,
indicators1: Optional[List[str]] = None,
indicators2: Optional[List[str]] = None,
plot_config: Optional[Dict[str, Dict]] = None,
indicators1: Optional[list[str]] = None,
indicators2: Optional[list[str]] = None,
plot_config: Optional[dict[str, dict]] = None,
) -> go.Figure:
"""
Generate the graph from the data generated by Backtesting or from DB
@@ -521,7 +521,7 @@ def generate_candlestick_graph(
def generate_profit_graph(
pairs: str,
data: Dict[str, pd.DataFrame],
data: dict[str, pd.DataFrame],
trades: pd.DataFrame,
timeframe: str,
stake_currency: str,