From 53861b2a8eaf4b534662f545c011bf956ff734f2 Mon Sep 17 00:00:00 2001 From: olli Date: Tue, 24 Sep 2024 20:36:53 +0200 Subject: [PATCH] fix --- dabo/functions/order.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dabo/functions/order.sh b/dabo/functions/order.sh index a23a9c2..bf54bbf 100644 --- a/dabo/functions/order.sh +++ b/dabo/functions/order.sh @@ -91,12 +91,22 @@ function order { # Add stoploos and take profit if available if [ -n "$f_stoploss" ] then + if g_num_is_higher_equal $f_stoploss $f_price + then + g_echo_warn "Order not possible: Stoploss ($f_stoploss) higher then buy price ($f_price)" + return 1 + fi f_ccxt "print($STOCK_EXCHANGE.priceToPrecision('${f_symbol}', ${f_stoploss}))" f_stoploss=$f_ccxt_result f_params="${f_params}'stopLossPrice': '$f_stoploss', " fi if [ -n "$f_takeprofit" ] then + if g_num_is_lower_equal $f_takeprofit $f_price + then + g_echo_warn "Order not possible:TakeProfit ($f_takeprofit) lower then buy price ($f_price)" + return 1 + fi f_ccxt "print($STOCK_EXCHANGE.priceToPrecision('${f_symbol}', ${f_takeprofit}))" f_takeprofit=$f_ccxt_result f_params="${f_params}'takeProfitPrice': '$f_takeprofit', "