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