Apologies for simply reiterating the amazing variety of advice and insights from people above but I'd just like to stress the importance of ascertaining the law in your jurisdiction prior to carrying anything for self-defence that might be illegal. I appreciate that some people may regard risking prosecution as better than risking being killed but I think it's important that it's a choice rather than simply not knowing the law.
For instance, I believe in England and Wales public possession of "any article made or adapted for use to causing injury to the person, or intended by the person having it with him for such use" is prohibited with exceptions for "lawful authority or reasonable excuse" (as far as I know, neither of those includes self-defence. They refer to things like tools needed for a profession.). Further, the use of force is limited to what observers would deem to be reasonable and proportional.
Personally, I carry a bright torch and always have a rather large and heavy umbrella with a handle akin to a truncheon in the side pocket of any bag so I can argue that carrying it was legitimate for dealing with the unpredictability of British weather when out and I merely grabbed it in the moment. Also, I'm prepared to make a lot of noise and focus on the idea of creating a window for escape. I wouldn't personally risk carrying an actual weapon since I simply can't risk prosecution and I've seen quite a few statistics that show you're more likely to suffer serious injury in an attack if you have an actual weapon due to the way it alters the dynamics of the situation.
The stereotypes about the origin of threats seem quite inaccurate in a lot of cases to me so I'd suggest that's important to remember. As far as I'm aware, threats for a lot of crimes against the person are largely from people that are known to the victim, varying from acquaintances to those deeply loved. Naturally, this varies for trans people due to belonging to a group that is often degraded by the public so I'd guess stranger attacks are elevated. While I'm not advocating that you don't allow yourself to be happy due to never trusting and by constantly being guarded, I'd suggest not allowing your judgement to be clouded by the belief it'll always be strangers in dark places that will take advantage.
Finally, I know it's not easy to do but please try not blaming yourself if you ever do get attacked. Following advice for hypothetical situations is understandable but it isn't your fault if you skipped a particular thing or didn't take more steps or lapsed in adhering to them for a while or just lived life as you wish. The fault will always solely belong to the person that violated you. You shouldn't have to protect yourself or limit your life choices to do that, it's never ever your fault. Try not to internalise advice given about hypothetical scenarios before-the-fact to the point that you add to your suffering via self-blame after-the-fact. You inherently deserve better.