Skip to content

Instantly share code, notes, and snippets.

@svanas
Last active April 16, 2021 20:26
Show Gist options
  • Save svanas/652b765076a42a3f3d6ba0fe72592592 to your computer and use it in GitHub Desktop.
Save svanas/652b765076a42a3f3d6ba0fe72592592 to your computer and use it in GitHub Desktop.
Use the Nefertiti crypto bot and trade on all the ETH-XXX market pairs with a single click.
# Trade on all the ETH-XXX market pairs.
# Written by Stefan van As <svanas AT runbox DOT com>
# Example: ./ETH-XXX.sh --exchange=Bittrex --price=0.05 --api-key=X --api-secret=X --pushover-app-key=X --pushover-user-key=X
for i in "$@"
do
case $i in
--exchange=*)
EXCHANGE="${i#*=}"
shift # past argument=value
;;
--price=*)
PRICE="${i#*=}"
shift # past argument=value
;;
--api-key=*)
API_KEY="${i#*=}"
shift # past argument=value
;;
--api-secret=*)
API_SECRET="${i#*=}"
shift # past argument=value
;;
--pushover-app-key=*)
PUSHOVER_APP_KEY="${i#*=}"
shift # past argument=value
;;
--pushover-user-key=*)
PUSHOVER_USER_KEY="${i#*=}"
shift # past argument=value
;;
*)
# unknown option
;;
esac
done
if [ -z ${EXCHANGE+x} ]; then
echo "missing argument: --exchange";
exit 1
fi
if [ -z ${PRICE+x} ]; then
echo "missing argument: --price";
exit 1
fi
if [ -z ${API_KEY+x} ]; then
echo "missing argument: --api-key";
exit 1
fi
if [ -z ${API_SECRET+x} ]; then
echo "missing argument: --api-secret";
exit 1
fi
if [ -z ${PUSHOVER_APP_KEY+x} ]; then
echo "missing argument: --pushover-app-key";
exit 1
fi
if [ -z ${PUSHOVER_USER_KEY+x} ]; then
echo "missing argument: --pushover-user-key";
exit 1
fi
MARKETS=$(./cryptotrader markets --exchange=$EXCHANGE)
if [ $? != 0 ]; then
echo $MARKETS
exit $?
fi
for MARKET in $(echo $MARKETS | jq -r '.[] | .name'); do
QUOTE=$(./cryptotrader quote --exchange=$EXCHANGE --market=$MARKET)
if [ $QUOTE == "ETH" ]; then
BASE=$(./cryptotrader base --exchange=$EXCHANGE --market=$MARKET)
osascript -e 'on run argv
tell application "Terminal"
activate
set ct to do script ("cd " & item 1 of argv)
delay 1
do script ("./cryptotrader buy" & " --exchange=" & item 2 of argv & " --market=" & item 3 of argv & " --api-key=" & item 4 of argv & " --api-secret=" & item 5 of argv & " --pushover-app-key=" & item 6 of argv & " --pushover-user-key=" & item 7 of argv & " --top=2 --repeat=1 --price=" & item 8 of argv) in ct
end tell
delay 30
end run' $PWD $EXCHANGE $MARKET $API_KEY $API_SECRET $PUSHOVER_APP_KEY $PUSHOVER_USER_KEY $PRICE
fi
done
@robertrade
Copy link

Nice script. Can be used for BTC-xxx too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment