alexgolec / schwab-py

Unofficial API wrapper for the Schwab HTTP API
MIT License
215 stars 49 forks source link

Verify whether date handling is correct for orders and transactions endpoints #21

Closed alexgolec closed 6 months ago

jacabreragt commented 7 months ago

When the following code is executed: resp = client.get_orders_for_account( account_hash, from_entered_datetime=datetime.now() - timedelta(days=8), to_entered_datetime=datetime.now(), )

gives the following error: Traceback (most recent call last): File "/Users/developer/Code/python/tg/schwab/examples.py", line 61, in <module> resp = client.get_orders_for_account( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/developer/.pyenv/versions/tg/lib/python3.11/site-packages/schwab/client/base.py", line 258, in get_orders_for_account return self._get_request(path, self._make_order_query( ^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/developer/.pyenv/versions/tg/lib/python3.11/site-packages/schwab/client/base.py", line 222, in _make_order_query 'toEnteredTime': self._format_datetime( ^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Client' object has no attribute '_format_datetime'. Did you mean: '_format_date_as_iso'?

Corrected in PR#22

tjmorgan12 commented 7 months ago

I'm getting the same error on line 222 of base.py.

Functions properly If modified to 'toEnteredTime': self._format_date_as_iso('to_entered_datetime', to_entered_datetime)

alexgolec commented 6 months ago

Looks about right now?