analyue to analyze.sh

This commit is contained in:
olli 2023-11-29 09:16:13 +01:00
parent a37646b353
commit 4488928cc4
2 changed files with 22 additions and 18 deletions

View File

@ -100,28 +100,31 @@ function analyze {
f_market_performance_before=${f_market_performance} f_market_performance_before=${f_market_performance}
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}"
[ "${ANALYZE_VERBOSE}" -eq "0" ] && f_verbose="| tee -a ${g_tmp}/output-${tmpfile}"
if [ -n "${f_open_trade}" ] if [ -n "${f_open_trade}" ]
then then
if [ "${ANALYZE_VERBOSE}" -eq "0" ] # if [ "${ANALYZE_VERBOSE}" -eq "0" ]
then # then
check_sell_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile} # check_sell_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile}
else # else
check_sell_conditions ${g_tmp}/${tmpfile} #| tee -a ${g_tmp}/output-${tmpfile} # check_sell_conditions ${g_tmp}/${tmpfile} | #tee -a ${g_tmp}/output-${tmpfile}
fi # fi
echo "INTERIM RESULT: ${f_real_result}%" # echo "INTERIM RESULT: ${f_real_result}%"
check_sell_conditions ${g_tmp}/${tmpfile} ${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
check_buy_conditions ${g_tmp}/${tmpfile} ${f_verbose}
fi fi
if [ -n "${f_BUY}" ] if [ -n "${f_BUY}" ]
then then
echo "BUY: ${f_BUY}" echo "BUY: ${f_BUY}" ${f_verbose}
f_open_trade=1 f_open_trade=1
BUY_PRICE=$f_price BUY_PRICE=$f_price
unset f_BUY unset f_BUY
@ -129,14 +132,15 @@ function analyze {
if [ -n "${f_SELL}" ] if [ -n "${f_SELL}" ]
then then
echo "SELL: ${f_date} ${f_SELL}" echo "SELL: ${f_date} ${f_SELL}" ${f_verbose}
g_percentage-diff ${BUY_PRICE} ${f_price} g_percentage-diff ${BUY_PRICE} ${f_price}
g_calc "${g_percentage_diff_result}-${FEE}" g_calc "${g_percentage_diff_result}-${FEE}"
result=${g_calc_result} result=${g_calc_result}
echo "${result}" >>${g_tmp}/result-${tmpfile} 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} #echo "RESULT: ${result}% (${BUY_PRICE} -> ${f_price})" >>${g_tmp}/output-${tmpfile}
echo "RESULT: ${result}% (${BUY_PRICE} -> ${f_price})" ${verbose}
unset f_open_trade unset f_open_trade
unset f_SELL unset f_SELL
fi fi

View File

@ -47,7 +47,7 @@ function check_sell_conditions {
# store new interim result # store new interim result
echo ${f_BUY_PRICE_LAST_RATE_DIFF} >>${f_TRADE_HIST_FILE_INTERIM} echo ${f_result} >>${f_TRADE_HIST_FILE_INTERIM}
# run strategies # run strategies
# f_strategy_path=../../strategies # f_strategy_path=../../strategies