mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 08:33:07 +00:00
fix: backtestResulttype - simplify
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
from copy import deepcopy
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from typing_extensions import TypedDict
|
from typing_extensions import TypedDict
|
||||||
@@ -15,11 +16,13 @@ class BacktestResultType(TypedDict):
|
|||||||
|
|
||||||
|
|
||||||
def get_BacktestResultType_default() -> BacktestResultType:
|
def get_BacktestResultType_default() -> BacktestResultType:
|
||||||
return {
|
return deepcopy(
|
||||||
"metadata": {},
|
{
|
||||||
"strategy": {},
|
"metadata": {},
|
||||||
"strategy_comparison": [],
|
"strategy": {},
|
||||||
}
|
"strategy_comparison": [],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class BacktestHistoryEntryType(BacktestMetadataType):
|
class BacktestHistoryEntryType(BacktestMetadataType):
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from freqtrade.data.metrics import (
|
|||||||
calculate_sortino,
|
calculate_sortino,
|
||||||
calculate_sqn,
|
calculate_sqn,
|
||||||
)
|
)
|
||||||
from freqtrade.ft_types import BacktestResultType
|
from freqtrade.ft_types import BacktestResultType, get_BacktestResultType_default
|
||||||
from freqtrade.util import decimals_per_coin, fmt_coin, get_dry_run_wallet
|
from freqtrade.util import decimals_per_coin, fmt_coin, get_dry_run_wallet
|
||||||
|
|
||||||
|
|
||||||
@@ -587,11 +587,7 @@ def generate_backtest_stats(
|
|||||||
:param max_date: Backtest end date
|
:param max_date: Backtest end date
|
||||||
:return: Dictionary containing results per strategy and a strategy summary.
|
:return: Dictionary containing results per strategy and a strategy summary.
|
||||||
"""
|
"""
|
||||||
result: BacktestResultType = {
|
result: BacktestResultType = get_BacktestResultType_default()
|
||||||
"metadata": {},
|
|
||||||
"strategy": {},
|
|
||||||
"strategy_comparison": [],
|
|
||||||
}
|
|
||||||
market_change = calculate_market_change(btdata, "close")
|
market_change = calculate_market_change(btdata, "close")
|
||||||
metadata = {}
|
metadata = {}
|
||||||
pairlist = list(btdata.keys())
|
pairlist = list(btdata.keys())
|
||||||
|
|||||||
Reference in New Issue
Block a user