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}
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}" ]
then
if [ "${ANALYZE_VERBOSE}" -eq "0" ]
then
check_sell_conditions ${g_tmp}/${tmpfile} >>${g_tmp}/output-${tmpfile}
# 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}%"
check_sell_conditions ${g_tmp}/${tmpfile} ${f_verbose}
else
check_sell_conditions ${g_tmp}/${tmpfile} #| tee -a ${g_tmp}/output-${tmpfile}
fi
echo "INTERIM RESULT: ${f_real_result}%"
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
# 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
check_buy_conditions ${g_tmp}/${tmpfile} ${f_verbose}
fi
if [ -n "${f_BUY}" ]
then
echo "BUY: ${f_BUY}"
echo "BUY: ${f_BUY}" ${f_verbose}
f_open_trade=1
BUY_PRICE=$f_price
unset f_BUY
@ -129,14 +132,15 @@ function analyze {
if [ -n "${f_SELL}" ]
then
echo "SELL: ${f_date} ${f_SELL}"
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}
echo "${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}
#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_SELL
fi

View File

@ -47,7 +47,7 @@ function check_sell_conditions {
# 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
# f_strategy_path=../../strategies