@@ -42,7 +42,10 @@ def parse_yahoo_historical(fh, asobject=False, adjusted=True):
42
42
43
43
where d is a floating poing representation of date, as returned by date2num
44
44
45
- if adjusted=True, use adjusted prices
45
+ if adjusted=True, use adjusted prices. Note that volume is not
46
+ adjusted and we are not able to handle volume adjustments properly
47
+ because the Yahoo CSV does not distinguish between split and
48
+ dividend adjustments.
46
49
"""
47
50
results = []
48
51
@@ -68,10 +71,10 @@ def parse_yahoo_historical(fh, asobject=False, adjusted=True):
68
71
volume = int (vals [5 ])
69
72
if adjusted :
70
73
aclose = float (vals [6 ])
71
- m = aclose / close
72
- open *= m
73
- high *= m
74
- low *= m
74
+ delta = aclose - close
75
+ open += delta
76
+ high += delta
77
+ low += delta
75
78
close = aclose
76
79
77
80
results .append ((d , open , close , high , low , volume ))
@@ -146,7 +149,10 @@ def quotes_historical_yahoo(ticker, date1, date2, asobject=False, adjusted=True,
146
149
if asobject is True, the return val is an object with attrs date,
147
150
open, close, high, low, volume, which are equal length arrays
148
151
149
- if adjust=True, use adjusted prices
152
+ if adjusted=True, use adjusted prices. Note that volume is not
153
+ adjusted and we are not able to handle volume adjustments properly
154
+ because the Yahoo CSV does not distinguish between split and
155
+ dividend adjustments.
150
156
151
157
Ex:
152
158
sp = f.quotes_historical_yahoo('^GSPC', d1, d2, asobject=True, adjusted=True)
0 commit comments