Don't take this for legal advice, but as long as your account is registered at your permanent residence, this is no different than if I, a US citizen, traded my account at IB while on vacation in France.
Capital gains aren't earned income, as far as I know. So you aren't really "working."...