diff --git a/dabo/dabo-bot.sh b/dabo/dabo-bot.sh index 1f90797..0a8f2d5 100755 --- a/dabo/dabo-bot.sh +++ b/dabo/dabo-bot.sh @@ -13,6 +13,8 @@ BASEPATH=/dabo/htdocs g_tries=3 g_tries_delay=5 +export csv_headline="Date and Time,Price,Price Change,EMA12,EMA26,MACD,EMA9 MACD (Signal),MACD Histogram,MACD Signal,RSI5,RSI14,RSI21,RSI720,RSI60,RSI120,RSI240,RSI420,Price Change 24h,Price Change 7d,Price Change 14d,Price Change 30d" + ### FUNCTIONS ### for bashfunc in $(find ${BASEPATH}/../functions -type f -name "*.sh") diff --git a/dabo/functions/check_buy_conditions.sh b/dabo/functions/check_buy_conditions.sh index bca461c..ec19607 100644 --- a/dabo/functions/check_buy_conditions.sh +++ b/dabo/functions/check_buy_conditions.sh @@ -127,8 +127,6 @@ function check_buy_conditions { fi fi - - ### Buy or not buy? # BOT if [ -n "$f_BUY" ] && [ -n "${BOT}" ] @@ -180,7 +178,9 @@ ${f_BUY}" # ANALYZE if [ -n "$f_BUY" ] && [ -z "${BOT}" ] then - echo "BUY: ${f_echo_prefix} All BUY conditions met!!! $f_BUY" + echo "BUY: ${f_echo_prefix} All BUY conditions met!!! +${csv_headline} +${f_BUY}" echo "$f_BUY" >${g_tmp}/open-${tmpfile} BUY_PRICE=$current fi diff --git a/dabo/functions/check_sell_conditions.sh b/dabo/functions/check_sell_conditions.sh index 4fde0e3..25aa103 100644 --- a/dabo/functions/check_sell_conditions.sh +++ b/dabo/functions/check_sell_conditions.sh @@ -144,7 +144,9 @@ function check_sell_conditions { # ANALYZE if [ -n "${f_SELL}" ] && [ -z "${BOT}" ] then - echo "SELL: $(tail -n1 ${f_ASSET_HIST_FILE} | cut -d, -f1) === $f_SELL" + echo "SELL: $(tail -n1 ${f_ASSET_HIST_FILE} | cut -d, -f1) === +${csv_headline} +$f_SELL" result=$(g_percentage-diff ${BUY_PRICE} ${current}) result=$(echo "${result}-${FEE}" | bc | sed 's/^\./0./; s/^-\./-0./') echo "${result}" >>${g_tmp}/result-${tmpfile} diff --git a/dabo/functions/get_asset.sh b/dabo/functions/get_asset.sh index e7133ca..242cb33 100644 --- a/dabo/functions/get_asset.sh +++ b/dabo/functions/get_asset.sh @@ -42,7 +42,10 @@ function get_asset { fi # headline - [ -s "${f_ASSET_HIST_FILE}" ] || echo 'Date and Time,Price,Price Change,EMA12,EMA26,MACD,EMA9 MACD (Signal),MACD Histogram,MACD Signal,RSI5,RSI14,RSI21,RSI720,RSI60,RSI120,RSI240,RSI420,Price Change 24h,Price Change 7d,Price Change 14d,Price Change 30d' >"${f_ASSET_HIST_FILE}" + + #[ -s "${f_ASSET_HIST_FILE}" ] || echo 'Date and Time,Price,Price Change,EMA12,EMA26,MACD,EMA9 MACD (Signal),MACD Histogram,MACD Signal,RSI5,RSI14,RSI21,RSI720,RSI60,RSI120,RSI240,RSI420,Price Change 24h,Price Change 7d,Price Change 14d,Price Change 30d' >"${f_ASSET_HIST_FILE}" + [ -s "${f_ASSET_HIST_FILE}" ] || echo "${csv_headline}" >"${f_ASSET_HIST_FILE}" + # date and price echo -n "${f_line}" >>${f_ASSET_HIST_FILE} diff --git a/dabo/functions/get_assets.sh b/dabo/functions/get_assets.sh index 455b6dc..5c7e738 100644 --- a/dabo/functions/get_assets.sh +++ b/dabo/functions/get_assets.sh @@ -82,7 +82,6 @@ function get_assets { #f_investedassets_regex=$(cat EXCHANGE_GET_BALANCES_CMD_OUT | cut -d, -f1 | perl -pe 's/^/\^/; s/\n/\|/' | perl -pe 's/\|$//') local f_ASSET - local f_parallel_arg echo -n "parallel -j3 bash -c --" >/tmp/parallel for f_ASSET in $(cat ASSETS | egrep -v "${BLACKLIST}") @@ -92,6 +91,7 @@ function get_assets { done export -f get_asset export f_timestamp + export csv_headline . /tmp/parallel # cleanup trashlines (possibly generated by kill further of this progress)