crank.sh logs now to a logfile

This commit is contained in:
Maximilian Schneider 2021-04-28 17:08:55 +00:00
parent b68840c194
commit ffa4b39091
1 changed files with 16 additions and 2 deletions

18
crank.sh Normal file → Executable file
View File

@ -4,6 +4,7 @@ source ~/mango/cli/devnet.env $KEYPAIR
DEX_PROGRAM_ID=$(cat $IDS_PATH | jq .devnet.dex_program_id -r)
MARKET_STR="${2^^}/${3^^}"
LOG_FILE="${2^^}-${3^^}.log"
if [ $MARKET_STR = "BTC/USDT" ]; then
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["BTC/USDT"]' -r)
@ -13,6 +14,18 @@ elif [ $MARKET_STR = "ETH/USDT" ]; then
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["ETH/USDT"]' -r)
BASE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $ETH | tail -1 | cut -d' ' -f1)
QUOTE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $USDT | tail -1 | cut -d' ' -f1)
elif [ $MARKET_STR = "SOL/USDT" ]; then
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["SOL/USDT"]' -r)
BASE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $BTC | tail -1 | cut -d' ' -f1)
QUOTE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $USDC | tail -1 | cut -d' ' -f1)
elif [ $MARKET_STR = "SRM/USDT" ]; then
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["SRM/USDT"]' -r)
BASE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $ETH | tail -1 | cut -d' ' -f1)
QUOTE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $USDC | tail -1 | cut -d' ' -f1)
elif [ $MARKET_STR = "BTC/USDC" ]; then
MARKET=$(cat ~/mango-client-ts/src/ids.json | jq '.devnet.spot_markets|.["BTC/USDC"]' -r)
BASE_WALLET=$(spl-token accounts --verbose --url $CLUSTER --owner $KEYPAIR $BTC | tail -1 | cut -d' ' -f1)
@ -36,5 +49,6 @@ else
echo "invalid args"
fi
pushd ~/blockworks-foundation/serum-dex/dex/crank || exit
cargo run -- $CLUSTER consume-events --dex-program-id $DEX_PROGRAM_ID --payer $KEYPAIR --market $MARKET --coin-wallet $BASE_WALLET --pc-wallet $QUOTE_WALLET --num-workers 1 --events-per-worker 5 --log-directory . || popd
pushd ~/blockworks-foundation/serum-dex/dex/crank
cargo run -- $CLUSTER consume-events --dex-program-id $DEX_PROGRAM_ID --payer $KEYPAIR --market $MARKET --coin-wallet $BASE_WALLET --pc-wallet $QUOTE_WALLET --num-workers 1 --events-per-worker 5 --log-directory $LOG_FILE || popd