fix on check for current data and sell if no current data exists

This commit is contained in:
olli 2023-06-19 12:07:21 +02:00
parent 6529e87ea0
commit 9615dd58d9
2 changed files with 5 additions and 3 deletions

View File

@ -30,7 +30,7 @@ function check_for_buy {
if [ $(tail -n 155 "$f_ASSET_HIST_FILE" | egrep -v ",,|,$" | wc -l) -ge 150 ] if [ $(tail -n 155 "$f_ASSET_HIST_FILE" | egrep -v ",,|,$" | wc -l) -ge 150 ]
then then
if tail -n1 $f_ASSET_HIST_FILE | grep -q "^$(date +%Y-%m-%d)" if tail -n1 $f_ASSET_HIST_FILE | egrep -q "^$(date +%Y-%m-%d)|$(date +%Y-%m-%d -d yesterday)"
then then
g_echo_note "BUY $f_ASSET_HIST_FILE checking conditions" g_echo_note "BUY $f_ASSET_HIST_FILE checking conditions"
check_buy_conditions "${f_ASSET_HIST_FILE}" "${f_strategy}" check_buy_conditions "${f_ASSET_HIST_FILE}" "${f_strategy}"

View File

@ -18,7 +18,7 @@ function check_for_sell {
if [ $(echo "${f_COMPLETE_BALANCE} < ${EMERGENCY_STOP}" | bc -l) -ne 0 ] if [ $(echo "${f_COMPLETE_BALANCE} < ${EMERGENCY_STOP}" | bc -l) -ne 0 ]
then then
local f_msg="ATTENTION! EMERGENCY STOP DUE TO POOR PERFORMANCE: BALANCE (${f_COMPLETE_BALANCE}) LOWER THEN EMERGENCY_STOP-VALUE (${EMERGENCY_STOP})" local f_msg="ATTENTION! EMERGENCY STOP DUE TO POOR PERFORMANCE: BALANCE (${f_COMPLETE_BALANCE}) LOWER THEN EMERGENCY_STOP-VALUE (${EMERGENCY_STOP})"
g_echo_error "$f_msg" g_echo_error "${f_msg}"
do_trade ${f_ASSET} ${CURRENCY} ${f_QUANTITY_CURRENCY} sell "${f_msg}" do_trade ${f_ASSET} ${CURRENCY} ${f_QUANTITY_CURRENCY} sell "${f_msg}"
continue continue
fi fi
@ -26,7 +26,9 @@ function check_for_sell {
then then
check_sell_conditions "${f_ASSET_HIST_FILE}" "${f_strategy}" check_sell_conditions "${f_ASSET_HIST_FILE}" "${f_strategy}"
else else
g_echo_warn "SELL $f_ASSET_HIST_FILE no current data of invested asset" local f_msg="SELL $f_ASSET_HIST_FILE no current data of invested asset"
g_echo_warn "${f_msg}"
do_trade ${f_ASSET} ${CURRENCY} ${f_QUANTITY_CURRENCY} sell "${f_msg}"
fi fi
done done
} }