The laws of using non-Jews to work on Shabbat are very complex. They are discussed at length by the Shulhan Aruch in simanim 244, 245, 246, 247 etc. Each case must be analyzed individually; one cannot extrapolate from one case to another.
One of the questions that arises is whether a Jew is permitted to give a non-Jew money before Shabbat to invest on his behalf, in exchange for a fee or percentage. Does the fact that the non-Jew could potentially execute transactions on Shabbat or Yom Tob render such an arrangement forbidden?
The Shulhan Aruch (245:4) rules that it is permitted to do so for several reasons. First, the Jew is not instructing the non-Jew to work specifically on Shabbat. It does not matter to the Jew when he invests, as long as he makes a profit.
Second, since the non-Jew is receiving a fee or percentage, he is considered to be working for himself; it his own interest to accomplish the task.
Third, there is no issue of marit ayin; no outside observer could misconstrue this as an illicit arrangement. Since money, by its nature, is not associated with its source, no one can easily trace the Shabbat transaction back to the Jew. Questions involving a Jewishly owned store or company are more susceptible to this issue.
Fourth, the transactions are happening in the non-Jew’s office. A non-Jew is not permitted to do prohibited work in a Jewish home on Shabbat.
Finally, the arrangement does not entail the Jew working a different day instead of the non-Jew. Therefore, the non-Jew is not considered the agent of the Jew on Shabbat.
Because of all of these reasons, it is permitted to invest money through a non-Jewish bank or stockbroker. It is even permissible to instruct a broker to buy and sell at a certain number, as long as he was not told to specifically do so on Shabbat.
Similarly, Shulhan Aruch (245:5) writes that this principle applies to merchandise as well. A Jew is permitted to give a non-Jew merchandise to sell on his behalf in exchange for a commission, even though the non-Jew will sell on Shabbat. Moreover, Hacham Ovadia (Yehave Da’at, vol. 3) is lenient even in certain cases in which the market is only open on Shabbat, for example, a certain trade show in which the vendors are all there. Even though it is almost certain that the non-Jew will sell there on Shabbat, Hacham Ovadia is lenient especially in a case of hefsed (financial loss). The Ben Ish Hai (Rav Yosef Haim of Baghdad, 1833-1909) in his sefer Rav Berachot is also lenient in such a case, even though in Sefer Ben Ish Hai parashat Vayishlach he was more machmir (strict).
It is permissible to give money or merchandise for a non-Jew to invest or sell, even though he may do so on Shabbat or Yom Tob.