analyue to analyze.sh
This commit is contained in:
parent
f192786a1c
commit
cd93911ee1
@ -101,27 +101,34 @@ function analyze {
|
||||
g_num_valid_number "${f_market_performance}" >/dev/null 2>&1 || f_market_performance=0
|
||||
|
||||
f_verbose=">>${g_tmp}/output-${tmpfile} 2>/dev/null"
|
||||
[ "${ANALYZE_VERBOSE}" -eq "1" ] && f_verbose="| tee -a ${g_tmp}/output-${tmpfile}"
|
||||
[ "${ANALYZE_VERBOSE}" -eq "1" ] && f_verbose="2>&1 | tee -a ${g_tmp}/output-${tmpfile}"
|
||||
|
||||
if [ -n "${f_open_trade}" ]
|
||||
then
|
||||
# if [ "${ANALYZE_VERBOSE}" -eq "0" ]
|
||||
# then
|
||||
# check_sell_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile}
|
||||
# else
|
||||
# check_sell_conditions ${g_tmp}/${tmpfile} | #tee -a ${g_tmp}/output-${tmpfile}
|
||||
# fi
|
||||
# echo "INTERIM RESULT: ${f_real_result}%"
|
||||
eval check_sell_conditions ${g_tmp}/${tmpfile} ${f_verbose}
|
||||
echo "${f_real_result}" >>${g_tmp}/interim-${tmpfile}
|
||||
#eval echo "INTERIM RESULT: ${f_real_result}%" ${f_verbose}
|
||||
fi
|
||||
|
||||
if [ -n "${f_open_trade}" ]
|
||||
then
|
||||
if [ "${ANALYZE_VERBOSE}" -eq "0" ]
|
||||
then
|
||||
check_sell_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile}
|
||||
else
|
||||
check_sell_conditions ${g_tmp}/${tmpfile} #| tee -a ${g_tmp}/output-${tmpfile}
|
||||
fi
|
||||
echo "${result}" >>${g_tmp}/interim-${tmpfile}
|
||||
eval echo "INTERIM RESULT: ${f_result}%" ${f_verbose}
|
||||
else
|
||||
# if [ "${ANALYZE_VERBOSE}" -eq "0" ]
|
||||
# then
|
||||
# check_buy_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile}
|
||||
# else
|
||||
# check_buy_conditions ${g_tmp}/${tmpfile} #| tee -a ${g_tmp}/output-${tmpfile}
|
||||
# fi
|
||||
eval check_buy_conditions ${g_tmp}/${tmpfile} ${f_verbose}
|
||||
if [ "${ANALYZE_VERBOSE}" -eq "0" ]
|
||||
then
|
||||
check_buy_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile}
|
||||
else
|
||||
check_buy_conditions ${g_tmp}/${tmpfile} #| tee -a ${g_tmp}/output-${tmpfile}
|
||||
fi
|
||||
fi
|
||||
|
||||
#echo "BUY: ${f_BUY}"
|
||||
if [ -n "${f_BUY}" ]
|
||||
then
|
||||
eval echo "BUY: ${f_BUY}" ${f_verbose}
|
||||
@ -129,23 +136,20 @@ function analyze {
|
||||
BUY_PRICE=$f_price
|
||||
unset f_BUY
|
||||
fi
|
||||
|
||||
|
||||
if [ -n "${f_SELL}" ]
|
||||
then
|
||||
eval echo "SELL: ${f_date} ${f_SELL}" ${f_verbose}
|
||||
g_percentage-diff ${BUY_PRICE} ${f_price}
|
||||
g_calc "${g_percentage_diff_result}-${FEE}"
|
||||
result=${g_calc_result}
|
||||
eval echo "${result}" >>${g_tmp}/result-${tmpfile}
|
||||
echo "${f_real_result}" >>${g_tmp}/result-${tmpfile}
|
||||
rm -f "${f_TRADE_HIST_FILE}"
|
||||
rm -f "${f_TRADE_HIST_FILE_INTERIM}"
|
||||
#echo "RESULT: ${result}% (${BUY_PRICE} -> ${f_price})" >>${g_tmp}/output-${tmpfile}
|
||||
eval echo "RESULT: ${result}% ${BUY_PRICE} - ${f_price}" ${f_verbose}
|
||||
eval echo "RESULT: ${f_real_result}% ${BUY_PRICE} - ${f_price}" ${f_verbose}
|
||||
unset f_open_trade
|
||||
unset result
|
||||
unset f_real_result
|
||||
unset f_SELL
|
||||
fi
|
||||
|
||||
|
||||
## Chart Part
|
||||
#local f_intrade=0
|
||||
#local f_score=${f_buy_score}
|
||||
@ -173,16 +177,13 @@ function analyze {
|
||||
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
|
||||
g_percentage-diff ${BUY_PRICE} ${f_price}
|
||||
#result=$(g_percentage-diff ${BUY_PRICE} ${f_price})
|
||||
g_calc "${g_percentage_diff_result}-${FEE}"
|
||||
result=${g_calc_result}
|
||||
echo "$result" >>${g_tmp}/result-${tmpfile}
|
||||
echo "RESULT: ${result}% (${BUY_PRICE} -> ${f_price})" >>${g_tmp}/output-${tmpfile}
|
||||
#rm -f ${g_tmp}/open-${tmpfile}
|
||||
eval echo "SELL: ${f_date} ${f_SELL}" ${f_verbose}
|
||||
echo "${f_real_result}" >>${g_tmp}/result-${tmpfile}
|
||||
eval echo "RESULT: ${f_real_result}% ${BUY_PRICE} - ${f_price}" ${f_verbose}
|
||||
unset f_open_trade
|
||||
rm -f ${g_tmp}/interim-${tmpfile}
|
||||
unset result
|
||||
unset f_real_result
|
||||
unset f_SELL
|
||||
fi
|
||||
|
||||
complete_result=0
|
||||
@ -311,4 +312,3 @@ echo "
|
||||
Trades" >>analyze-${analyzedate}/overall-result.log
|
||||
egrep "BUY: |SELL: " analyze-${analyzedate}/analyze-overall.log >>analyze-${analyzedate}/overall-result.log
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user