alpacahq / Momentum-Trading-Example

An example algorithm for a momentum-based day trading strategy.
657 stars 218 forks source link

AttributeError: 'REST' object has no attribute 'get_calendar' #23

Closed grantreighard closed 3 years ago

grantreighard commented 4 years ago

Hello. I fixed the other error I had while running the script, which was ImportError: cannot import name 'macd' from 'ta' (fixed by using from ta.trend import macd).

Now I have this error:

Traceback (most recent call last): File "algo-paper.py", line 375, in <module> calendar = api.get_calendar(start=today_str, end=today_str)[0] AttributeError: 'REST' object has no attribute 'get_calendar'

Looks like the API still includes this get_calendar call, any idea on what would be causing this? I have the same error using the different base_url, api_key, and secret for my Live and Paper accounts.

zenwaffles commented 3 years ago

I'm having a similar issue!

Instead of it saying REST object has no attribute get_calender I get 404 Client Error: Not Found for url: https://paper-api.alpaca.markets//v2/calendar?start=2020-12-08&end=2020-12-08

Did you ever fix your problem because I wonder if they are related in some way.

grantreighard commented 3 years ago

Hi @zenwaffles I haven't fixed this problem yet. I haven't looked at the project since the day I posted. Sorry.

zenwaffles commented 3 years ago

Alright I’ll be working on it pretty consistently here so if I figure mine out I’ll post it

grantreighard commented 3 years ago

Thank you. It's always nice to help someone else with a problem you're having.

grantreighard commented 3 years ago

By the way @zenwaffles all I had to do was pip install -r requirements.txt and that fixed the issue.