mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-16 12:51:14 +00:00
fix: ensure createMarketBuyOrderRequiresPrice is only applied to buys
closes #10833
This commit is contained in:
@@ -1230,10 +1230,10 @@ class Exchange:
|
|||||||
params.update({"reduceOnly": True})
|
params.update({"reduceOnly": True})
|
||||||
return params
|
return params
|
||||||
|
|
||||||
def _order_needs_price(self, ordertype: str) -> bool:
|
def _order_needs_price(self, side: BuySell, ordertype: str) -> bool:
|
||||||
return (
|
return (
|
||||||
ordertype != "market"
|
ordertype != "market"
|
||||||
or self._api.options.get("createMarketBuyOrderRequiresPrice", False)
|
or (side == "buy" and self._api.options.get("createMarketBuyOrderRequiresPrice", False))
|
||||||
or self._ft_has.get("marketOrderRequiresPrice", False)
|
or self._ft_has.get("marketOrderRequiresPrice", False)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1260,7 +1260,7 @@ class Exchange:
|
|||||||
try:
|
try:
|
||||||
# Set the precision for amount and price(rate) as accepted by the exchange
|
# Set the precision for amount and price(rate) as accepted by the exchange
|
||||||
amount = self.amount_to_precision(pair, self._amount_to_contracts(pair, amount))
|
amount = self.amount_to_precision(pair, self._amount_to_contracts(pair, amount))
|
||||||
needs_price = self._order_needs_price(ordertype)
|
needs_price = self._order_needs_price(side, ordertype)
|
||||||
rate_for_order = self.price_to_precision(pair, rate) if needs_price else None
|
rate_for_order = self.price_to_precision(pair, rate) if needs_price else None
|
||||||
|
|
||||||
if not reduceOnly:
|
if not reduceOnly:
|
||||||
|
|||||||
Reference in New Issue
Block a user