Optimism is always a good idea, there is a huge benefit to positive self talk. It’s tough to balance that with realistic self assessment for me, so I’ve always erred on the side of realism. The best thing you can do is look at your mistakes, analyze why you made them, and work on ways to correct them.