diff --git a/dabo/analyze.sh b/dabo/analyze.sh index 069ba0a..c40b458 100755 --- a/dabo/analyze.sh +++ b/dabo/analyze.sh @@ -84,10 +84,13 @@ function analyze { do complete_result=$(echo "$complete_result+$result" | bc -l | sed 's/^\./0./; s/^-\./-0./' | xargs printf "%.2f") done - echo "COMPLETE RESULT $file analyze-${analyzedate}/${tmpfile}.log: ${complete_result}%" | tee -a ${g_tmp}/output-${tmpfile} + + hodlresult=$(g_percentage-diff $(egrep "^${ANALYZE_TIME}" "$file" | grep -v ',,' | head -n1 | cut -d, -f2) $(egrep "^${ANALYZE_TIME}" "$file" | grep -v ',,' | tail -n1 | cut -d, -f2)) + + echo "COMPLETE RESULT $file analyze-${analyzedate}/${tmpfile}.log: ${complete_result}% (HODL: ${hodlresult})" | tee -a ${g_tmp}/output-${tmpfile} echo "=====================================" >>${g_tmp}/output-${tmpfile} echo "${complete_result}" >>${g_tmp}/overall-result-${tmpfile} - + cat ${g_tmp}/output-${tmpfile} >"analyze-${analyzedate}/${tmpfile}.log" } diff --git a/dabo/functions/check_buy_conditions.sh b/dabo/functions/check_buy_conditions.sh index ddf4fc7..dc0f1e2 100644 --- a/dabo/functions/check_buy_conditions.sh +++ b/dabo/functions/check_buy_conditions.sh @@ -96,7 +96,7 @@ ${f_BUY}" then echo "BUY: ${f_echo_prefix}${f_BUY}" echo "${csv_headline},Marketperformance -${f_last_line}" | cut -d, -f 2-22 | perl -pe 's/((?<=,)|(?<=^)),/ ,/g;' | column -t -s, +${f_last_line}" | cut -d, -f 2-22 | perl -pe 's/([0-9].[0-9][0-9][0-9][0-9][0-9][0-9])[0-9]+/$1/g' | perl -pe 's/((?<=,)|(?<=^)),/ ,/g;' | column -t -s, echo "$f_BUY" >${g_tmp}/open-${tmpfile} BUY_PRICE=$current f_BUY="" diff --git a/dabo/functions/check_sell_conditions.sh b/dabo/functions/check_sell_conditions.sh index b4e22ac..2212c5b 100644 --- a/dabo/functions/check_sell_conditions.sh +++ b/dabo/functions/check_sell_conditions.sh @@ -78,7 +78,7 @@ function check_sell_conditions { then echo "SELL: $(tail -n1 ${f_ASSET_HIST_FILE} | cut -d, -f1)" echo "${csv_headline},Marketperformace -${f_last_line}" | cut -d, -f 2-222 | perl -pe 's/((?<=,)|(?<=^)),/ ,/g;' | column -t -s, +${f_last_line}" | cut -d, -f 2-22 | perl -pe 's/([0-9].[0-9][0-9][0-9][0-9][0-9][0-9])[0-9]+/$1/g' | perl -pe 's/((?<=,)|(?<=^)),/ ,/g;' | column -t -s, echo "${f_SELL}" result=$(g_percentage-diff ${BUY_PRICE} ${current}) result=$(echo "${result}-${FEE}" | bc | sed 's/^\./0./; s/^-\./-0./')