You have to have trader status first:
Special rules apply if you're a trader in securities, in the business of buying and selling securities for your own account. The law considers this to be a trade or business, even though a trader doesn't maintain an inventory and doesn't have customers. To be engaged in business as a trader in securities, you must meet all of the following conditions:
The following facts and circumstances should be considered in determining if your activity is a securities trading business: