@@ -53,17 +53,17 @@ def Initialize(self):
5353 # add CAPE data
5454 self .AddData (Cape , "CAPE" )
5555
56- # Present Social Media Stocks:
56+ # # Present Social Media Stocks:
5757 # self._symbols.append("FB"), self._symbols.append("LNKD"),self._symbols.append("GRPN"), self._symbols.append("TWTR")
5858 # self.SetStartDate(2011, 1, 1)
5959 # self.SetEndDate(2014, 12, 1)
6060
61- # 2008 Financials
61+ # # 2008 Financials
6262 # self._symbols.append("C"), self._symbols.append("AIG"), self._symbols.append("BAC"), self._symbols.append("HBOS")
6363 # self.SetStartDate(2003, 1, 1)
6464 # self.SetEndDate(2011, 1, 1)
6565
66- # 2000 Dot.com
66+ # # 2000 Dot.com
6767 # self._symbols.append("IPET"), self._symbols.append("WBVN"), self._symbols.append("GCTY")
6868 # self.SetStartDate(1998, 1, 1)
6969 # self.SetEndDate(2000, 1, 1)
@@ -76,9 +76,7 @@ def Initialize(self):
7676 self ._rsi = self .RSI (stock , 14 , MovingAverageType .Exponential , Resolution .Daily )
7777 self ._rsiDic [stock ] = self ._rsi
7878
79- # <summary>
8079 # Trying to find if current Cape is the lowest Cape in three months to indicate selling period
81- # </summary>
8280 def OnData (self , data ):
8381
8482 if self ._currCape and self ._newLow is not None :
@@ -144,36 +142,28 @@ def OnData(self, data):
144142 if self ._newLow :
145143 self .Debug ("New Low has been hit on " + str (self .Time ))
146144
147- # <summary>
148145 # Buy this symbol
149- # </summary>
150146 def BuyStock (self ,symbol ):
151147 s = self .Securities [symbol ].Holdings
152148 if self ._macdDic [symbol ].Current .Value > 0 :
153149 self .SetHoldings (symbol , 1 )
154150 self .Debug ("Purchasing: " + str (symbol ) + " MACD: " + str (self ._macdDic [symbol ]) + " RSI: " + str (self ._rsiDic [symbol ])
155151 + " Price: " + str (round (self .Securities [symbol ].Price , 2 )) + " Quantity: " + str (s .Quantity ))
156- # <summary>
152+
157153 # Sell this symbol
158- # </summary>
159- # <param name="symbol"></param>
160154 def SellStock (self ,symbol ):
161155 s = self .Securities [symbol ].Holdings
162156 if s .Quantity > 0 and self ._macdDic [symbol ].Current .Value < 0 :
163157 self .Liquidate (symbol )
164158 self .Debug ("Selling: " + str (symbol ) + " at sell MACD: " + str (self ._macdDic [symbol ]) + " RSI: " + str (self ._rsiDic [symbol ])
165159 + " Price: " + str (round (self .Securities [symbol ].Price , 2 )) + " Profit from sale: " + str (s .LastTradeProfit ))
166160
167- # <summary>
168- # CAPE Ratio for SP500 PE Ratio for avg inflation adjusted earnings for previous ten years
169- # Custom Data from DropBox
161+
162+ # CAPE Ratio for SP500 PE Ratio for avg inflation adjusted earnings for previous ten years Custom Data from DropBox
170163# Original Data from: http://www.econ.yale.edu/~shiller/data.htm
171- # </summary>
172164class Cape (PythonData ):
173165
174- # <summary>
175166 # Return the URL string source of the file. This will be converted to a stream
176- # </summary>
177167 # <param name="config">Configuration object</param>
178168 # <param name="date">Date of this source file</param>
179169 # <param name="isLiveMode">true if we're in live mode, false for backtesting mode</param>
@@ -184,11 +174,9 @@ def GetSource(self, config, date, isLiveMode):
184174 return SubscriptionDataSource ("https://www.dropbox.com/s/ggt6blmib54q36e/CAPE.csv?dl=1" , SubscriptionTransportMedium .RemoteFile )
185175
186176
187- # <summary>
188- # Reader Method :: using set of arguements we specify read out type. Enumerate
189- # until the end of the data stream or file. E.g. Read CSV file line by line and convert
190- # into data types.
191- # </summary>
177+ ''' Reader Method : using set of arguements we specify read out type. Enumerate until
178+ the end of the data stream or file. E.g. Read CSV file line by line and convert into data types. '''
179+
192180 # <returns>BaseData type set by Subscription Method.</returns>
193181 # <param name="config">Config.</param>
194182 # <param name="line">Line.</param>
0 commit comments