It's simple to have information about the future in entirely legal ways. Usually the future information is available, just unequally distributed.
The best example of this is the movie "The Big Short" where it the information about the upcoming crash of subprime-backed bonds just required people to bother reading large amounts of bond composition documents. Only 3 groups really did this.
Another good examples is how some funds pay for logistics intelligence (via satellite reconnaissance, customs declarations etc) to forecast sales figures.
I don't think you can generally, but in specific contexts, having a model of the system allows you to extrapolate. For example, people who foresaw how the pandemic would or even could play out made lots of money. The further out you can connect the dots, to secondary or tertiary effects, the better. I did nothing personally.
Why would it be illegal if you're not directly involved with the corporation? Surely insider trading implies actually being some kind of insider. Like some politician selling stock before some regulation takes effect.
So you go to an event or something. Company guy says something stupid that convinces you they're doomed to fail and then you make money by shorting their company's stock. That's illegal?
How, uh, do you do this legally?
>If you are using python
And if you're using C++?