id ask at the end of your third week... just in case the attending would like to go over your CV and maybe personal statement, then have a chance to talk with you directly the following and last week. granted you should of had plenty of face time with the attending by this point, but they still may want to meet with you. it happened with two of my letter writers. also, remember it may take several weeks for an attending to write your letter, which can hurt you if your rotation is late.
i have no idea how long after a rotation you can/should ask... you could always ask if they feel comfortable writing you a letter, and if they say no, then they say no. its seems like the longer you wait, the less impressive your letter will be.