alpacahq / alpaca-backtrader-api

Alpaca Trading API integrated with backtrader
https://pypi.org/project/alpaca-backtrader-api/
Apache License 2.0
602 stars 143 forks source link

Cannot import alpaca-backtrader-api (Python 3.9.9 MacOS) #278

Open mitchweaver opened 2 years ago

mitchweaver commented 2 years ago
[~] python3
Python 3.9.9 (main, Nov 21 2021, 03:16:13)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import alpaca_backtrader_api
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/homebrew/lib/python3.9/site-packages/alpaca_backtrader_api/__init__.py", line 1, in <module>
    from .alpacastore import AlpacaStore
  File "/opt/homebrew/lib/python3.9/site-packages/alpaca_backtrader_api/alpacastore.py", line 12, in <module>
    import trading_calendars
  File "/opt/homebrew/lib/python3.9/site-packages/trading_calendars/__init__.py", line 16, in <module>
    from .trading_calendar import TradingCalendar
  File "/opt/homebrew/lib/python3.9/site-packages/trading_calendars/trading_calendar.py", line 33, in <module>
    from .calendar_helpers import (
  File "/opt/homebrew/lib/python3.9/site-packages/trading_calendars/calendar_helpers.py", line 6, in <module>
    NP_NAT = np.array([pd.NaT], dtype=np.int64)[0]
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NaTType'
>>>

Installed via pip3 install alpaca-backtrader-api

mitchweaver commented 2 years ago

Downgrading pandas from 1.3.5 to 1.2.5 has allowed me to import.

Should still state that this repo seems outdated. None of the examples work anymore.

loopiezlol commented 2 years ago

can confirm the same happens on ubuntu

cspipaon commented 2 years ago

@mitchweaver @Loopiezlol Are you guys able to run the example in README.md? I keep getting an error. I will open an issue for this shortly.

mitchweaver commented 2 years ago

@cspipaon No, all the examples are broken.

datatalking commented 2 years ago

@mitchweaver I'm a new user to alpaca, is alpaca working for you at all or just the examples in README.md are broken? If I can get clarity from @cspipaon I can go in and help fix them or update the documentation as I have bandwidth this summer and want to start using/learning alpaca