HellAmbro / Trading212API

Unofficial Trading212 API
MIT License
57 stars 27 forks source link

AttributeError: 'NoneType' object has no attribute 'isoformat' #25

Closed nsuth closed 1 year ago

nsuth commented 1 year ago

Traceback (most recent call last): File "Trading212.py", line 32, in orders = trading212.get_orders() ^^^^^^^^^^^^^^^^^^^^^^^ File "pytrading212\trading212.py", line 149, in get_orders params = {'olderThan': strftime(older_than.isoformat()), ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'isoformat'

not able to retrieve orders

HellAmbro commented 1 year ago

I will investigate on it asap. Thanks for reporting

HellAmbro commented 1 year ago

Hi, you should pass older_than and newer_than parameters Look at examples/example.py

older_than = datetime.datetime.now(tz=pytz.timezone("Europe/Rome"))
newer_than = datetime.datetime(year=2022, month=5, day=9, tzinfo=pytz.timezone("Europe/Rome"))
orders = trading212.get_orders(older_than=older_than, newer_than=newer_than)