better analyze.sh output

This commit is contained in:
olli 2023-05-24 22:19:40 +02:00
parent a02b1ac350
commit 3d31a953f4
3 changed files with 7 additions and 4 deletions

View File

@ -84,10 +84,13 @@ function analyze {
do do
complete_result=$(echo "$complete_result+$result" | bc -l | sed 's/^\./0./; s/^-\./-0./' | xargs printf "%.2f") complete_result=$(echo "$complete_result+$result" | bc -l | sed 's/^\./0./; s/^-\./-0./' | xargs printf "%.2f")
done 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 "=====================================" >>${g_tmp}/output-${tmpfile}
echo "${complete_result}" >>${g_tmp}/overall-result-${tmpfile} echo "${complete_result}" >>${g_tmp}/overall-result-${tmpfile}
cat ${g_tmp}/output-${tmpfile} >"analyze-${analyzedate}/${tmpfile}.log" cat ${g_tmp}/output-${tmpfile} >"analyze-${analyzedate}/${tmpfile}.log"
} }

View File

@ -96,7 +96,7 @@ ${f_BUY}"
then then
echo "BUY: ${f_echo_prefix}${f_BUY}" echo "BUY: ${f_echo_prefix}${f_BUY}"
echo "${csv_headline},Marketperformance 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} echo "$f_BUY" >${g_tmp}/open-${tmpfile}
BUY_PRICE=$current BUY_PRICE=$current
f_BUY="" f_BUY=""

View File

@ -78,7 +78,7 @@ function check_sell_conditions {
then then
echo "SELL: $(tail -n1 ${f_ASSET_HIST_FILE} | cut -d, -f1)" echo "SELL: $(tail -n1 ${f_ASSET_HIST_FILE} | cut -d, -f1)"
echo "${csv_headline},Marketperformace 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}" echo "${f_SELL}"
result=$(g_percentage-diff ${BUY_PRICE} ${current}) result=$(g_percentage-diff ${BUY_PRICE} ${current})
result=$(echo "${result}-${FEE}" | bc | sed 's/^\./0./; s/^-\./-0./') result=$(echo "${result}-${FEE}" | bc | sed 's/^\./0./; s/^-\./-0./')