Back to Community
Quantapolis - Value Example (long-short)

Hi Quantopians,

We've recently been working on a wiki project to stem the tide of front-page turnover on Quantopian.com and the quant blogosphere in general. It's still pre-launch, but you can already get a glimpse at http://quantapolis.com.

The wiki has a collection of links to some of the best algorithms on Quantopian. It's amazing to see what you all build in open-source, and we're trying to give back. We'll provide a series bare-bones examples of quantitative trading strategies for illustration purposes and ease of learning. This comes right to the tune of the awesome algorithms, lectures, tutorials and resources published by so many other members of the community recently.

This algorithm demonstrates a basic long-short value strategy. The strategy manages a beta-neutral, concentrated portfolio of US large-cap stocks on NYSE and is based on the acquirers multiple (EV/EBITDA) with monthly rebalancing. We're trying to keep complexity to a minimum and only use a single ranking metric and the most important filters for smooth backtesting. Feel free to use it as template to hack it into something more sophisticated.

Highlights:
* Minimal complexity
* Simple ranking and allocation of stocks
* US large-cap stocks from fundamentals database
* Keeping the right price data available
* Avoiding obsolete stocks in the portfolio
* Avoiding short of momentum growth stocks

--- Origin

Clone Algorithm
71
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 55cb9657a512050c7334343d
There was a runtime error.
4 responses

Quite the website, I hope it does well.

By the way in the code above adding .operation_ratios.roa > 0 might be a 1/3 increase at least for that timeframe (12.5 yrs).

With it, not sure if nor why, might also need ...

    for s in context.portfolio.positions:  
        if s not in data: continue  

On quantapolis would love to see thumbs-up voting next to the algorithms. [Edit later: Done, thanks]

Origin - great idea to gather top-notch algorithms and code shared in the community. I'm looking forward to seeing the wiki grow.

Tristan also shared a Github repo recently, perhaps the two can be integrated to share useful code? https://github.com/tristanbob/Quantopian-Community

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Gary - can you explain what you are changing and why? Thanks!

Gary, Daniel - I'd recommend using ROA as an additional variable for ranking, rather than as a filter for the database query. After all the strategy makes gains going long "under-valued" companies (in this case low EV/EBITDA and high ROA), and short "over-valued" ones (high EV/EBITDA, low ROA). Filtering out companies with low ROA in the query potentially eliminates great short opportunities.