Update wording to entry/exit
This commit is contained in:
parent
326ba46bf8
commit
29879bb415
@ -172,6 +172,7 @@ class Order(_DECL_BASE):
|
||||
'cost': self.cost if self.cost else 0,
|
||||
'filled': self.filled,
|
||||
'ft_order_side': self.ft_order_side,
|
||||
'is_open': self.ft_is_open,
|
||||
'order_date': self.order_date.strftime(DATETIME_PRINT_FORMAT)
|
||||
if self.order_date else None,
|
||||
'order_timestamp': int(self.order_date.replace(
|
||||
@ -181,6 +182,7 @@ class Order(_DECL_BASE):
|
||||
'order_filled_timestamp': int(self.order_filled_date.replace(
|
||||
tzinfo=timezone.utc).timestamp() * 1000) if self.order_filled_date else None,
|
||||
'order_type': self.order_type,
|
||||
'pair': self.ft_pair,
|
||||
'price': self.price,
|
||||
'remaining': self.remaining,
|
||||
'status': self.status,
|
||||
@ -304,14 +306,14 @@ class LocalTrade():
|
||||
|
||||
def to_json(self) -> Dict[str, Any]:
|
||||
filled_orders = self.select_filled_orders()
|
||||
filled_buys = []
|
||||
filled_sells = []
|
||||
filled_entries = []
|
||||
filled_exits = []
|
||||
if len(filled_orders) > 0:
|
||||
for x in range(len(filled_orders)):
|
||||
if filled_orders[x].ft_order_side == 'buy':
|
||||
filled_buys.append(filled_orders[x].to_json())
|
||||
elif filled_orders[x].ft_order_side == 'sell':
|
||||
filled_sells.append(filled_orders[x].to_json())
|
||||
for order in filled_orders:
|
||||
if order.ft_order_side == 'buy':
|
||||
filled_entries.append(order.to_json())
|
||||
if order.ft_order_side == 'sell':
|
||||
filled_exits.append(order.to_json())
|
||||
|
||||
return {
|
||||
'trade_id': self.id,
|
||||
@ -376,8 +378,8 @@ class LocalTrade():
|
||||
'max_rate': self.max_rate,
|
||||
|
||||
'open_order_id': self.open_order_id,
|
||||
'filled_buys': filled_buys,
|
||||
'filled_sells': filled_sells,
|
||||
'filled_entry_orders': filled_entries,
|
||||
'filled_exit_orders': filled_exits,
|
||||
}
|
||||
|
||||
@staticmethod
|
||||
|
@ -437,7 +437,7 @@ class Telegram(RPCHandler):
|
||||
messages = []
|
||||
for r in results:
|
||||
r['open_date_hum'] = arrow.get(r['open_date']).humanize()
|
||||
r['num_buys'] = len(r['filled_buys'])
|
||||
r['num_entries'] = len(r['filled_entry_orders'])
|
||||
r['sell_reason'] = r.get('sell_reason', "")
|
||||
r['position_adjustment_enable'] = r.get('position_adjustment_enable', False)
|
||||
lines = [
|
||||
@ -478,8 +478,9 @@ class Telegram(RPCHandler):
|
||||
else:
|
||||
lines.append("*Open Order:* `{open_order}`")
|
||||
|
||||
if len(r['filled_buys']) > 1:
|
||||
lines_detail = self._prepare_buy_details(r['filled_buys'], r['base_currency'])
|
||||
if len(r['filled_entry_orders']) > 1:
|
||||
lines_detail = self._prepare_buy_details(
|
||||
r['filled_entry_orders'], r['base_currency'])
|
||||
lines.extend(lines_detail)
|
||||
|
||||
# Filter empty lines using list-comprehension
|
||||
|
@ -109,12 +109,14 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
|
||||
'open_order': None,
|
||||
'exchange': 'binance',
|
||||
'position_adjustment_enable': False,
|
||||
'filled_buys': [{'amount': 91.07468123, 'average': 1.098e-05,
|
||||
'cost': 0.0009999999999054, 'filled': 91.07468123, 'ft_order_side': 'buy',
|
||||
'order_date': ANY, 'order_timestamp': ANY, 'order_filled_date': ANY,
|
||||
'order_filled_timestamp': ANY, 'order_type': 'limit', 'price': 1.098e-05,
|
||||
'remaining': ANY, 'status': ANY}],
|
||||
'filled_sells': []
|
||||
'filled_entry_orders': [{
|
||||
'amount': 91.07468123, 'average': 1.098e-05,
|
||||
'cost': 0.0009999999999054, 'filled': 91.07468123, 'ft_order_side': 'buy',
|
||||
'order_date': ANY, 'order_timestamp': ANY, 'order_filled_date': ANY,
|
||||
'order_filled_timestamp': ANY, 'order_type': 'limit', 'price': 1.098e-05,
|
||||
'is_open': False, 'pair': 'ETH/BTC',
|
||||
'remaining': ANY, 'status': ANY}],
|
||||
'filled_exit_orders': []
|
||||
}
|
||||
|
||||
mocker.patch('freqtrade.exchange.Exchange.get_rate',
|
||||
@ -183,12 +185,14 @@ def test_rpc_trade_status(default_conf, ticker, fee, mocker) -> None:
|
||||
'open_order': None,
|
||||
'exchange': 'binance',
|
||||
'position_adjustment_enable': False,
|
||||
'filled_buys': [{'amount': 91.07468123, 'average': 1.098e-05,
|
||||
'cost': 0.0009999999999054, 'filled': 91.07468123, 'ft_order_side': 'buy',
|
||||
'order_date': ANY, 'order_timestamp': ANY, 'order_filled_date': ANY,
|
||||
'order_filled_timestamp': ANY, 'order_type': 'limit', 'price': 1.098e-05,
|
||||
'remaining': ANY, 'status': ANY}],
|
||||
'filled_sells': []
|
||||
'filled_entry_orders': [{
|
||||
'amount': 91.07468123, 'average': 1.098e-05,
|
||||
'cost': 0.0009999999999054, 'filled': 91.07468123, 'ft_order_side': 'buy',
|
||||
'order_date': ANY, 'order_timestamp': ANY, 'order_filled_date': ANY,
|
||||
'order_filled_timestamp': ANY, 'order_type': 'limit', 'price': 1.098e-05,
|
||||
'is_open': False, 'pair': 'ETH/BTC',
|
||||
'remaining': ANY, 'status': ANY}],
|
||||
'filled_exit_orders': []
|
||||
}
|
||||
|
||||
|
||||
|
@ -202,7 +202,7 @@ def test_telegram_status(default_conf, update, mocker) -> None:
|
||||
'stop_loss_ratio': -0.0001,
|
||||
'open_order': '(limit buy rem=0.00000000)',
|
||||
'is_open': True,
|
||||
'filled_buys': []
|
||||
'filled_entry_orders': []
|
||||
}]),
|
||||
)
|
||||
|
||||
|
@ -903,8 +903,8 @@ def test_to_json(default_conf, fee):
|
||||
'buy_tag': None,
|
||||
'timeframe': None,
|
||||
'exchange': 'binance',
|
||||
'filled_buys': [],
|
||||
'filled_sells': []
|
||||
'filled_entry_orders': [],
|
||||
'filled_exit_orders': []
|
||||
}
|
||||
|
||||
# Simulate dry_run entries
|
||||
@ -972,8 +972,8 @@ def test_to_json(default_conf, fee):
|
||||
'buy_tag': 'buys_signal_001',
|
||||
'timeframe': None,
|
||||
'exchange': 'binance',
|
||||
'filled_buys': [],
|
||||
'filled_sells': []
|
||||
'filled_entry_orders': [],
|
||||
'filled_exit_orders': []
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user