1 year ago
#375930
M k
Alpaca API Date (Start, End) Invalid Error with Python for stocks
When I try to generate the **Start ** and **End ** Dates for the API from Today's function and the last business day I get an error
Here is the code:
Symbol=“AAPL”
end= datetime.datetime.today()
date1= end- pd.tseries.offsets.BDay(1)
start=(date1.strftime(’%Y-%m-%d’))
Alpaca= api.get_bars(Symbol, TimeFrame.Day, start, end ,
adjustment=‘raw’).df
I get : APIError: invalid start
python
api
datetime
stock
0 Answers
Your Answer