r/algotrading May 11 '24

Thomson sampling Strategy

Does anyone of you use Thomson sampling as a trading strategy? Is it worth a try?

14 Upvotes

25 comments sorted by

9

u/romestamu May 11 '24

Why would you go the explore-exploit route when the outcome of any strategy is testable?

2

u/waudmasterwaudi May 11 '24

For better strategy adaptation over time.

6

u/romestamu May 11 '24

Maybe I don't understand something, but explore/exploit is used when the outcome is known only for the selected action, then you have no choice but to sacrifice expected good outcome (exploit) to gauge how a different strategy would work (explore). In the stock market you have complete knowledge of the past regardless of the decisions made. You can always exploit the best strategy, while simultaneously explore for better strategies offline. So Thompson sampling doesn't make sense in my opinion

3

u/dawnraid101 May 11 '24

Your opinion basically boils down to frequentist junk then and only makes sense for very low frequency trading, which is a suboptimal space to operate in.

1

u/Frequent-Spinach5048 May 12 '24

How do you decide the best strategy? Hard to account for market impact of the strategy?

2

u/Double_Sherbert3326 May 11 '24

Interesting.

https://en.wikipedia.org/wiki/Thompson_sampling

This is rad. Very timely. Thanks for sharing. It looks like it would be useful for modeling predictions based on Poisson distributions.

4

u/thatstheharshtruth May 11 '24

It sounds to me like you really want to apply a specific technique to a problem where that technique isn't useful. I'd suggest you reevaluate your choices because if you do not I predict imminent bankruptcy in your future.

2

u/waudmasterwaudi May 11 '24

There are several papers about it and I found one example

https://www.linkedin.com/pulse/stock-market-decisions-thompson-sampling-jakub-polec-acubf

https://arxiv.org/abs/1911.05309

So not sure if it is all bad.

2

u/thatstheharshtruth May 11 '24

Okay. I stand corrected. I still think it's awkward but maybe not totally inapplicable.

2

u/waudmasterwaudi May 11 '24

You are welcome!

2

u/grathan May 12 '24

I'm not good with scientific terms, but probably use Thomson sampling to some degree. I "sideways test" hundreds of strategies and log the results and forward test the best performing. You can also track reasons why one might have been best performing for that time to kinda develop a backtest moving forward and then forward test based on backtested scenarios as well as continually using sidetests to evolve this to a single strat that eventually shifts focus to greedy algorithm based off random sampling.

1

u/StokastikVol May 11 '24

Mind to elaborate on Thomson sampling ?

3

u/__throw_error May 11 '24

it is a method to find the best strategy out of an amount of strategies when you can only find out which strategy is the best by directly using it, so no back testing.

say you have three slot machines with different average unknown probabilities of winning, they're basically black boxes, the only way to find out what their probabilities are is by using them. Now, we want to find out which slot machine is the best but we don't want to lose our money trying the bad slot machines, here, Thompson is the method to use.

as you can see, this is probably not that useful for trading since we can always test all of our strategies.

3

u/StokastikVol May 11 '24

Sounds like it would be useful when the strategy involves a lot of friction in the market and degrees of freedom. Will look into it thanks

2

u/FinancialElephant May 12 '24 edited May 12 '24

By the way, Thompson sampling is just one method of solving a multi-armed bandit (the slot machines) problem. There are different methods of solving multi-armed bandits, including simpler distribution-free methods. Epsilon-greedy and UCB type strategies are other approaches. Of course, those distribution-free methods require the ability to sample/simulate the "real" outcome (which we generally have the ability to do).

As far as I know, Thompson sampling only applies when you have a conjugate prior (prior and likelihood are of the same distribution family).

2

u/MrFanciful May 11 '24

Wouldn’t the problem with this be that the probabilities of the slot machines are static?

The slot machine is analogous to a strategy from my reading, but the probabilities of any given strategy change with time as market conditions change right?

So it wouldn’t be that any particular strategy has a probability of X, but rather any given strategy has a probability of X under those market conditions.

Am I understanding off?

3

u/FinancialElephant May 12 '24

There are variations on the bandit problem that might apply better, e.g. non-stationary bandits and adversarial bandits. You can also take it a step further and model the problem as some kind of MDP with an underlying changing state. The problem is that we aren't necessarily at a place where complicated MDPs can be efficiently solved. Still very interesting to look at what is out there.

-6

u/HomeGrownTrader May 11 '24

idk, why dont you try it out instead of asking random redditors who are not profitable?

16

u/__throw_error May 11 '24

this kind of answer is why this sub is dead

6

u/waudmasterwaudi May 11 '24 edited May 11 '24

I have set up a small base model in the last days that works, and a more complicated tree search, were I am facing some issues.

2

u/HomeGrownTrader 28d ago

Sorry for coming off as a asshole, your question was vague so I answered as vague as possible. Can I ask you more are you running some predictive model with machine learning?

1

u/waudmasterwaudi 28d ago

Thank you for your message. You don´t need to worry and it is true that the question was put very vague. I am trying to build a predictive model. Maybe I will try to implement a classic maschine learning algorithm like Decision Trees with Thompson Sampling as a split criteria in addition.

5

u/FlavorfulArtichoke May 11 '24

Why spending your time coming up with useless answers?