diff --git a/apitest/scripts/trade-simulation-utils.sh b/apitest/scripts/trade-simulation-utils.sh index 412d759ac19..180e1894dfd 100755 --- a/apitest/scripts/trade-simulation-utils.sh +++ b/apitest/scripts/trade-simulation-utils.sh @@ -179,6 +179,24 @@ showcreatepaymentacctsteps() { printbreak } +gencreateoffercommand() { + PORT="$1" + ACCT_ID="$2" + CMD="$CLI_BASE --port=$PORT createoffer" + CMD+=" --payment-account=$ACCT_ID" + CMD+=" --direction=$DIRECTION" + CMD+=" --currency-code=$CURRENCY_CODE" + CMD+=" --amount=$AMOUNT" + if [ -z "$MKT_PRICE_MARGIN" ]; then + CMD+=" --fixed-price=$FIXED_PRICE" + else + CMD+=" --market-price-margin=$MKT_PRICE_MARGIN" + fi + CMD+=" --security-deposit=15.0" + CMD+=" --fee-currency=BSQ" + echo "$CMD" +} + createoffer() { CREATE_OFFER_CMD="$1" OFFER_DESC=$($CREATE_OFFER_CMD) diff --git a/apitest/scripts/trade-simulation.sh b/apitest/scripts/trade-simulation.sh index bb2a93293a4..cf8bda74102 100755 --- a/apitest/scripts/trade-simulation.sh +++ b/apitest/scripts/trade-simulation.sh @@ -86,18 +86,7 @@ printdate "ALICE $ALICE_ROLE: Creating $DIRECTION $CURRENCY_CODE offer with pay CURRENT_PRICE=$(getcurrentprice "$ALICE_PORT" "$CURRENCY_CODE") exitoncommandalert $? printdate "Current Market Price: $CURRENT_PRICE" -CMD="$CLI_BASE --port=$ALICE_PORT createoffer" -CMD+=" --payment-account=$ALICE_ACCT_ID" -CMD+=" --direction=$DIRECTION" -CMD+=" --currency-code=$CURRENCY_CODE" -CMD+=" --amount=$AMOUNT" -if [ -z "$MKT_PRICE_MARGIN" ]; then - CMD+=" --fixed-price=$FIXED_PRICE" -else - CMD+=" --market-price-margin=$MKT_PRICE_MARGIN" -fi -CMD+=" --security-deposit=15.0" -CMD+=" --fee-currency=BSQ" +CMD=$(gencreateoffercommand "$ALICE_PORT" "$ALICE_ACCT_ID") printdate "ALICE CLI: $CMD" OFFER_ID=$(createoffer "$CMD") exitoncommandalert $?