From 4488928cc422a9382dd6a44828ee9a88a2e648f3 Mon Sep 17 00:00:00 2001 From: olli Date: Wed, 29 Nov 2023 09:16:13 +0100 Subject: [PATCH] analyue to analyze.sh --- dabo/analyze.sh | 38 ++++++++++++++----------- dabo/functions/check_sell_conditions.sh | 2 +- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/dabo/analyze.sh b/dabo/analyze.sh index dc77ffd..bdd0ec9 100755 --- a/dabo/analyze.sh +++ b/dabo/analyze.sh @@ -100,28 +100,31 @@ function analyze { f_market_performance_before=${f_market_performance} g_num_valid_number "${f_market_performance}" >/dev/null 2>&1 || f_market_performance=0 - + f_verbose=">>${g_tmp}/output-${tmpfile}" + [ "${ANALYZE_VERBOSE}" -eq "0" ] && f_verbose="| tee -a ${g_tmp}/output-${tmpfile}" if [ -n "${f_open_trade}" ] then - if [ "${ANALYZE_VERBOSE}" -eq "0" ] - then - check_sell_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile} - else - check_sell_conditions ${g_tmp}/${tmpfile} #| tee -a ${g_tmp}/output-${tmpfile} - fi - echo "INTERIM RESULT: ${f_real_result}%" +# if [ "${ANALYZE_VERBOSE}" -eq "0" ] +# then +# check_sell_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile} +# else +# check_sell_conditions ${g_tmp}/${tmpfile} | #tee -a ${g_tmp}/output-${tmpfile} +# fi +# echo "INTERIM RESULT: ${f_real_result}%" + check_sell_conditions ${g_tmp}/${tmpfile} ${f_verbose} else - if [ "${ANALYZE_VERBOSE}" -eq "0" ] - then - check_buy_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile} - else - check_buy_conditions ${g_tmp}/${tmpfile} #| tee -a ${g_tmp}/output-${tmpfile} - fi +# if [ "${ANALYZE_VERBOSE}" -eq "0" ] +# then +# check_buy_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile} +# else +# check_buy_conditions ${g_tmp}/${tmpfile} #| tee -a ${g_tmp}/output-${tmpfile} +# fi + check_buy_conditions ${g_tmp}/${tmpfile} ${f_verbose} fi if [ -n "${f_BUY}" ] then - echo "BUY: ${f_BUY}" + echo "BUY: ${f_BUY}" ${f_verbose} f_open_trade=1 BUY_PRICE=$f_price unset f_BUY @@ -129,14 +132,15 @@ function analyze { if [ -n "${f_SELL}" ] then - echo "SELL: ${f_date} ${f_SELL}" + echo "SELL: ${f_date} ${f_SELL}" ${f_verbose} g_percentage-diff ${BUY_PRICE} ${f_price} g_calc "${g_percentage_diff_result}-${FEE}" result=${g_calc_result} echo "${result}" >>${g_tmp}/result-${tmpfile} rm -f "${f_TRADE_HIST_FILE}" rm -f "${f_TRADE_HIST_FILE_INTERIM}" - echo "RESULT: ${result}% (${BUY_PRICE} -> ${f_price})" >>${g_tmp}/output-${tmpfile} + #echo "RESULT: ${result}% (${BUY_PRICE} -> ${f_price})" >>${g_tmp}/output-${tmpfile} + echo "RESULT: ${result}% (${BUY_PRICE} -> ${f_price})" ${verbose} unset f_open_trade unset f_SELL fi diff --git a/dabo/functions/check_sell_conditions.sh b/dabo/functions/check_sell_conditions.sh index 2b705d5..e5ff25e 100644 --- a/dabo/functions/check_sell_conditions.sh +++ b/dabo/functions/check_sell_conditions.sh @@ -47,7 +47,7 @@ function check_sell_conditions { # store new interim result - echo ${f_BUY_PRICE_LAST_RATE_DIFF} >>${f_TRADE_HIST_FILE_INTERIM} + echo ${f_result} >>${f_TRADE_HIST_FILE_INTERIM} # run strategies # f_strategy_path=../../strategies