GUNBOT: The automatic profit generator > Beginners & Help

[LINUX] Stop after sell script

(1/1)

AlfonseX:
Hello all.

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


--- Code: ---#!/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
--- End code ---

How to:
- save this script in GB folder, name it eg stop_after_sell.sh
- make it executable

--- Code: ---chmod u+x stop_after_sell.sh
--- End code ---

- launch it eg for BTC_ETH on poloniex

--- Code: ---./stop_after_sell.sh BTC_ETC poloniex &
--- End code ---

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.

Rakeau:
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.

Navigation

[0] Message Index

Go to full version