I have also tried using the quota by day fragment which was one of the developer portal assertions.
There are ${counterValue} and the ${maxHitsPerDay} context variable used for throughput quota assertion in that fragment. However, when I included that fragment in my code , it showed me an error, saying "the context variables are not set". So I set the ${counterValue} is equals to appId which gets created when we publish the policy on developer portal using gateway, but I was not able to set ${maxHitsPerDay} value dynamically. If I get this value dynamically, my scenario will work.
Any suggestions?