Skip to content

Commit

Permalink
Update utils.py
Browse files Browse the repository at this point in the history
Add proxy to invoke yfinance history api
  • Loading branch information
rmfish authored Oct 26, 2022
1 parent 99fb65b commit 546100d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions quantstats/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ def _prepare_returns(data, rf=0., nperiods=None):
return data


def download_returns(ticker, period="max"):
def download_returns(ticker, period="max",proxy=None):
if isinstance(period, _pd.DatetimeIndex):
p = {"start": period[0]}
p = {"start": period[0], "proxy": proxy}
else:
p = {"period": period}
p = {"period": period, "proxy": proxy}
return _yf.Ticker(ticker).history(**p)['Close'].pct_change()


Expand Down

0 comments on commit 546100d

Please sign in to comment.