diff --git a/dabo/analyze.sh b/dabo/analyze.sh index 2f376b2..ee73a96 100755 --- a/dabo/analyze.sh +++ b/dabo/analyze.sh @@ -73,6 +73,10 @@ function analyze { local f_chart_array mapfile -t f_lines <<<$(egrep "^${ANALYZE_TIME}" "$file" | grep -v ',,') local f_line + unset f_last_lines_array + + f_verbose=">>${g_tmp}/output-${tmpfile} 2>/dev/null" + [ "${ANALYZE_VERBOSE}" -eq "1" ] && f_verbose="2>&1 | tee -a ${g_tmp}/output-${tmpfile}" for f_line in "${f_lines[@]}" do @@ -100,15 +104,6 @@ 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} 2>/dev/null" - [ "${ANALYZE_VERBOSE}" -eq "1" ] && f_verbose="2>&1 | tee -a ${g_tmp}/output-${tmpfile}" - - if [ -n "${f_open_trade}" ] - then - echo "${f_real_result}" >>${g_tmp}/interim-${tmpfile} - #eval echo "INTERIM RESULT: ${f_real_result}%" ${f_verbose} - fi - if [ -n "${f_open_trade}" ] then if [ "${ANALYZE_VERBOSE}" -eq "0" ] @@ -117,7 +112,7 @@ function analyze { else check_sell_conditions ${g_tmp}/${tmpfile} #| tee -a ${g_tmp}/output-${tmpfile} fi - echo "${result}" >>${g_tmp}/interim-${tmpfile} + echo "${f_result}" >>${g_tmp}/interim-${tmpfile} eval echo "INTERIM RESULT: ${f_result}%" ${f_verbose} else if [ "${ANALYZE_VERBOSE}" -eq "0" ] @@ -145,8 +140,6 @@ function analyze { rm -f "${f_TRADE_HIST_FILE_INTERIM}" eval echo "RESULT: ${f_real_result}% ${BUY_PRICE} - ${f_price}" ${f_verbose} unset f_open_trade - unset result - unset f_real_result unset f_SELL fi @@ -181,8 +174,6 @@ function analyze { echo "${f_real_result}" >>${g_tmp}/result-${tmpfile} eval echo "RESULT: ${f_real_result}% ${BUY_PRICE} - ${f_price}" ${f_verbose} unset f_open_trade - unset result - unset f_real_result unset f_SELL fi @@ -202,6 +193,8 @@ function analyze { cat ${g_tmp}/output-${tmpfile} >"analyze-${analyzedate}/${tmpfile}.log" + rm ${g_tmp}/output-${tmpfile} + rm ${g_tmp}/result-${tmpfile} ## Chart Part # if [ -s "analyze-${analyzedate}/chart-${tmpfile}" ]