adding number of trades + average trade duration to edge info

This commit is contained in:
misagh 2018-11-14 13:38:04 +01:00
parent 5de3f1d9dd
commit ac0c931492
2 changed files with 12 additions and 8 deletions

View File

@ -33,7 +33,9 @@ class Edge():
# pair info data type
_pair_info = namedtuple(
'pair_info',
['stoploss', 'winrate', 'risk_reward_ratio', 'required_risk_reward', 'expectancy'])
['stoploss', 'winrate', 'risk_reward_ratio', 'required_risk_reward', 'expectancy',
'nb_trades', 'avg_trade_duration']
)
def __init__(self, config: Dict[str, Any], exchange, strategy) -> None:
@ -297,7 +299,9 @@ class Edge():
'winrate': x.winrate,
'risk_reward_ratio': x.risk_reward_ratio,
'required_risk_reward': x.required_risk_reward,
'expectancy': x.expectancy
'expectancy': x.expectancy,
'nb_trades': x.nb_trades,
'avg_trade_duration': x.avg_trade_duration
}
final[x.pair] = self._pair_info(**info)

View File

@ -128,9 +128,9 @@ def test_adjust(mocker, default_conf):
edge = Edge(default_conf, freqtrade.exchange, freqtrade.strategy)
mocker.patch('freqtrade.edge.Edge._cached_pairs', mocker.PropertyMock(
return_value={
'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)
'E/F': Edge._pair_info(-0.01, 0.66, 3.71, 0.50, 1.71, 10, 60),
'C/D': Edge._pair_info(-0.01, 0.66, 3.71, 0.50, 1.71, 10, 60),
'N/O': Edge._pair_info(-0.01, 0.66, 3.71, 0.50, 1.71, 10, 60)
}
))
@ -143,9 +143,9 @@ def test_stoploss(mocker, default_conf):
edge = Edge(default_conf, freqtrade.exchange, freqtrade.strategy)
mocker.patch('freqtrade.edge.Edge._cached_pairs', mocker.PropertyMock(
return_value={
'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)
'E/F': Edge._pair_info(-0.01, 0.66, 3.71, 0.50, 1.71, 10, 60),
'C/D': Edge._pair_info(-0.01, 0.66, 3.71, 0.50, 1.71, 10, 60),
'N/O': Edge._pair_info(-0.01, 0.66, 3.71, 0.50, 1.71, 10, 60)
}
))