Skip to content

Instantly share code, notes, and snippets.

@svanas
Last active January 20, 2022 09:47
Embed
What would you like to do?
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-2.sh --exchange=Bittrex --price=0.05 --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
;;
--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 ${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
SYMBOLS=""
for MARKET in $(echo $MARKETS | jq -r '.[] | .name'); do
QUOTE=$(./cryptotrader quote --exchange=$EXCHANGE --market=$MARKET)
if [ $QUOTE == "ETH" ]; then
if [[ $SYMBOLS != "" ]]; then
SYMBOLS+=,
fi
SYMBOLS+=$MARKET
fi
done
osascript -e 'on run argv
tell application "Terminal"
activate
set ct to do script ("cd " & item 1 of argv)
delay 1
do script ("./nefertiti buy" & " --exchange=" & item 2 of argv & " --market=" & item 3 of argv & " --price=" & item 4 of argv & " --pushover-app-key=" & item 5 of argv & " --pushover-user-key=" & item 6 of argv & " --dca --repeat=2") in ct
end tell
end run' $PWD $EXCHANGE $SYMBOLS $PRICE $PUSHOVER_APP_KEY $PUSHOVER_USER_KEY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment