I'd recommend asking once your final grades are in so they can write a better recommendation. If you ask earlier, they probably still will. However, they likely won't be as detailed and strong as they could be. Better to ask after you've gotten that A!