Merge pull request #3369 from freqtrade/align_trade_outputs

Improve some api results
This commit is contained in:
hroff-1902
2020-05-27 22:56:15 +03:00
committed by GitHub
7 changed files with 40 additions and 11 deletions

View File

@@ -49,6 +49,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
'base_currency': 'BTC',
'open_date': ANY,
'open_date_hum': ANY,
'open_timestamp': ANY,
'is_open': ANY,
'fee_open': ANY,
'fee_open_cost': ANY,
@@ -68,13 +69,16 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
'open_order_id': ANY,
'close_date': None,
'close_date_hum': None,
'close_timestamp': None,
'open_rate': 1.098e-05,
'close_rate': None,
'current_rate': 1.099e-05,
'amount': 91.07468124,
'stake_amount': 0.001,
'close_profit': None,
'current_profit': -0.41,
'close_profit_pct': None,
'current_profit': -0.00408133,
'current_profit_pct': -0.41,
'stop_loss': 0.0,
'initial_stop_loss': 0.0,
'initial_stop_loss_pct': None,
@@ -93,6 +97,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
'base_currency': 'BTC',
'open_date': ANY,
'open_date_hum': ANY,
'open_timestamp': ANY,
'is_open': ANY,
'fee_open': ANY,
'fee_open_cost': ANY,
@@ -112,13 +117,16 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
'open_order_id': ANY,
'close_date': None,
'close_date_hum': None,
'close_timestamp': None,
'open_rate': 1.098e-05,
'close_rate': None,
'current_rate': ANY,
'amount': 91.07468124,
'stake_amount': 0.001,
'close_profit': None,
'close_profit_pct': None,
'current_profit': ANY,
'current_profit_pct': ANY,
'stop_loss': 0.0,
'initial_stop_loss': 0.0,
'initial_stop_loss_pct': None,

View File

@@ -420,7 +420,9 @@ def test_api_profit(botclient, mocker, ticker, fee, markets, limit_buy_order, li
'best_pair': 'ETH/BTC',
'best_rate': 6.2,
'first_trade_date': 'just now',
'first_trade_timestamp': ANY,
'latest_trade_date': 'just now',
'latest_trade_timestamp': ANY,
'profit_all_coin': 6.217e-05,
'profit_all_fiat': 0,
'profit_all_percent': 6.2,
@@ -497,14 +499,18 @@ def test_api_status(botclient, mocker, ticker, fee, markets):
'base_currency': 'BTC',
'close_date': None,
'close_date_hum': None,
'close_timestamp': None,
'close_profit': None,
'close_profit_pct': None,
'close_rate': None,
'current_profit': -0.41,
'current_profit': -0.00408133,
'current_profit_pct': -0.41,
'current_rate': 1.099e-05,
'initial_stop_loss': 0.0,
'initial_stop_loss_pct': None,
'open_date': ANY,
'open_date_hum': 'just now',
'open_timestamp': ANY,
'open_order': '(limit buy rem=0.00000000)',
'open_rate': 1.098e-05,
'pair': 'ETH/BTC',
@@ -609,11 +615,13 @@ def test_api_forcebuy(botclient, mocker, fee):
assert rc.json == {'amount': 1,
'close_date': None,
'close_date_hum': None,
'close_timestamp': None,
'close_rate': 0.265441,
'initial_stop_loss': None,
'initial_stop_loss_pct': None,
'open_date': ANY,
'open_date_hum': 'just now',
'open_timestamp': ANY,
'open_rate': 0.245441,
'pair': 'ETH/ETH',
'stake_amount': 1,

View File

@@ -166,8 +166,9 @@ def test_status(default_conf, update, mocker, fee, ticker,) -> None:
'current_rate': 1.098e-05,
'amount': 90.99181074,
'stake_amount': 90.99181074,
'close_profit': None,
'current_profit': -0.59,
'close_profit_pct': None,
'current_profit': -0.0059,
'current_profit_pct': -0.59,
'initial_stop_loss': 1.098e-05,
'stop_loss': 1.099e-05,
'sell_order_status': None,

View File

@@ -739,9 +739,11 @@ def test_to_json(default_conf, fee):
'is_open': None,
'open_date_hum': '2 hours ago',
'open_date': trade.open_date.strftime("%Y-%m-%d %H:%M:%S"),
'open_timestamp': int(trade.open_date.timestamp() * 1000),
'open_order_id': 'dry_run_buy_12345',
'close_date_hum': None,
'close_date': None,
'close_timestamp': None,
'open_rate': 0.123,
'open_rate_requested': None,
'open_trade_price': 15.1668225,
@@ -787,8 +789,10 @@ def test_to_json(default_conf, fee):
'pair': 'XRP/BTC',
'open_date_hum': '2 hours ago',
'open_date': trade.open_date.strftime("%Y-%m-%d %H:%M:%S"),
'open_timestamp': int(trade.open_date.timestamp() * 1000),
'close_date_hum': 'an hour ago',
'close_date': trade.close_date.strftime("%Y-%m-%d %H:%M:%S"),
'close_timestamp': int(trade.close_date.timestamp() * 1000),
'open_rate': 0.123,
'close_rate': 0.125,
'amount': 100.0,