using getopts to parse a command line

i have the following scenario want to run the following script with manadory and optional argumnets

Manadory options are :

filename=""
port=""
optional arguments

type -t [A/B]
balances -b bal
prices -p

./test filename  port -t A -b bal

my code i have that won't parse the options is
This is what i have

#!/bin/bash
filename=""
port=""

while getopts b:t:p opt
 do
      case $opt in
          b) BAL="${OPTARG}"
             if [ "$BAL" == "" ]
             then
                print_usage $0
             else
                echo "Balances is " $BAL
             fi ;;

          t) TYPE="$OPTARG";;
          p) PRICES="$OPTARG";;
          ?) print_usage $0
             exit 1;;
      esac
done
echo "Balances:                "$BAL
echo "Type:                    "$TYPE

Any ideas

Is this schoolwork? There are guidelines, a mandatory template.

Did you chmod it executable?

What is your command line, output?

I never use getopt*, as I like to force simpler, more readable options, easily parsed with while case shift: -a -b whatever -c -d -e