mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
feat: lookahead-heplpers -> rich table
This commit is contained in:
parent
e705471946
commit
5e88bd231d
|
@ -4,11 +4,13 @@ from pathlib import Path
|
|||
from typing import Any, Dict, List
|
||||
|
||||
import pandas as pd
|
||||
from rich.text import Text
|
||||
|
||||
from freqtrade.constants import Config
|
||||
from freqtrade.exceptions import OperationalException
|
||||
from freqtrade.optimize.analysis.lookahead import LookaheadAnalysis
|
||||
from freqtrade.resolvers import StrategyResolver
|
||||
from freqtrade.util import print_rich_table
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
@ -53,17 +55,17 @@ class LookaheadAnalysisSubFunctions:
|
|||
[
|
||||
inst.strategy_obj["location"].parts[-1],
|
||||
inst.strategy_obj["name"],
|
||||
inst.current_analysis.has_bias,
|
||||
Text("Yes", style="bold red")
|
||||
if inst.current_analysis.has_bias
|
||||
else Text("No", style="bold green"),
|
||||
inst.current_analysis.total_signals,
|
||||
inst.current_analysis.false_entry_signals,
|
||||
inst.current_analysis.false_exit_signals,
|
||||
", ".join(inst.current_analysis.false_indicators),
|
||||
]
|
||||
)
|
||||
from tabulate import tabulate
|
||||
|
||||
table = tabulate(data, headers=headers, tablefmt="orgtbl")
|
||||
print(table)
|
||||
print_rich_table(data, headers, summary="Lookahead Analysis")
|
||||
return data
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -26,7 +26,7 @@ def print_rich_table(
|
|||
if isinstance(row, dict):
|
||||
table.add_row(*[str(row[header]) for header in headers])
|
||||
else:
|
||||
table.add_row(*row)
|
||||
table.add_row(*[r if isinstance(r, Text) else str(r) for r in row])
|
||||
|
||||
console = Console(
|
||||
width=200 if "pytest" in sys.modules else None,
|
||||
|
|
Loading…
Reference in New Issue
Block a user