Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Incredibly Simple Bitcoin Algo

This takes bitcoin price data and maps it to the apple price. It also takes in google trend levels for the word 'bitcoin' which can be found here:http://www.google.com/trends/explore#q=bitcoin. The algorithm is incredibly simple, it just buys when there are low search volumes and sells when there are high search volumes. The purpose of me building this is so that bitcoin data can be used to backtest along with trend data.

9 responses

Does anybody know whether there is a way to load the csv straight in to a variable?

Nicholas, very cool ideas - both the algos and hacking the backtest to use BTC. The signaling code that reads the BTC data is behaving as you intended. However, you can't just overwrite the price of apple with the BTC price. While that does change the price on the bar object you have in the algorithm, we don't actually use that same bar in simulation of trades or in performance calculations. The reason is exactly to avoid this kind of loophole, where you could influence the performance of your algorithm by modifying the trade bars. As a result, the performance data you see in the backtest is from orders placed and filled with apple shares.

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.

Hi Fawce,

As I understand, the execution price can be modified via the slippage model (e.g. https://www.quantopian.com/posts/trade-at-the-open-slippage-model). Could a custom slippage model be written to modify the execution price of a security, such that the security prices in the Quantopian database effectively would be replaced with ones loaded via fetcher?

[EDIT] Looks like Dave Gilbert got it to work - https://www.quantopian.com/posts/how-to-order-a-stock-using-the-yahoo-price.

Grant

very simple yet it didnt work... line 44 errors...
44 Error Runtime exception: AttributeError: 'zipline.assets._assets.Equity' object has no attribute 'price'

This was done utilizing an exploit that did not really work, the backtest used to work about a year ago but the exploit seems to have since been patched. John read the other comments in this thread to get a better idea of why the exploit effectively did not work.

I recompiled the unworking parts of the code so it finally works, except for one string:

sid(24).price=data['BTC'].price  

I recompiled this string, that previously returned me the runtime error:

AttributeError: 'zipline.assets._assets.Equity' object has no attribute 'price'

I recompiled it to:

data.current(sid(24), 'price')= data['BTC'].price  

This string, that previously I'm a beginner and don't understand how this type of string should work, but it return me:

SyntaxError: can't assign to function call

There is someone how could hel me?

Davide, did you end up getting to work correctly? I am interested in helping

@Nicholas Goodrich, do you know how to buy and sell BTC?

Even I am facing error in line 44. Can someone help?