Skip to content

Instantly share code, notes, and snippets.

@pbamotra
Created March 22, 2023 00:20
Show Gist options
  • Save pbamotra/65c63cf0b73b65034254635de9ecf90d to your computer and use it in GitHub Desktop.
Save pbamotra/65c63cf0b73b65034254635de9ecf90d to your computer and use it in GitHub Desktop.
cmdline bankrate mortgages
# Assumes you've awk, jq, curl installed
calc() { awk "BEGIN{print $*}"; }
export PROPERTY_VALUE=1000000
export LOAN_AMOUNT=`calc $PROPERTY_VALUE*0.8`
export PROPERTY_ZIP=94107
alias bankrate="curl 'https://mortgage-api.bankrate.com/rates/v4/?loanType=purchase&propertyValue=$PROPERTY_VALUE&propertyType=SingleFamily&propertyUse=PrimaryResidence&cashOutAmount=0&zipCode=$PROPERTY_ZIP&loanAmount=$LOAN_AMOUNT&creditScore=770&debtToIncomeRatio=0&pointsRange=Zero&productFamilies\[\]=conventional&loanTerms\[\]=30yr&loanTerms\[\]=7-1arm&loanTerms\[\]=7-6arm&loanTerms\[\]=10-1arm&loanTerms\[\]=10-6arm&defaultSearch=true&pid=br3&veteranStatus=NoMilitaryService&hadPriorVaLoan=false&hasVaDisabilities=false&firstTimeHomeBuyer=false&displayTargets\[\]=mobileRateTable&displayTargets\[\]=featuredRateTable&deviceTypes\[\]=mobile&e2eTestEnabled=false&clientId=MortgageRateTable&includeSponsored=true&includeEditorial=true' -H 'authority: mortgage-api.bankrate.com' -H 'accept: application/json, text/plain, */*' -H 'accept-language: en-US,en;q=0.5' -H 'origin: https://www.bankrate.com' -H 'referer: https://www.bankrate.com/' -H 'sec-ch-ua: "Not?A_Brand";v="8", "Chromium";v="108", "Brave";v="108"' -H 'sec-ch-ua-mobile: ?1' -H 'sec-ch-ua-platform: "Android"' -H 'sec-fetch-dest: empty' -H 'sec-fetch-mode: cors' -H 'sec-fetch-site: same-site' -H 'sec-gpc: 1' -H 'user-agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Mobile Safari/537.36' --compressed | jq '.offers[] | .advertiser.name + \",\" + .product.name + \",\" + (.rate|tostring) + \",\" + (.apr|tostring)'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment