more pure bash to speed up things

This commit is contained in:
olli 2023-11-15 16:54:52 +01:00
parent 2476e2ee72
commit 7eeabb270f
2 changed files with 18 additions and 22 deletions

View File

@ -85,7 +85,6 @@ function analyze {
# get time from market_performance
local f_time="${f_date%:*}"
f_time="${f_time//[^0-9]/}"
echo "$f_time"
# get markel_performance from array with time
f_market_performance=${f_market_performace_array[${f_time}]}
@ -93,7 +92,6 @@ function analyze {
f_market_performance_before=${f_market_performance}
echo "MARKET_PERF=$f_market_performance"
#echo " ${f_line},${f_market_performance}" | perl -pe 's/([0-9].[0-9][0-9][0-9][0-9][0-9][0-9])[0-9]+/$1/g' | column -t -s, >>${g_tmp}/output-${tmpfile}
if [ -f "${g_tmp}/open-${tmpfile}" ]
then
if [ "${ANALYZE_VERBOSE}" -eq "0" ]
@ -112,24 +110,24 @@ function analyze {
check_buy_conditions ${g_tmp}/${tmpfile}
fi
fi
# Chart Part
local f_intrade=0
local f_score=${f_buy_score}
local f_interim="0"
[ -z "${f_buy_score}" ] && f_buy_score=0
if [ -z "${f_sell_score}" ]
then
f_sell_score=0
else
f_score=${f_sell_score}
f_intrade=1
if [ -s ${g_tmp}/interim-${tmpfile} ]
then
f_interim=$(tail -n1 ${g_tmp}/interim-${tmpfile})
f_interim=$(g_calc "${f_interim}-${FEE}")
fi
fi
echo "$f_line,${f_market_performance},${f_score},${f_buy_score},${f_sell_score},${f_intrade},${f_interim}" >>analyze-${analyzedate}/chart-${tmpfile}
## Chart Part
#local f_intrade=0
#local f_score=${f_buy_score}
#local f_interim="0"
#[ -z "${f_buy_score}" ] && f_buy_score=0
#if [ -z "${f_sell_score}" ]
#then
# f_sell_score=0
#else
# f_score=${f_sell_score}
# f_intrade=1
# if [ -s ${g_tmp}/interim-${tmpfile} ]
# then
# f_interim=$(tail -n1 ${g_tmp}/interim-${tmpfile})
# f_interim=$(g_calc "${f_interim}-${FEE}")
# fi
#fi
#echo "$f_line,${f_market_performance},${f_score},${f_buy_score},${f_sell_score},${f_intrade},${f_interim}" >>analyze-${analyzedate}/chart-${tmpfile}
# Chart Part End
done

View File

@ -17,8 +17,6 @@ function get_vars_from_csv {
if [ -z "${f_last_lines_array}" ]
then
mapfile -t f_last_lines_array <<< $(tail -n4 "${f_ASSET_HIST_FILE}")
else
echo "USING ARRAY"
fi
# if there are not four lines