_pair_info moved to class header for reusibility
This commit is contained in:
parent
b425cc3e3b
commit
96a43327ca
@ -30,6 +30,11 @@ class Edge():
|
||||
config: Dict = {}
|
||||
_cached_pairs: Dict[str, Any] = {} # Keeps a list of pairs
|
||||
|
||||
# pair info data type
|
||||
_pair_info = namedtuple(
|
||||
'pair_info',
|
||||
['stoploss', 'winrate', 'risk_reward_ratio', 'required_risk_reward', 'expectancy'])
|
||||
|
||||
def __init__(self, config: Dict[str, Any], exchange=None) -> None:
|
||||
|
||||
self.config = config
|
||||
@ -42,10 +47,6 @@ class Edge():
|
||||
self.advise_buy = self.strategy.advise_buy
|
||||
|
||||
self.edge_config = self.config.get('edge', {})
|
||||
|
||||
# pair info data type
|
||||
self._pair_info = namedtuple(
|
||||
'pair_info', 'stoploss, winrate, risk_reward_ratio, required_risk_reward, expectancy')
|
||||
self._cached_pairs: Dict[str, Any] = {} # Keeps a list of pairs
|
||||
|
||||
self._total_capital: float = self.edge_config.get('total_capital_in_stake_currency')
|
||||
|
@ -2,7 +2,6 @@ from freqtrade.tests.conftest import get_patched_exchange
|
||||
from freqtrade.edge import Edge
|
||||
from pandas import DataFrame, to_datetime
|
||||
from freqtrade.strategy.interface import SellType
|
||||
from collections import namedtuple
|
||||
import arrow
|
||||
import numpy as np
|
||||
import math
|
||||
@ -21,8 +20,6 @@ from unittest.mock import MagicMock
|
||||
ticker_start_time = arrow.get(2018, 10, 3)
|
||||
ticker_interval_in_minute = 60
|
||||
_ohlc = {'date': 0, 'buy': 1, 'open': 2, 'high': 3, 'low': 4, 'close': 5, 'sell': 6, 'volume': 7}
|
||||
_pair_info = namedtuple(
|
||||
'pair_info', 'stoploss, winrate, risk_reward_ratio, required_risk_reward, expectancy')
|
||||
|
||||
|
||||
def test_filter(mocker, default_conf):
|
||||
@ -30,9 +27,9 @@ def test_filter(mocker, default_conf):
|
||||
edge = Edge(default_conf, exchange)
|
||||
mocker.patch('freqtrade.edge.Edge._cached_pairs', mocker.PropertyMock(
|
||||
return_value={
|
||||
'E/F': _pair_info(-0.01, 0.66, 3.71, 0.50, 1.71),
|
||||
'C/D': _pair_info(-0.01, 0.66, 3.71, 0.50, 1.71),
|
||||
'N/O': _pair_info(-0.01, 0.66, 3.71, 0.50, 1.71)
|
||||
'E/F': Edge._pair_info(-0.01, 0.66, 3.71, 0.50, 1.71),
|
||||
'C/D': Edge._pair_info(-0.01, 0.66, 3.71, 0.50, 1.71),
|
||||
'N/O': Edge._pair_info(-0.01, 0.66, 3.71, 0.50, 1.71)
|
||||
}
|
||||
))
|
||||
|
||||
@ -45,9 +42,9 @@ def test_stoploss(mocker, default_conf):
|
||||
edge = Edge(default_conf, exchange)
|
||||
mocker.patch('freqtrade.edge.Edge._cached_pairs', mocker.PropertyMock(
|
||||
return_value={
|
||||
'E/F': _pair_info(-0.01, 0.66, 3.71, 0.50, 1.71),
|
||||
'C/D': _pair_info(-0.01, 0.66, 3.71, 0.50, 1.71),
|
||||
'N/O': _pair_info(-0.01, 0.66, 3.71, 0.50, 1.71)
|
||||
'E/F': Edge._pair_info(-0.01, 0.66, 3.71, 0.50, 1.71),
|
||||
'C/D': Edge._pair_info(-0.01, 0.66, 3.71, 0.50, 1.71),
|
||||
'N/O': Edge._pair_info(-0.01, 0.66, 3.71, 0.50, 1.71)
|
||||
}
|
||||
))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user