Gunthy

GUNBOT: The automatic profit generator => Beginners & Help => Topic started by: AlfonseX on June 27, 2017, 02:01:33 PM

Title: [LINUX] Stop after sell script
Post by: AlfonseX on June 27, 2017, 02:01:33 PM
Hello all.

I made a little script to stop pairs I don't want to run anymore.

Code: [Select]
#!/bin/env bash
# usage stop_after_sell.sh pair market &

pair="$1"
market="$2"

pid_of=$(pgrep -a gunthy | grep "$pair $market" | cut -d' ' -f1)

while :; do
    if tail -n1  "${market}-${pair}-trades.txt" | grep sell; then
        kill -s SIGKILL "$pid_of"
        break
    else
        sleep 120
    fi
done

[ ! -f stop_after_sell.txt ] && touch stop_after_sell.txt
echo "$(date) $pair $market" >> stop_after_sell.txt

How to:
- save this script in GB folder, name it eg stop_after_sell.sh
- make it executable
Code: [Select]
chmod u+x stop_after_sell.sh
- launch it eg for BTC_ETH on poloniex
Code: [Select]
./stop_after_sell.sh BTC_ETC poloniex &
Note that ampersand is important.
When a sell happens this script kill GB running pair and track its work in stop_after_sell.txt. So you can watch what it will kill.

Beware of that this script isn't bullet proof it's made with "LA R.A.C.H.E : Rapid Application Conception and Heuristic Extreme-programming" ;).
Be warn and enjoy.
Title: Re: [LINUX] Stop after sell script
Post by: Rakeau on June 29, 2017, 10:41:34 AM
Nice. I did think that Gunbot should have a built-in way to stop a bot after it completes a sale, a "graceful" stop if you will.