mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
a4096318e0
closes #5223
30 lines
913 B
Python
30 lines
913 B
Python
"""
|
|
IHyperOptLoss interface
|
|
This module defines the interface for the loss-function for hyperopt
|
|
"""
|
|
|
|
from abc import ABC, abstractmethod
|
|
from datetime import datetime
|
|
from typing import Any, Dict
|
|
|
|
from pandas import DataFrame
|
|
|
|
|
|
class IHyperOptLoss(ABC):
|
|
"""
|
|
Interface for freqtrade hyperopt Loss functions.
|
|
Defines the custom loss function (`hyperopt_loss_function()` which is evaluated every epoch.)
|
|
"""
|
|
timeframe: str
|
|
|
|
@staticmethod
|
|
@abstractmethod
|
|
def hyperopt_loss_function(results: DataFrame, trade_count: int,
|
|
min_date: datetime, max_date: datetime,
|
|
config: Dict, processed: Dict[str, DataFrame],
|
|
backtest_stats: Dict[str, Any],
|
|
*args, **kwargs) -> float:
|
|
"""
|
|
Objective function, returns smaller number for better results
|
|
"""
|