Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
822910.1% Return...something can't be right??

Hi all,

So I've been on Quantopian for 8 months now, and I'm just starting to mess around with some algos. I know some python and simply cloned this algo and made some changes.

Anyone have any idea why the return is so high? Did I just pick the right stock (TSLA)? It can't be right...right?

Thanks in advance.

Best,
Phil

9 responses

A question for Quantopian: How are returns calculated?

Philip your algo spent the original $5k and proceeded to borrow over $118 Million.
Watch context.portfolio.cash
I tried it with the code below added around handle_data()

context.cash_low  = 9999999999999999

def handle_data(context, data):

cash = context.portfolio.cash  
record(cash=cash)  
if cash < context.cash_low:  
    context.cash_low = cash  
    log.info('New cash low: ' + str(cash))  

Phillip, I plotted your cash for you here.

# Try adding something along these lines  
if context.portfolio.cash > 0:  
     order(stock, amount)  

thanks Gary and David! What about putting a borrow limit on? Do you know if that's possible? Interested in how that would change the return?

Yup, definitely possible, I added a borrow limit of $5000 and a check for open orders. It gets to 200% invested pretty fast, it's more realistic than the previous test, but it does not account for interest on borrowed cash.

Thanks David!! Really appreciate the help.

Interesting... I changed to AAPL and didn't get result I expected. :(

Hi Jaydip, I just ran it with AAPL and got a different result than yours....not sure why...looks like the algo is the exact same....hmmm?

Phillip, looks like you changed the backtest start year from 2013 to 2014, giving you the different results :)

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.

Alisa, yes, that is correct. Sorry, forgot I did that.