A few months ago, we announced our data partner program. Since then, we’ve doubled the number of data sets available to you through this program. Today we have 42 data sets, include many free data sets through Quandl.
At launch, these partner data sets were only usable in Quantopian Research. Today, that changes!
You can now start using Accern and Quandl data sets in your algorithms: backtesting, paper trading and the Quantopian Open contest.
For each of these vendors, the data can be accessed as part of the pipeline API.
To use this data, go to quantopian.com/data, click into the page for the data set that interests you and hit the appropriate "Get" button to ensure access to the set. Once you've done this, you're ready to use that partner data set in your algo.
Just as you might import pricing data for use in pipeline like:
from quantopian.pipeline.data.builtin import USEquityPricing
you can access the Accern data for use in pipeline with a similar import:
from quantopian.pipeline.data.accern import alphaone_free as alphaone
With a premium data set like Accern, the code snippet above is making use of the free sample of the data set. If you want to use the most recent 2 years of data from Accern, you can do so by purchasing a monthly subscription.
Including a data set for Quandl is similar. If, for example, you want to use daily VIX prices, you could import as follows:
from quantopian.pipeline.data.quandl import yahoo_index_vix
In the case of Quandl, there are 17 data sets, all completely free. If you’d like to import a different data set from the VIX, you can pick another from the listing at Quantopian Data, like unemployment data:
from quantopian.pipeline.data.quandl import fred_ccsa
Note, these initial data sets from Quandl are typically macroeconomic (interest rates, unemployment rates, etc). They are not cross-sectional, i.e. there is not a separate measurement for each individual stock. Therefore, with non-cross-sectional data, the data in a pipeline is associated to every security.
With those raw data sets loaded, you can use the data with a built-in pipeline factor. Or use it to create your own custom factor. Attached is a template example using Accern.
Be on the lookout for some new shared algorithms using this data - James Christopher has already posted one using VIX data. I look forward to seeing how the community uses this data in algorithms, in the forums and in the contest!
|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|
from quantopian.pipeline import Pipeline from quantopian.algorithm import attach_pipeline, pipeline_output from quantopian.pipeline.data.builtin import USEquityPricing from quantopian.pipeline.factors import SimpleMovingAverage from quantopian.pipeline.data.accern import alphaone_free as alphaone def initialize(context): # Create, register and name a pipeline in initialize. pipe = Pipeline() attach_pipeline(pipe, 'example') # Construct a simple moving average factor using daily sentiment from Accern # and add it to the pipeline. sentiment = SimpleMovingAverage(inputs=[alphaone.article_sentiment], window_length=10) pipe.add(sentiment, 'sentiment') def before_trading_start(context, data): # Pipeline_output returns the constructed dataframe. output = pipeline_output('example') # Select the top 200 ranking securities and update your universe. context.my_universe = output.sort('sentiment', ascending=False).iloc[:200] update_universe(context.my_universe.index) log.info("Size of universe: " + str(len(context.my_universe.index))) log.info("First 5 members of universe:") log.info(context.my_universe.iloc[:5]) def handle_data(context, data): # Currently no ordering logic in this algorithm. It just shows how # to access Accern Alphaone in the pipeline API pass