fix market

This commit is contained in:
olli 2024-11-28 10:05:54 +01:00
parent 544fdb2a7a
commit 4122d60f34

View File

@ -103,38 +103,44 @@ function order {
# Add stoploos and take profit if available # Add stoploos and take profit if available
if [ -n "$f_stoploss" ] && [[ $f_type = limit ]] if [ -n "$f_stoploss" ]
then then
# check for long if [[ $f_type = limit ]]
if [[ $f_side = buy ]] && g_num_is_higher_equal $f_stoploss $f_price
then then
g_echo_warn "Long Order not possible: Stoploss ($f_stoploss) higher then buy price ($f_price)" # check for long
return 1 if [[ $f_side = buy ]] && g_num_is_higher_equal $f_stoploss $f_price
then
g_echo_warn "Long Order not possible: Stoploss ($f_stoploss) higher then buy price ($f_price)"
return 1
fi
# check for short
if [[ $f_side = sell ]] && g_num_is_lower_equal $f_stoploss $f_price
then
g_echo_warn "Short Order not possible: Stoploss ($f_stoploss) lower then buy price ($f_price)"
return 1
fi
fi fi
# check for short
if [[ $f_side = sell ]] && g_num_is_lower_equal $f_stoploss $f_price
then
g_echo_warn "Short Order not possible: Stoploss ($f_stoploss) lower then buy price ($f_price)"
return 1
fi
f_ccxt "print($STOCK_EXCHANGE.priceToPrecision('${f_symbol}', ${f_stoploss}))" f_ccxt "print($STOCK_EXCHANGE.priceToPrecision('${f_symbol}', ${f_stoploss}))"
f_stoploss=$f_ccxt_result f_stoploss=$f_ccxt_result
f_params="${f_params}'stopLossPrice': '$f_stoploss', " f_params="${f_params}'stopLossPrice': '$f_stoploss', "
fi fi
if [ -n "$f_takeprofit" ] && [[ $f_type = limit ]] if [ -n "$f_takeprofit" ]
then then
# check for long # check for long
if [[ $f_side = buy ]] && g_num_is_lower_equal $f_takeprofit $f_price if [[ $f_type = limit ]]
then then
g_echo_warn "Long Order not possible:TakeProfit ($f_takeprofit) lower then buy price ($f_price)" if [[ $f_side = buy ]] && g_num_is_lower_equal $f_takeprofit $f_price
return 1 then
fi g_echo_warn "Long Order not possible:TakeProfit ($f_takeprofit) lower then buy price ($f_price)"
# check for short return 1
if [[ $f_side = sell ]] && g_num_is_higher_equal $f_takeprofit $f_price fi
then # check for short
g_echo_warn "Short Order not possible:TakeProfit ($f_takeprofit) higher then buy price ($f_price)" if [[ $f_side = sell ]] && g_num_is_higher_equal $f_takeprofit $f_price
return 1 then
fi g_echo_warn "Short Order not possible:TakeProfit ($f_takeprofit) higher then buy price ($f_price)"
return 1
fi
fi
f_ccxt "print($STOCK_EXCHANGE.priceToPrecision('${f_symbol}', ${f_takeprofit}))" f_ccxt "print($STOCK_EXCHANGE.priceToPrecision('${f_symbol}', ${f_takeprofit}))"
f_takeprofit=$f_ccxt_result f_takeprofit=$f_ccxt_result
f_params="${f_params}'takeProfitPrice': '$f_takeprofit', " f_params="${f_params}'takeProfitPrice': '$f_takeprofit', "