Let's assume that an alien who's never been to the US before moves there and becomes a resident alien for that financial year due to fulfilling their substantial presence. The alien owns financial assets that he's been trading over the years.
If he decides to cash out an amount of those assets, how would the taxes be calculated? And does it matter how long he's been holding those assets before deciding to cash out? Given that the assets were acquired before moving to the US, and that the alien has never made any trades while in the US up till that point.
Also, would it be better if the alien wasn't a resident alien for that financial year?