analyze.sh csv output

This commit is contained in:
olli 2023-06-01 12:55:30 +02:00
parent 191b90a694
commit 95f8fa8e5e
3 changed files with 6 additions and 4 deletions

View File

@ -46,6 +46,8 @@ function analyze {
time=$(echo $line | cut -d, -f1 | cut -d: -f1,2) time=$(echo $line | cut -d, -f1 | cut -d: -f1,2)
f_market_performance=$(grep "^$time" data/botdata/MARKET_PERFORMANCE | tail -n1 | cut -d: -f4 | cut -d"%" -f1 | sed 's/ *//') f_market_performance=$(grep "^$time" data/botdata/MARKET_PERFORMANCE | tail -n1 | cut -d: -f4 | cut -d"%" -f1 | sed 's/ *//')
echo "$line" >>${g_tmp}/${tmpfile} echo "$line" >>${g_tmp}/${tmpfile}
echo "${csv_headline},Marketperformance
${line},${f_market_performance}" | 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, >>${g_tmp}/output-${tmpfile}
if [ -f "${g_tmp}/open-${tmpfile}" ] if [ -f "${g_tmp}/open-${tmpfile}" ]
then then
if [ "${ANALYZE_VERBOSE}" -eq "0" ] if [ "${ANALYZE_VERBOSE}" -eq "0" ]

View File

@ -95,8 +95,8 @@ ${f_BUY}"
if [ -n "$f_BUY" ] && [ -z "${BOT}" ] if [ -n "$f_BUY" ] && [ -z "${BOT}" ]
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/([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, #${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

@ -81,8 +81,8 @@ function check_sell_conditions {
if [ -n "${f_SELL}" ] && [ -z "${BOT}" ] if [ -n "${f_SELL}" ] && [ -z "${BOT}" ]
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-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, #${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./')