csv headline in buy/sell message

This commit is contained in:
olli 2023-05-13 20:35:13 +02:00
parent 2bf22dfee8
commit 5fbce3269b
5 changed files with 13 additions and 6 deletions

View File

@ -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")

View File

@ -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

View File

@ -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}

View File

@ -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}

View File

@ -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)