Trying this:
from alpaca_trade_api.rest import REST, TimeFrame, TimeFrameUnit
def hist_data_long(ticker):
data = api.get_bars(ticker, TimeFrame(45, TimeFrameUnit.Minute), “2021-06-08”, “2021-06-08”, adjustment=‘raw’).df
return data
Getting this:
Traceback (most recent call last):
File “C:\Programming\alpaca\alpaca_client.py”, line 4, in
from alpaca_trade_api.rest import REST, TimeFrame, TimeFrameUnit
ImportError: cannot import name ‘TimeFrameUnit’ from ‘alpaca_trade_api.rest’
By the way, on rest.py, the class is:
class TimeFrameUnit:
pass
I tried adding a new class from the SDK Github page:
class TimeFrameUnit(Enum):
Minute = “Min”
Hour = “Hour”
Day = “Day”
getting:
TypeError: Cannot extend enumerations
How do I approach it?