use g_calc
This commit is contained in:
parent
07b278127d
commit
cc6fbc20f3
@ -19,14 +19,13 @@ function analyze {
|
||||
local file=$1
|
||||
tmpfile=$(basename "${file}")
|
||||
|
||||
. /etc/bash/gaboshlib/g_percentage-diff.bashfunc
|
||||
for bashfunc in $(find /etc/bash/gaboshlib -type f -name "g_*.bashfunc" -o -name "g_*.sh")
|
||||
do
|
||||
. "$bashfunc"
|
||||
done
|
||||
. dabo/functions/check_buy_conditions.sh
|
||||
. dabo/functions/check_sell_conditions.sh
|
||||
. dabo/functions/get_vars_from_csv.sh
|
||||
. dabo/functions/g_num_is_approx.sh
|
||||
. dabo/functions/g_num_is_between.sh
|
||||
. dabo/functions/g_num_is_higher.sh
|
||||
. dabo/functions/g_num_valid_number.sh
|
||||
. dabo/functions/score.sh
|
||||
. dabo/dabo-bot.conf
|
||||
. dabo-bot.conf
|
||||
@ -96,7 +95,7 @@ function analyze {
|
||||
if [ -s ${g_tmp}/interim-${tmpfile} ]
|
||||
then
|
||||
f_interim=$(tail -n1 ${g_tmp}/interim-${tmpfile})
|
||||
f_interim=$(echo "${f_interim}-${FEE}" | bc)
|
||||
f_interim=$(g_calc "${f_interim}-${FEE}")
|
||||
fi
|
||||
fi
|
||||
echo "$line,${f_market_performance},${f_score},${f_buy_score},${f_sell_score},${f_intrade},${f_interim}" >>analyze-${analyzedate}/chart-${tmpfile}
|
||||
@ -109,7 +108,7 @@ function analyze {
|
||||
f_SELL="SELL ${f_ASSET}: End of file/data"
|
||||
echo "SELL: $(tail -n1 ${g_tmp}/${tmpfile} | cut -d, -f1) === ${f_SELL}" >>${g_tmp}/output-${tmpfile} 2>&1
|
||||
result=$(g_percentage-diff ${BUY_PRICE} ${current})
|
||||
result=$(echo "${result}-${FEE}" | bc | sed 's/^\./0./; s/^-\./-0./')
|
||||
result=$(g_calc "${result}-${FEE}")
|
||||
echo "$result" >>${g_tmp}/result-${tmpfile}
|
||||
echo "RESULT: ${result}% (${BUY_PRICE} -> ${current})" >>${g_tmp}/output-${tmpfile}
|
||||
rm -f ${g_tmp}/open-${tmpfile}
|
||||
@ -119,7 +118,7 @@ function analyze {
|
||||
complete_result=0
|
||||
for result in $(cat ${g_tmp}/result-${tmpfile})
|
||||
do
|
||||
complete_result=$(echo "$complete_result+$result" | bc -l | sed 's/^\./0./; s/^-\./-0./' | xargs printf "%.2f")
|
||||
complete_result=$(g_calc "$complete_result+$result" | xargs printf "%.2f")
|
||||
done
|
||||
|
||||
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))
|
||||
|
Loading…
Reference in New Issue
Block a user