Does carrying valuable cargo increase odds of being attacked?
From my experience, I've found that having more valuables increases both the chance of pirates coming to attack you and the amount of pirates that do. Recently, before I switched to earning a profit from trading, I found a few planets with Gravitino Balls, and, with my combined 30-slot inventory, harvested as many as I could. I found that the second I got out of the atmosphere, I immediately had four pirates chasing me. I was able to get to the space station just above in time, however this was no coincidence.
I proceeded to test my theory by coming up with different amounts of balls, and, although the time it took for them to appear varied slightly, I found that the amount of pirates depended on the value of the goods you're carrying and the (approximate) time depended on the amount of valuable goods you have in storage.
Due to this, I don't recommend harvesting sac venom or any other valuable trading items for money once you have over 500,000. Buy low and sell high, especially with dynamic resonators.