more pure bash to speed up things
This commit is contained in:
parent
d7e4231f76
commit
af22be8875
@ -23,7 +23,6 @@ function analyze {
|
|||||||
local file=$1
|
local file=$1
|
||||||
tmpfile=$(basename "${file}")
|
tmpfile=$(basename "${file}")
|
||||||
|
|
||||||
|
|
||||||
. /etc/bash/gaboshlib.include
|
. /etc/bash/gaboshlib.include
|
||||||
g_tmp="$2"
|
g_tmp="$2"
|
||||||
#for bashfunc in $(find /etc/bash/gaboshlib -type f -name "g_*.bashfunc" -o -name "g_*.sh")
|
#for bashfunc in $(find /etc/bash/gaboshlib -type f -name "g_*.bashfunc" -o -name "g_*.sh")
|
||||||
@ -58,7 +57,15 @@ function analyze {
|
|||||||
echo "$(head -n1 ${file}),Market Perrormance,Score,Buy Score,Sell Score,InTrade,Inetrim Result" >analyze-${analyzedate}/chart-${tmpfile}
|
echo "$(head -n1 ${file}),Market Perrormance,Score,Buy Score,Sell Score,InTrade,Inetrim Result" >analyze-${analyzedate}/chart-${tmpfile}
|
||||||
# Chart Part End
|
# Chart Part End
|
||||||
|
|
||||||
#for line in $(egrep "^${ANALYZE_TIME}" "$file" | grep -v ',,')
|
# create market performance array of timeframe
|
||||||
|
for f_market_perf_line in $(cat data/botdata/MARKET_PERFORMANCE.csv | cut -d, -f1,2 | sed 's/:[0-9][0-9],/,/; s/ /-/g; s/:/-/g')
|
||||||
|
do
|
||||||
|
f_market_perf_date=${f_market_perf_line%,*}
|
||||||
|
f_market_perf_date=${f_market_perf_date//[^0-9]/}
|
||||||
|
f_market_perf=${f_market_perf_line#*,}
|
||||||
|
f_market_performace_array[${f_market_perf_date}]=${f_market_perf}
|
||||||
|
done
|
||||||
|
|
||||||
local f_lines
|
local f_lines
|
||||||
mapfile -t f_lines <<<$(egrep "^${ANALYZE_TIME}" "$file" | grep -v ',,')
|
mapfile -t f_lines <<<$(egrep "^${ANALYZE_TIME}" "$file" | grep -v ',,')
|
||||||
for line in "${f_lines[@]}"
|
for line in "${f_lines[@]}"
|
||||||
@ -67,7 +74,10 @@ function analyze {
|
|||||||
f_buy_score=""
|
f_buy_score=""
|
||||||
|
|
||||||
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/ *//')
|
||||||
|
time=${time//[^0-9]/}
|
||||||
|
f_market_performance=${f_market_performace_array[${time}]}
|
||||||
|
|
||||||
echo "$line" >>${g_tmp}/${tmpfile}
|
echo "$line" >>${g_tmp}/${tmpfile}
|
||||||
#echo " ${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}
|
#echo " ${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}" ]
|
if [ -f "${g_tmp}/open-${tmpfile}" ]
|
||||||
@ -114,11 +124,9 @@ function analyze {
|
|||||||
then
|
then
|
||||||
f_SELL="SELL ${f_ASSET}: End of file/data"
|
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
|
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=$(g_percentage-diff ${BUY_PRICE} ${f_price})
|
result=$(g_percentage-diff ${BUY_PRICE} ${f_price})
|
||||||
result=$(g_calc "${result}-${FEE}")
|
result=$(g_calc "${result}-${FEE}")
|
||||||
echo "$result" >>${g_tmp}/result-${tmpfile}
|
echo "$result" >>${g_tmp}/result-${tmpfile}
|
||||||
#echo "RESULT: ${result}% (${BUY_PRICE} -> ${current})" >>${g_tmp}/output-${tmpfile}
|
|
||||||
echo "RESULT: ${result}% (${BUY_PRICE} -> ${f_price})" >>${g_tmp}/output-${tmpfile}
|
echo "RESULT: ${result}% (${BUY_PRICE} -> ${f_price})" >>${g_tmp}/output-${tmpfile}
|
||||||
rm -f ${g_tmp}/open-${tmpfile}
|
rm -f ${g_tmp}/open-${tmpfile}
|
||||||
rm -f ${g_tmp}/interim-${tmpfile}
|
rm -f ${g_tmp}/interim-${tmpfile}
|
||||||
|
Loading…
Reference in New Issue
Block a user