Skip to content

Instantly share code, notes, and snippets.

@kmbarry1
Created January 22, 2022 01:19
Show Gist options
  • Save kmbarry1/5a36b1128c7733e807d2802e5ebd7527 to your computer and use it in GitHub Desktop.
Save kmbarry1/5a36b1128c7733e807d2802e5ebd7527 to your computer and use it in GitHub Desktop.
# ./flap_checker.sh 1 10 1900
# will check flaps 1 through 9 if they are selling at more than 6% deviation from 1900
ID=$1
END_ID=$2
FAIR_PRICE=$3
while [[ ID -ne END_ID ]]
do
ret=`seth call 0xC4269cC7acDEdC3794b221aA4D9205F564e27f0d "bids(uint256)(uint256,uint256,address,uint48,uint48)" $ID`
a=($(echo "$ret" | tr ',' '\n'))
BID="${a[0]}"
if [[ $BID -ne 0 ]]; then
PRICE=`bc <<< "scale=2;30000000000000000000000 / ${BID}"`
RATIO=`bc <<< "scale=4;${PRICE} / ${FAIR_PRICE}"`
IS_PRICE_BAD=$(bc <<< "$RATIO > 1.06")
if [[ $IS_PRICE_BAD -eq 1 ]]; then
FAIR_BID=`bc <<< "0.94 * (30000000000000000000000 / $FAIR_PRICE)"`
echo "$ID BAD PRICE -- RATIO: $RATIO -- FAIR_BID: $FAIR_BID"
fi
fi
ID=$(( $ID + 1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment