update script output
This commit is contained in:
parent
b65411cedf
commit
dce1494ec8
@ -2,36 +2,50 @@
|
||||
|
||||
HOUR=$(date +%H)
|
||||
IFS=";"
|
||||
while read DATE CURRENCY COIN PRICE FEE BUYRATE;
|
||||
while read DATE CURRENCY COIN PRICE FEE BUYRATE SELLTHRESH;
|
||||
do
|
||||
weeklyMax=$(rrdtool fetch rrd/crypto-${CURRENCY}.rrd AVERAGE --start -7d | grep -v -- '-nan' | sort -n -k 2 | tail -1 | awk '{print $2}' | sed 's/e+/ * 10^/g; s/e-/ * 10^-/g;' | bc -l)
|
||||
current=$(rrdtool fetch rrd/crypto-${CURRENCY}.rrd LAST --start -10m | grep -v -- '-nan' | tail -1 | awk '{print $2}' | sed 's/e+/ * 10^/g; s/e-/ * 10^-/g' | bc -l)
|
||||
curValue=$(echo "$COIN * $current - $FEE" | bc)
|
||||
curValue=$(echo "$COIN * $current - $FEE" | bc -l)
|
||||
curProfit=$(printf "%0.2f" $(echo "$curValue - $PRICE" | bc))
|
||||
maxDiff=$(echo "(($weeklyMax) - ($current)) / ($weeklyMax) * 100" | bc)
|
||||
profitPerc=$(printf "%0.2f" $(echo "$curProfit / $PRICE * 100" | bc -l))
|
||||
maxDiff=$(printf "%0.2f" $(echo "(($weeklyMax) - ($current)) / ($weeklyMax) * 100" | bc -l))
|
||||
|
||||
if [ "$CURRENCY" == "BTC" ] && [ "${current%%.*}" -lt "5000" ];
|
||||
if [ "$CURRENCY" == "BTC" ] && [ "${current%%.*}" -lt "7000" ];
|
||||
then
|
||||
echo "[$CURRENCY] low exchange rate: $current EUR/${CURRENCY}\n => Buy more?"
|
||||
continue;
|
||||
fi
|
||||
|
||||
if [ "${maxDiff%%.*}" -gt "10" ];
|
||||
then
|
||||
echo "[$CURRENCY] exchange rate dropps by more than 10% (max: $weeklyMax EUR/${CURRENCY}, cur: $current EUR/${CURRENCY})\n => Buy more?"
|
||||
echo "[$CURRENCY] low exchange rate: $current EUR/${CURRENCY} => Buy more?"
|
||||
continue;
|
||||
fi
|
||||
|
||||
if [ "0${maxDiff%%.*}" -gt "3" ];
|
||||
if [ "${profitPerc%%.*}" -ge "$SELLTHRESH" ];
|
||||
then
|
||||
echo "[$CURRENCY] prices dropping by more than 3% (max: $weeklyMax, cur: $current)"
|
||||
if [ "0$curProfit" -gt "0" ];
|
||||
then
|
||||
echo "[$CURRENCY] profit: $curProfit EUR\n => sell?"
|
||||
fi
|
||||
echo "[$CURRENCY] profit: ${profitPerc}% >= ${SELLTHRESH}% !!!!"
|
||||
echo "[$CURRENCY] profit: $curProfit EUR (${profitPerc}%)"
|
||||
echo "[$CURRENCY] maxDiff: ${maxDiff}%"
|
||||
echo
|
||||
continue
|
||||
fi
|
||||
|
||||
# if [ "0${maxDiff%%.*}" -ge "10" ];
|
||||
# then
|
||||
# echo "[$CURRENCY] exchange rate dropped ${maxDiff}% (max: $weeklyMax EUR/${CURRENCY}, cur: $current EUR/${CURRENCY}) => Buy more?"
|
||||
# continue;
|
||||
# fi
|
||||
#
|
||||
# if [ "0${maxDiff%%.*}" -gt "3" ];
|
||||
# then
|
||||
# echo "[$CURRENCY] prices dropped ${maxDiff}% (max: $weeklyMax EUR/${CURRENCY}, cur: $current EUR/${CURRENCY})"
|
||||
# if [ "0${profitPerc%%.*}" -ge "10" ];
|
||||
# then
|
||||
# echo "[$CURRENCY] profit: $curProfit EUR (${profitPerc}%) => sell?"
|
||||
# continue;
|
||||
# fi
|
||||
# fi
|
||||
|
||||
if [ "0$HOUR" -eq "6" ];
|
||||
then
|
||||
echo "[$CURRENCY] profit: $curProfit EUR"
|
||||
echo "[$CURRENCY] profit: $curProfit EUR (${profitPerc}%)"
|
||||
echo "[$CURRENCY] maxDiff: ${maxDiff}%"
|
||||
echo
|
||||
fi
|
||||
done < $1
|
||||
|
Loading…
x
Reference in New Issue
Block a user