areed1192 / td-ameritrade-python-api

Unofficial Python API client library for TD Ameritrade. This library allows for easy access of the Standard API and allows users to build data pipelines for the Streaming API.
MIT License
684 stars 252 forks source link

the query param being passed is not in the correct format #176

Closed BaconGabe closed 3 years ago

BaconGabe commented 3 years ago

This works perfectly fine: TDSession.get_accounts(account=account_id)

But adding a field like positions returns an error: TDSession.get_accounts(account=account_id, fields=['positions'])

Error: Traceback (most recent call last): File "C:\Users\Gabe\Desktop\Stock\test.py", line 47, in print(TDSession.get_accounts(account=account_id, fields=['positions'])) File "C:\Users\Gabe\AppData\Local\Programs\Python\Python39\lib\site-packages\td\client.py", line 1144, in get_accounts return self._make_request(method='get', endpoint=endpoint, params=params) File "C:\Users\Gabe\AppData\Local\Programs\Python\Python39\lib\site-packages\td\client.py", line 617, in _make_request raise NotNulError(message=response.text) td.exceptions.NotNulError: { "error":"the query param being passed is not in the correct format" }

Process finished with exit code 1

I've tried a lot and even different libraries but have no idea why this is happening. The same command works perfectly fine on the TD Ameritrade website, so why doesn't it work in the library?

print(TDSession.get_accounts(account=account_id, fields=['orders'])) also gives the same error

areed1192 commented 3 years ago

Interesting, what version of the library are you using? If you're not sure, just run the following code:

import td

print(td.__version__)
BaconGabe commented 3 years ago

The version is 0.3.5, which is what installs when using pip

KrishVenkatesh commented 2 years ago

I am getting the same error, what was the solution to this issue. I see that the ticket was closed, it might be useful in knowing the solution for this issue?