Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Using Fetcher and Functions

I'm relatively new to Python and on top of that I'm relying on fetching all data from Yahoo (via Quandl) because there are no SIDs for the ASX.

At the moment I'm trying to use Quantopian functions, such as mavg but I don't think they're compatible with data that's been fetched via Quandl.

I'm assuming that the functions rely on SID formatting? Does anyone know any work-arounds for applying Quantopian functions to fetched data?

Thanks

7 responses

Hi Scott,

You could have a look at http://pandas.pydata.org/pandas-docs/stable/computation.html. Also, numpy/scipy is handy.

Grant

Hi Scott,

You can use the pre_func and post_func calls to manipulate the fetched data. Once the data is imported into the IDE, you can use the Quantopian functions to calculate any values.

I've attached a backtest as an example using mavg(). You can see the log statements and recorded graph of the moving average against the price. Feel free to change the moving average to any window to see how it changes in the graph (ie mavg(60)).

Also, for more examples, take a look at these previous threads that used Quandl:
https://www.quantopian.com/posts/using-economic-indicators-in-your-algorithms-beginners-algorithm-with-fetcher
https://www.quantopian.com/posts/using-the-fetcher-with-quandl
https://www.quantopian.com/posts/black-litterman

Cheers,
Alisa

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 Alisa,

I wonder if you can provide an example with a ASX entity like say for an example - http://www.quandl.com/GOOG/ASX_CBA
I saw that your code still refrences XOM and SID to fetch.

Is there a primer I can refer to using Quandl ?

Ajay,
How would you like to use the data from Quandl? You will not be able to buy/sell shares of ASX_CBA because it is not a security in the Quantopian database, but you can use it as a signal for buying and selling other securities. If you would like to test buying/selling fetched data, you might want to check out Quantopian's open source backtesting engine, zipline.

David

Hi David,

Thank you for your response.
The CBA was an example. You will find that there are quite a few subsidiaries of NASDAQ listed companies on ASX. For example UNIS.
I would like to use Quantopian to observe any variance in between the parent company and the subsidiary.
I was also wondering if that could be used to emulate behavior of other entities on Quantopian.

Hence the request for using Quandl to test ASX listed entities.

That should work then. The only problem would be that the file is only fetched once/day before market open, so it will not update throughout the trading day. That's a pretty cool idea though, are you thinking about doing an arbitrage scenario between parent/subsidiary companies? This thread is an example of how to import whatever quandl dataset or combination of sets into your algorithm. You will have to copy/paste a big chunk of code, but it makes it easy to load several files in one call with the fetcher.

Hi David,

Thank you for your response.
I have been playing a little with Quatopian and having a bit of success.
It is a wonderful tool.

The arbitrage between parent/subsidiary was partially the idea. One of the reasons being the markets operate with only a few hours of lag between each.
For example ASX opens at 10:00 AM AEST and US markets close around 7:AM AEST.
This gives about 3 hour lag to procure data and emulate.

I have had a look at your thread and would be exploring a little. I have also had a look at Zipline and I think Zipline might become more suitable in the future.
I will report back with any findings as soon as I can.