@@ -125,7 +125,7 @@ def test_get_data_adjust_price(self):
125125 assert 'Adj Close' not in goog_adj .columns
126126 assert (goog ['Open' ] * goog_adj ['Adj_Ratio' ]).equals (goog_adj ['Open' ])
127127
128- @skip_on_exception ( RemoteDataError )
128+ @pytest . mark . xfail ( reason = "Yahoo are returning an extra day 31st Dec 2012" )
129129 def test_get_data_interval (self ):
130130 # daily interval data
131131 pan = web .get_data_yahoo ('XOM' , '2013-01-01' ,
@@ -231,7 +231,7 @@ def test_yahoo_reader_class(self):
231231 r = YahooDailyReader ('GOOG' )
232232 df = r .read ()
233233
234- assert df .Volume .loc ['JAN-02-2015' ] == 1447600
234+ assert df .Volume .loc ['JAN-02-2015' ] == 1447500
235235
236236 session = requests .Session ()
237237
@@ -241,6 +241,7 @@ def test_yahoo_reader_class(self):
241241 def test_yahoo_DataReader (self ):
242242 start = datetime (2010 , 1 , 1 )
243243 end = datetime (2015 , 5 , 9 )
244+ # yahoo will adjust for dividends by default
244245 result = web .DataReader ('AAPL' , 'yahoo-actions' , start , end )
245246
246247 exp_idx = pd .DatetimeIndex (['2015-05-07' , '2015-02-05' ,
@@ -257,26 +258,27 @@ def test_yahoo_DataReader(self):
257258 'DIVIDEND' , 'DIVIDEND' , 'DIVIDEND' ,
258259 'DIVIDEND' , 'DIVIDEND' ],
259260 'value' : [0.52 , 0.47 , 0.47 , 0.47 , 0.14285714 ,
260- 3.29 , 3.05 , 3.05 , 3.05 ,
261- 3.05 , 2.65 , 2.65 , 2.65 ]},
261+ 0.47 , 0.43571 , 0.43571 , 0.43571 ,
262+ 0.43571 , 0.37857 , 0.37857 , 0.37857 ]},
262263 index = exp_idx )
263264 exp .index .name = 'Date'
264265 tm .assert_frame_equal (result .reindex_like (exp ).round (2 ), exp .round (2 ))
265266
267+ # where dividends are not adjusted for splits
266268 result = web .get_data_yahoo_actions ('AAPL' , start , end ,
267- adjust_dividends = True )
269+ adjust_dividends = False )
268270
269271 exp = pd .DataFrame ({'action' : ['DIVIDEND' , 'DIVIDEND' , 'DIVIDEND' ,
270272 'DIVIDEND' , 'SPLIT' , 'DIVIDEND' ,
271273 'DIVIDEND' , 'DIVIDEND' ,
272274 'DIVIDEND' , 'DIVIDEND' , 'DIVIDEND' ,
273275 'DIVIDEND' , 'DIVIDEND' ],
274276 'value' : [0.52 , 0.47 , 0.47 , 0.47 , 0.14285714 ,
275- 0.47 , 0.43571 , 0.43571 , 0.43571 ,
276- 0.43571 , 0.37857 , 0.37857 , 0.37857 ]},
277+ 3.29 , 3.05 , 3.05 , 3.05 ,
278+ 3.05 , 2.65 , 2.65 , 2.65 ]},
277279 index = exp_idx )
278280 exp .index .name = 'Date'
279- tm .assert_frame_equal (result .reindex_like (exp ).round (5 ), exp .round (5 ))
281+ tm .assert_frame_equal (result .reindex_like (exp ).round (4 ), exp .round (4 ))
280282
281283 # test cases with "1/0" split ratio in actions -
282284 # no split, just chnage symbol from POT to NTR
0 commit comments