mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-11-29 00:23:07 +00:00
Merge pull request #11462 from freqtrade/enhance-pricing-logs
Enhance pricing logs
This commit is contained in:
@@ -903,14 +903,14 @@ class FreqtradeBot(LoggingMixin):
|
||||
|
||||
msg = (
|
||||
f"Position adjust: about to create a new order for {pair} with stake_amount: "
|
||||
f"{stake_amount} for {trade}"
|
||||
f"{stake_amount} and price: {enter_limit_requested} for {trade}"
|
||||
if mode == "pos_adjust"
|
||||
else (
|
||||
f"Replacing {side} order: about create a new order for {pair} with stake_amount: "
|
||||
f"{stake_amount} ..."
|
||||
f"{stake_amount} and price: {enter_limit_requested} ..."
|
||||
if mode == "replace"
|
||||
else f"{name} signal found: about create a new trade for {pair} with stake_amount: "
|
||||
f"{stake_amount} ..."
|
||||
f"{stake_amount} and price: {enter_limit_requested} ..."
|
||||
)
|
||||
)
|
||||
logger.info(msg)
|
||||
@@ -2590,4 +2590,15 @@ class FreqtradeBot(LoggingMixin):
|
||||
max_custom_price_allowed = proposed_price + (proposed_price * cust_p_max_dist_r)
|
||||
|
||||
# Bracket between min_custom_price_allowed and max_custom_price_allowed
|
||||
return max(min(valid_custom_price, max_custom_price_allowed), min_custom_price_allowed)
|
||||
final_price = max(
|
||||
min(valid_custom_price, max_custom_price_allowed), min_custom_price_allowed
|
||||
)
|
||||
|
||||
# Log a warning if the custom price was adjusted by clamping.
|
||||
if final_price != valid_custom_price:
|
||||
logger.info(
|
||||
f"Custom price adjusted from {valid_custom_price} to {final_price} based on "
|
||||
"custom_price_max_distance_ratio of {cust_p_max_dist_r}."
|
||||
)
|
||||
|
||||
return final_price
|
||||
|
||||
@@ -701,9 +701,9 @@ def test_process_trade_creation(
|
||||
assert pytest.approx(trade.amount) == 0
|
||||
assert pytest.approx(trade.amount_requested) == 60 / ticker_usdt.return_value[ticker_side]
|
||||
|
||||
assert log_has(
|
||||
assert log_has_re(
|
||||
f"{'Short' if is_short else 'Long'} signal found: about create a new trade for ETH/USDT "
|
||||
"with stake_amount: 60.0 ...",
|
||||
r"with stake_amount: 60.0 and price: .*",
|
||||
caplog,
|
||||
)
|
||||
mocker.patch("freqtrade.freqtradebot.FreqtradeBot._check_and_execute_exit")
|
||||
|
||||
Reference in New Issue
Block a user