@@ -125,7 +125,7 @@ def test_get_data_adjust_price(self):
125
125
assert 'Adj Close' not in goog_adj .columns
126
126
assert (goog ['Open' ] * goog_adj ['Adj_Ratio' ]).equals (goog_adj ['Open' ])
127
127
128
- @skip_on_exception ( RemoteDataError )
128
+ @pytest . mark . xfail ( reason = "Yahoo are returning an extra day 31st Dec 2012" )
129
129
def test_get_data_interval (self ):
130
130
# daily interval data
131
131
pan = web .get_data_yahoo ('XOM' , '2013-01-01' ,
@@ -231,7 +231,7 @@ def test_yahoo_reader_class(self):
231
231
r = YahooDailyReader ('GOOG' )
232
232
df = r .read ()
233
233
234
- assert df .Volume .loc ['JAN-02-2015' ] == 1447600
234
+ assert df .Volume .loc ['JAN-02-2015' ] == 1447500
235
235
236
236
session = requests .Session ()
237
237
@@ -241,6 +241,7 @@ def test_yahoo_reader_class(self):
241
241
def test_yahoo_DataReader (self ):
242
242
start = datetime (2010 , 1 , 1 )
243
243
end = datetime (2015 , 5 , 9 )
244
+ # yahoo will adjust for dividends by default
244
245
result = web .DataReader ('AAPL' , 'yahoo-actions' , start , end )
245
246
246
247
exp_idx = pd .DatetimeIndex (['2015-05-07' , '2015-02-05' ,
@@ -257,26 +258,26 @@ def test_yahoo_DataReader(self):
257
258
'DIVIDEND' , 'DIVIDEND' , 'DIVIDEND' ,
258
259
'DIVIDEND' , 'DIVIDEND' ],
259
260
'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 ]},
262
263
index = exp_idx )
263
264
exp .index .name = 'Date'
264
265
tm .assert_frame_equal (result .reindex_like (exp ).round (2 ), exp .round (2 ))
265
266
266
- result = web . get_data_yahoo_actions ( 'AAPL' , start , end ,
267
- adjust_dividends = True )
267
+ # where adjust_dividends = True
268
+ result = web . get_data_yahoo_actions ( 'AAPL' , start , end , adjust_dividends = False )
268
269
269
270
exp = pd .DataFrame ({'action' : ['DIVIDEND' , 'DIVIDEND' , 'DIVIDEND' ,
270
271
'DIVIDEND' , 'SPLIT' , 'DIVIDEND' ,
271
272
'DIVIDEND' , 'DIVIDEND' ,
272
273
'DIVIDEND' , 'DIVIDEND' , 'DIVIDEND' ,
273
274
'DIVIDEND' , 'DIVIDEND' ],
274
275
'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 ]},
276
+ 3.29 , 3.05 , 3.05 , 3.05 ,
277
+ 3.05 , 2.65 , 2.65 , 2.65 ]},
277
278
index = exp_idx )
278
279
exp .index .name = 'Date'
279
- tm .assert_frame_equal (result .reindex_like (exp ).round (5 ), exp .round (5 ))
280
+ tm .assert_frame_equal (result .reindex_like (exp ).round (4 ), exp .round (4 ))
280
281
281
282
# test cases with "1/0" split ratio in actions -
282
283
# no split, just chnage symbol from POT to NTR
0 commit comments