Rename function to adjust_min_max
This commit is contained in:
		| @@ -204,7 +204,7 @@ class Trade(_DECL_BASE): | ||||
|         return (f'Trade(id={self.id}, pair={self.pair}, amount={self.amount:.8f}, ' | ||||
|                 f'open_rate={self.open_rate:.8f}, open_since={open_since})') | ||||
|  | ||||
|     def adjust_high_low(self, current_price: float): | ||||
|     def adjust_min_max_rates(self, current_price: float): | ||||
|         """ | ||||
|         Adjust the max_rate and min_rate. | ||||
|         """ | ||||
|   | ||||
| @@ -254,7 +254,7 @@ class IStrategy(ABC): | ||||
|         current_rate = low or rate | ||||
|         current_profit = trade.calc_profit_percent(current_rate) | ||||
|  | ||||
|         trade.adjust_high_low(current_rate) | ||||
|         trade.adjust_min_max_rates(current_rate) | ||||
|  | ||||
|         stoplossflag = self.stop_loss_reached(current_rate=current_rate, trade=trade, | ||||
|                                               current_time=date, current_profit=current_profit, | ||||
|   | ||||
| @@ -627,7 +627,7 @@ def test_adjust_stop_loss(fee): | ||||
|     assert trade.initial_stop_loss == 0.95 | ||||
|  | ||||
|  | ||||
| def test_adjust_high_low(fee): | ||||
| def test_adjust_min_max_rates(fee): | ||||
|     trade = Trade( | ||||
|         pair='ETH/BTC', | ||||
|         stake_amount=0.001, | ||||
| @@ -637,22 +637,22 @@ def test_adjust_high_low(fee): | ||||
|         open_rate=1, | ||||
|     ) | ||||
|  | ||||
|     trade.adjust_high_low(trade.open_rate) | ||||
|     trade.adjust_min_max_rates(trade.open_rate) | ||||
|     assert trade.max_rate == 1 | ||||
|     assert trade.min_rate == 1 | ||||
|  | ||||
|     # check min adjusted, max remained | ||||
|     trade.adjust_high_low(0.96) | ||||
|     trade.adjust_min_max_rates(0.96) | ||||
|     assert trade.max_rate == 1 | ||||
|     assert trade.min_rate == 0.96 | ||||
|  | ||||
|     # check max adjusted, min remains | ||||
|     trade.adjust_high_low(1.05) | ||||
|     trade.adjust_min_max_rates(1.05) | ||||
|     assert trade.max_rate == 1.05 | ||||
|     assert trade.min_rate == 0.96 | ||||
|  | ||||
|     # current rate "in the middle" - no adjustment | ||||
|     trade.adjust_high_low(1.03) | ||||
|     trade.adjust_min_max_rates(1.03) | ||||
|     assert trade.max_rate == 1.05 | ||||
|     assert trade.min_rate == 0.96 | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user