refactor get_timeframe
This commit is contained in:
parent
702402e1fe
commit
fee8d0a2e1
@ -4,11 +4,12 @@
|
|||||||
This module contains the backtesting logic
|
This module contains the backtesting logic
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
import operator
|
||||||
from argparse import Namespace
|
from argparse import Namespace
|
||||||
from typing import Dict, Tuple, Any, List, Optional
|
from typing import Dict, Tuple, Any, List, Optional
|
||||||
|
|
||||||
import arrow
|
import arrow
|
||||||
from pandas import DataFrame, Series
|
from pandas import DataFrame
|
||||||
from tabulate import tabulate
|
from tabulate import tabulate
|
||||||
|
|
||||||
import freqtrade.optimize as optimize
|
import freqtrade.optimize as optimize
|
||||||
@ -60,11 +61,12 @@ class Backtesting(object):
|
|||||||
:param data: dictionary with preprocessed backtesting data
|
:param data: dictionary with preprocessed backtesting data
|
||||||
:return: tuple containing min_date, max_date
|
:return: tuple containing min_date, max_date
|
||||||
"""
|
"""
|
||||||
all_dates = Series([])
|
timeframe = [
|
||||||
for pair_data in data.values():
|
(arrow.get(min(frame.date)), arrow.get(max(frame.date)))
|
||||||
all_dates = all_dates.append(pair_data['date'])
|
for frame in data.values()
|
||||||
all_dates.sort_values(inplace=True)
|
]
|
||||||
return arrow.get(all_dates.iloc[0]), arrow.get(all_dates.iloc[-1])
|
return min(timeframe, key=operator.itemgetter(0))[0], \
|
||||||
|
max(timeframe, key=operator.itemgetter(1))[1]
|
||||||
|
|
||||||
def _generate_text_table(self, data: Dict[str, Dict], results: DataFrame) -> str:
|
def _generate_text_table(self, data: Dict[str, Dict], results: DataFrame) -> str:
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user