fix sell SELL_IF_LOWER_THEN_FEE_AFTER_PERIOD=

This commit is contained in:
olli 2023-05-25 15:49:02 +02:00
parent 103487790d
commit b7009343e5

View File

@ -129,11 +129,13 @@ function check_sell_conditions_strategy {
# Sell if the last X time units is lower then FEE # Sell if the last X time units is lower then FEE
if [ $(cat ${f_TRADE_HIST_FILE_INTERIM} | wc -l) -ge ${SELL_IF_LOWER_THEN_FEE_AFTER_PERIOD} ] if [ $(cat ${f_TRADE_HIST_FILE_INTERIM} | wc -l) -ge ${SELL_IF_LOWER_THEN_FEE_AFTER_PERIOD} ]
then then
local f_BUY_PRICE_XND_LAST_RATE_DIFF=$(tail -n${SELL_IF_LOWER_THEN_FEE_AFTER_PERIOD} ${f_TRADE_HIST_FILE_INTERIM} | head -n1) #local f_BUY_PRICE_XND_LAST_RATE_DIFF=$(tail -n${SELL_IF_LOWER_THEN_FEE_AFTER_PERIOD} ${f_TRADE_HIST_FILE_INTERIM} | head -n1)
local f_diff_result=$(echo "${f_BUY_PRICE_LAST_RATE_DIFF} - (${f_BUY_PRICE_XND_LAST_RATE_DIFF})" | bc) #local f_diff_result=$(echo "${f_BUY_PRICE_LAST_RATE_DIFF} - (${f_BUY_PRICE_XND_LAST_RATE_DIFF})" | bc)
if [ $(echo "${f_diff_result} < ${FEE}" | bc -l) -ne 0 ] #if [ $(echo "${f_diff_result} < ${FEE}" | bc -l) -ne 0 ]
if [ $(echo "${f_BUY_PRICE_LAST_RATE_DIFF} < ${FEE}" | bc -l) -ne 0 ]
then then
f_SELL="Loss between last rate (${f_BUY_PRICE_LAST_RATE_DIFF}%) in ${SELL_IF_LOWER_THEN_FEE_AFTER_PERIOD} time units before more then ${FEE} (${f_diff_result}%)" #f_SELL="Loss between last rate (${f_BUY_PRICE_LAST_RATE_DIFF}%) in ${SELL_IF_LOWER_THEN_FEE_AFTER_PERIOD} time units before more then ${FEE} (${f_diff_result}%)"
f_SELL="Result (${f_BUY_PRICE_LAST_RATE_DIFF}%) in more then ${SELL_IF_LOWER_THEN_FEE_AFTER_PERIOD} is under ${FEE}"
fi fi
fi fi
fi fi