refactor: correct naming of new function
This commit is contained in:
@@ -25,7 +25,7 @@ from .bt_fileutils import (
|
|||||||
trade_list_to_dataframe,
|
trade_list_to_dataframe,
|
||||||
update_backtest_metadata,
|
update_backtest_metadata,
|
||||||
)
|
)
|
||||||
from .historic_precision import get_significant_digits_over_time
|
from .historic_precision import get_tick_size_over_time
|
||||||
from .trade_parallelism import (
|
from .trade_parallelism import (
|
||||||
analyze_trade_parallelism,
|
analyze_trade_parallelism,
|
||||||
evaluate_result_multi,
|
evaluate_result_multi,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from pandas import DataFrame, Series
|
from pandas import DataFrame, Series
|
||||||
|
|
||||||
|
|
||||||
def get_significant_digits_over_time(candles: DataFrame) -> Series:
|
def get_tick_size_over_time(candles: DataFrame) -> Series:
|
||||||
"""
|
"""
|
||||||
Calculate the number of significant digits for candles over time.
|
Calculate the number of significant digits for candles over time.
|
||||||
It's using the Monthly maximum of the number of significant digits for each month.
|
It's using the Monthly maximum of the number of significant digits for each month.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ from freqtrade.constants import DATETIME_PRINT_FORMAT, Config, IntOrInf, LongSho
|
|||||||
from freqtrade.data import history
|
from freqtrade.data import history
|
||||||
from freqtrade.data.btanalysis import (
|
from freqtrade.data.btanalysis import (
|
||||||
find_existing_backtest_stats,
|
find_existing_backtest_stats,
|
||||||
get_significant_digits_over_time,
|
get_tick_size_over_time,
|
||||||
trade_list_to_dataframe,
|
trade_list_to_dataframe,
|
||||||
)
|
)
|
||||||
from freqtrade.data.converter import trim_dataframe, trim_dataframes
|
from freqtrade.data.converter import trim_dataframe, trim_dataframes
|
||||||
@@ -323,7 +323,8 @@ class Backtesting:
|
|||||||
self.price_pair_prec = {}
|
self.price_pair_prec = {}
|
||||||
for pair in self.pairlists.whitelist:
|
for pair in self.pairlists.whitelist:
|
||||||
if pair in data:
|
if pair in data:
|
||||||
self.price_pair_prec[pair] = get_significant_digits_over_time(data[pair])
|
# Load price precision logic
|
||||||
|
self.price_pair_prec[pair] = get_tick_size_over_time(data[pair])
|
||||||
return data, self.timerange
|
return data, self.timerange
|
||||||
|
|
||||||
def _load_bt_data_detail(self) -> None:
|
def _load_bt_data_detail(self) -> None:
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ import pandas as pd
|
|||||||
from numpy import nan
|
from numpy import nan
|
||||||
from pandas import DataFrame, Timestamp
|
from pandas import DataFrame, Timestamp
|
||||||
|
|
||||||
from freqtrade.data.btanalysis.historic_precision import get_significant_digits_over_time
|
from freqtrade.data.btanalysis.historic_precision import get_tick_size_over_time
|
||||||
|
|
||||||
|
|
||||||
def test_get_significant_digits_over_time():
|
def test_get_tick_size_over_time():
|
||||||
"""
|
"""
|
||||||
Test the get_significant_digits_over_time function with predefined data
|
Test the get_tick_size_over_time function with predefined data
|
||||||
"""
|
"""
|
||||||
# Create test dataframe with different levels of precision
|
# Create test dataframe with different levels of precision
|
||||||
data = {
|
data = {
|
||||||
@@ -36,7 +36,7 @@ def test_get_significant_digits_over_time():
|
|||||||
candles = DataFrame(data)
|
candles = DataFrame(data)
|
||||||
|
|
||||||
# Calculate significant digits
|
# Calculate significant digits
|
||||||
result = get_significant_digits_over_time(candles)
|
result = get_tick_size_over_time(candles)
|
||||||
|
|
||||||
# Check that the result is a pandas Series
|
# Check that the result is a pandas Series
|
||||||
assert isinstance(result, pd.Series)
|
assert isinstance(result, pd.Series)
|
||||||
@@ -60,9 +60,9 @@ def test_get_significant_digits_over_time():
|
|||||||
assert result.iloc[0] == 0.00001
|
assert result.iloc[0] == 0.00001
|
||||||
|
|
||||||
|
|
||||||
def test_get_significant_digits_over_time_real_data(testdatadir):
|
def test_get_tick_size_over_time_real_data(testdatadir):
|
||||||
"""
|
"""
|
||||||
Test the get_significant_digits_over_time function with real data from the testdatadir
|
Test the get_tick_size_over_time function with real data from the testdatadir
|
||||||
"""
|
"""
|
||||||
from freqtrade.data.history import load_pair_history
|
from freqtrade.data.history import load_pair_history
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ def test_get_significant_digits_over_time_real_data(testdatadir):
|
|||||||
assert not candles.empty, "No test data found, cannot run test"
|
assert not candles.empty, "No test data found, cannot run test"
|
||||||
|
|
||||||
# Calculate significant digits
|
# Calculate significant digits
|
||||||
result = get_significant_digits_over_time(candles)
|
result = get_tick_size_over_time(candles)
|
||||||
|
|
||||||
assert isinstance(result, pd.Series)
|
assert isinstance(result, pd.Series)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user