rpc_counts should be in .rpc
This commit is contained in:
parent
7a598f32dc
commit
f139178136
@ -454,7 +454,7 @@ class RPC(object):
|
||||
for pair, rate, count in pair_rates
|
||||
]
|
||||
|
||||
def _rpc_count(self) -> List[Trade]:
|
||||
def _rpc_count(self) -> Dict[str, float]:
|
||||
""" Returns the number of trades running """
|
||||
if self._freqtrade.state != State.RUNNING:
|
||||
raise RPCException('trader is not running')
|
||||
@ -462,8 +462,8 @@ class RPC(object):
|
||||
trades = Trade.get_open_trades()
|
||||
return {
|
||||
'current': len(trades),
|
||||
'max': self._config['max_open_trades'],
|
||||
'total stake': sum((trade.open_rate * trade.amount) for trade in trades)
|
||||
'max': float(self._freqtrade.config['max_open_trades']),
|
||||
'total_stake': sum((trade.open_rate * trade.amount) for trade in trades)
|
||||
}
|
||||
|
||||
def _rpc_whitelist(self) -> Dict:
|
||||
|
@ -581,15 +581,13 @@ def test_rpc_count(mocker, default_conf, ticker, fee, markets) -> None:
|
||||
patch_get_signal(freqtradebot, (True, False))
|
||||
rpc = RPC(freqtradebot)
|
||||
|
||||
trades = rpc._rpc_count()
|
||||
nb_trades = len(trades)
|
||||
assert nb_trades == 0
|
||||
counts = rpc._rpc_count()
|
||||
assert counts["current"] == 0
|
||||
|
||||
# Create some test data
|
||||
freqtradebot.create_trade()
|
||||
trades = rpc._rpc_count()
|
||||
nb_trades = len(trades)
|
||||
assert nb_trades == 1
|
||||
counts = rpc._rpc_count()
|
||||
assert counts["current"] == 1
|
||||
|
||||
|
||||
def test_rpcforcebuy(mocker, default_conf, ticker, fee, markets, limit_buy_order) -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user