Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
How To Determine Time In Market?

I was wondering if there was a simple way to determine the "time in market" of your capital?

Ie, if I have two algos; one produces a 20% return per annum but is only invested in the market 20% of the time and the other algo produces a 25% return per annum but is invested 90% of the time, I'd argue that the first algo is better because your capital could be used to make additional returns in other strategies for the remaining 80% of the time.

So how could we calculate the time in the market for our different strategies?

2 responses

Hmmm, you could do something along the lines of keeping a timedelta context variable to keep track of the time in market. When a trade is opened, note that time, then when it's closed, subtract the opening time from the current time and add it to the total time. I took a stab at it, could get uglier with multiple stocks on the go though.

Thanks David.