Hello,
I've been lurking here for a while now, and I'm still learning some of the syntax.... I would like to use Quandl datasets that have monthly economic information (FRED unemployment rate data for example). It is marginally working from some of the nice examples and tutorials. The backtest runs, and plots the data I want to use, but still has some issues.
1: In order to use the dataset, it requires putting into a pipeline? Is there a way to use it directly in an algorithm? (the unrate data doesn't have an example algorithm, the attached backtest once it's working is one simple way it might be used) For this simple type of use, it's not for filtering stocks, more for algorithm decisions over time.
2: In the attached backtest, there must be a simpler way to get it into pipeline. the syntax suggested in documentation doesn't work: www.quantopian.com/data/quandl/fred_unrate pipe.add(fred_unrate.value.latest, 'fred_unrate')
#How to store the value into pipeline???????
# unrate = fred_unrate.value[-1:]
#running it through the SMA function works, crazy I know, but hey we're new here....
unrate = SimpleMovingAverage(inputs=[fred_unrate.value], window_length=1)
pipe.add(unrate, 'unrate')
unrate_sma10 = SimpleMovingAverage(inputs=[fred_unrate.value], window_length=200)
pipe.add(unrate_sma10, 'unrate_sma10') #(unrate is monthly, 10mo ~= 200day)
3: Further down in the algorithm, I'd like to compare the value and the SMA of the value, both were stored in the pipeline. Referring to them this way works to plot them, but doesn't return the current value that could be compared
record(unrate=context.fred[:1].unrate,unratesma=context.fred[:1].unrate_sma10)
unrate=context.fred[:1].unrate
unratesma=context.fred[:1].unrate_sma10
# Sell all of our shares by setting the target position to zero
#Want to Do This --> \/\/\/
# if unrate>unratesma: # Only if unemployment is increasing
#But I don't get how to reference the value from pipeline
order_target_percent(context.spy, 0)
Looking in the debugger, I see that these are BoundColumns data, but how do I get a value out of it?
Thanks! In Advance! this Quantopian thing is really cool by the way...