Updated unittests
Co-Authored-By: மனோஜ்குமார் பழனிச்சாமி <smartmanoj42857@gmail.com>
This commit is contained in:
parent
117e966f34
commit
498aa9c8be
@ -374,6 +374,7 @@ class LocalTrade():
|
|||||||
if self.close_date else None),
|
if self.close_date else None),
|
||||||
'close_timestamp': int(self.close_date.replace(
|
'close_timestamp': int(self.close_date.replace(
|
||||||
tzinfo=timezone.utc).timestamp() * 1000) if self.close_date else None,
|
tzinfo=timezone.utc).timestamp() * 1000) if self.close_date else None,
|
||||||
|
'realized_profit': self.realized_profit,
|
||||||
'close_rate': self.close_rate,
|
'close_rate': self.close_rate,
|
||||||
'close_rate_requested': self.close_rate_requested,
|
'close_rate_requested': self.close_rate_requested,
|
||||||
'close_profit': self.close_profit, # Deprecated
|
'close_profit': self.close_profit, # Deprecated
|
||||||
@ -880,7 +881,7 @@ class Trade(_DECL_BASE, LocalTrade):
|
|||||||
open_trade_value = Column(Float)
|
open_trade_value = Column(Float)
|
||||||
close_rate: Optional[float] = Column(Float)
|
close_rate: Optional[float] = Column(Float)
|
||||||
close_rate_requested = Column(Float)
|
close_rate_requested = Column(Float)
|
||||||
realized_profit = Column(Float)
|
realized_profit = Column(Float, default=0.0)
|
||||||
close_profit = Column(Float)
|
close_profit = Column(Float)
|
||||||
close_profit_abs = Column(Float)
|
close_profit_abs = Column(Float)
|
||||||
stake_amount = Column(Float, nullable=False)
|
stake_amount = Column(Float, nullable=False)
|
||||||
|
@ -193,11 +193,11 @@ class RPC:
|
|||||||
stoploss_current_dist_ratio = stoploss_current_dist / current_rate
|
stoploss_current_dist_ratio = stoploss_current_dist / current_rate
|
||||||
|
|
||||||
trade_dict = trade.to_json()
|
trade_dict = trade.to_json()
|
||||||
|
import pprint;logger.info(pprint.pformat(trade_dict))
|
||||||
trade_dict.update(dict(
|
trade_dict.update(dict(
|
||||||
base_currency=self._freqtrade.config['stake_currency'],
|
base_currency=self._freqtrade.config['stake_currency'],
|
||||||
close_profit=trade.close_profit if not trade.is_open else None,
|
close_profit=trade.close_profit if not trade.is_open else None,
|
||||||
current_rate=current_rate,
|
current_rate=current_rate,
|
||||||
realized_profit=trade.realized_profit,
|
|
||||||
current_profit=current_profit, # Deprecated
|
current_profit=current_profit, # Deprecated
|
||||||
current_profit_pct=round(current_profit * 100, 2), # Deprecated
|
current_profit_pct=round(current_profit * 100, 2), # Deprecated
|
||||||
current_profit_abs=current_profit_abs, # Deprecated
|
current_profit_abs=current_profit_abs, # Deprecated
|
||||||
|
@ -500,7 +500,8 @@ class Telegram(RPCHandler):
|
|||||||
])
|
])
|
||||||
|
|
||||||
if r['is_open']:
|
if r['is_open']:
|
||||||
lines.append("*Realized Prodir:* `{realized_profit:.8f}`")
|
if r.get('realized_profit'):
|
||||||
|
lines.append("*Realized Profit:* `{realized_profit:.8f}`")
|
||||||
if (r['stop_loss_abs'] != r['initial_stop_loss_abs']
|
if (r['stop_loss_abs'] != r['initial_stop_loss_abs']
|
||||||
and r['initial_stop_loss_ratio'] is not None):
|
and r['initial_stop_loss_ratio'] is not None):
|
||||||
# Adding initial stoploss only if it is different from stoploss
|
# Adding initial stoploss only if it is different from stoploss
|
||||||
|
@ -108,6 +108,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
|
|||||||
'stoploss_entry_dist': -0.00010475,
|
'stoploss_entry_dist': -0.00010475,
|
||||||
'stoploss_entry_dist_ratio': -0.10448878,
|
'stoploss_entry_dist_ratio': -0.10448878,
|
||||||
'open_order': None,
|
'open_order': None,
|
||||||
|
'realized_profit': 0.0,
|
||||||
'exchange': 'binance',
|
'exchange': 'binance',
|
||||||
'orders': [{
|
'orders': [{
|
||||||
'amount': 91.07468123, 'average': 1.098e-05, 'safe_price': 1.098e-05,
|
'amount': 91.07468123, 'average': 1.098e-05, 'safe_price': 1.098e-05,
|
||||||
@ -183,6 +184,7 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
|
|||||||
'stoploss_entry_dist_ratio': -0.10448878,
|
'stoploss_entry_dist_ratio': -0.10448878,
|
||||||
'open_order': None,
|
'open_order': None,
|
||||||
'exchange': 'binance',
|
'exchange': 'binance',
|
||||||
|
'realized_profit': 0.0,
|
||||||
'orders': [{
|
'orders': [{
|
||||||
'amount': 91.07468123, 'average': 1.098e-05, 'safe_price': 1.098e-05,
|
'amount': 91.07468123, 'average': 1.098e-05, 'safe_price': 1.098e-05,
|
||||||
'cost': 0.0009999999999054, 'filled': 91.07468123, 'ft_order_side': 'buy',
|
'cost': 0.0009999999999054, 'filled': 91.07468123, 'ft_order_side': 'buy',
|
||||||
|
Loading…
Reference in New Issue
Block a user