more pure bash to speed up things
This commit is contained in:
parent
7eeabb270f
commit
839680820e
@ -46,7 +46,7 @@ function analyze {
|
||||
>${g_tmp}/${tmpfile}
|
||||
>${g_tmp}/result-${tmpfile}
|
||||
|
||||
rm -rf ${g_tmp}/open-${tmpfile}
|
||||
#rm -rf ${g_tmp}/open-${tmpfile}
|
||||
rm -rf ${g_tmp}/interim-${tmpfile}
|
||||
rm -rf ${g_tmp}/output-${tmpfile}
|
||||
|
||||
@ -92,47 +92,50 @@ function analyze {
|
||||
f_market_performance_before=${f_market_performance}
|
||||
echo "MARKET_PERF=$f_market_performance"
|
||||
|
||||
if [ -f "${g_tmp}/open-${tmpfile}" ]
|
||||
#if [ -f "${g_tmp}/open-${tmpfile}" ]
|
||||
if [ -n "${f_open_trade}" ]
|
||||
then
|
||||
if [ "${ANALYZE_VERBOSE}" -eq "0" ]
|
||||
then
|
||||
check_sell_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile}
|
||||
else
|
||||
# if [ "${ANALYZE_VERBOSE}" -eq "0" ]
|
||||
# then
|
||||
# check_sell_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile}
|
||||
# else
|
||||
check_sell_conditions ${g_tmp}/${tmpfile}
|
||||
fi
|
||||
fi
|
||||
if ! [ -f "${g_tmp}/open-${tmpfile}" ]
|
||||
then
|
||||
if [ "${ANALYZE_VERBOSE}" -eq "0" ]
|
||||
then
|
||||
check_buy_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile}
|
||||
else
|
||||
# fi
|
||||
# fi
|
||||
# if ! [ -f "${g_tmp}/open-${tmpfile}" ]
|
||||
else
|
||||
# then
|
||||
# if [ "${ANALYZE_VERBOSE}" -eq "0" ]
|
||||
# then
|
||||
# check_buy_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile}
|
||||
# else
|
||||
check_buy_conditions ${g_tmp}/${tmpfile}
|
||||
fi
|
||||
# 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 End
|
||||
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
|
||||
|
||||
# sell at the end to have a final result.
|
||||
if [ -f ${g_tmp}/open-${tmpfile} ]
|
||||
#if [ -f ${g_tmp}/open-${tmpfile} ]
|
||||
if [ -n "${f_open_trade}" ]
|
||||
then
|
||||
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
|
||||
@ -140,7 +143,8 @@ function analyze {
|
||||
result=$(g_calc "${result}-${FEE}")
|
||||
echo "$result" >>${g_tmp}/result-${tmpfile}
|
||||
echo "RESULT: ${result}% (${BUY_PRICE} -> ${f_price})" >>${g_tmp}/output-${tmpfile}
|
||||
rm -f ${g_tmp}/open-${tmpfile}
|
||||
#rm -f ${g_tmp}/open-${tmpfile}
|
||||
unset f_open_trade
|
||||
rm -f ${g_tmp}/interim-${tmpfile}
|
||||
fi
|
||||
|
||||
|
@ -97,7 +97,8 @@ function check_buy_conditions {
|
||||
echo "BUY: ${f_BUY}"
|
||||
#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,
|
||||
echo "${f_echo_prefix}${f_BUY}" >${g_tmp}/open-${tmpfile}
|
||||
f_open_trade=1
|
||||
#echo "${f_echo_prefix}${f_BUY}" >${g_tmp}/open-${tmpfile}
|
||||
BUY_PRICE=$f_price
|
||||
f_BUY=""
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user