Backtesting method bt.get() in python not working

412 Views Asked by At

I have been running the same code always, but suddenly this morning it stopped working

%matplotlib inline
import bt

data = bt.get("TLT", start="2022-06-01", end="2022-06-30")

After running this code, this is the error message I receive: enter image description here

Thank you!

I have "conda update --all" and the same error is still showing

1

There are 1 best solutions below

0
On BEST ANSWER

After trying to run the same code in google colabs, instead of my jupyter notebook, I realized "bt" package is unable to read the data from the yahoo finance page url. It might need an enhancement. In the meantime, I have been able to simulate what bt.get should have been doing with the following code:

data = yf.download("TLT", start="2022-06-01", end="2022-06-30")
data = data.rename(columns = {'Adj Close':'tlt'})
data = data.drop(['Open', 'High', 'Low', 'Close', 'Volume'], axis=1)