@@ -199,19 +199,25 @@ def test_get_date_ret_index(self):
199
199
200
200
def test_get_data_yahoo_actions (self ):
201
201
start = datetime (1990 , 1 , 1 )
202
- end = datetime (2000 , 4 , 5 )
202
+ end = datetime (2018 , 4 , 5 )
203
203
204
- actions = web .get_data_yahoo_actions ('BHP.AX' , start , end ,
205
- adjust_dividends = True )
204
+ actions = web .get_data_yahoo_actions ('AAPL' , start , end ,
205
+ adjust_dividends = False )
206
+
207
+ assert sum (actions ['action' ] == 'DIVIDEND' ) == 47
208
+ assert sum (actions ['action' ] == 'SPLIT' ) == 3
206
209
207
- assert sum ( actions [ ' action' ] == 'DIVIDEND' ) == 21
208
- assert sum ( actions [ 'action' ] == 'SPLIT' ) == 1
210
+ assert actions . loc [ '2005-02-28' , ' action' ][ 0 ] == 'SPLIT'
211
+ assert actions . loc [ '2005-02-28' , 'value' ][ 0 ] == 1 / 2.0
209
212
210
- assert actions .loc ['1995-05-11' , 'action' ][0 ] == 'SPLIT'
211
- assert actions .loc ['1995-05-11' , 'value' ][0 ] == 1 / 1.1
213
+ assert actions .loc ['1995-11-21' , 'action' ][0 ] == 'DIVIDEND'
214
+ assert round (actions .loc ['1995-11-21' , 'value' ][0 ], 3 ) == 0.120
215
+
216
+ actions = web .get_data_yahoo_actions ('AAPL' , start , end ,
217
+ adjust_dividends = True )
212
218
213
- assert actions .loc ['1993-05-10 ' , 'action' ][0 ] == 'DIVIDEND'
214
- assert actions .loc ['1993-05-10 ' , 'value' ][0 ] == 0.21
219
+ assert actions .loc ['1995-11-21 ' , 'action' ][0 ] == 'DIVIDEND'
220
+ assert round ( actions .loc ['1995-11-21 ' , 'value' ][0 ], 4 ) == 0.0043
215
221
216
222
def test_get_data_yahoo_actions_invalid_symbol (self ):
217
223
start = datetime (1990 , 1 , 1 )
0 commit comments