Skip to content

Does the Stock Method work? #23

Description

@JasonSimms

I'm having trouble debugging the tradier.stock method. It seems that init is not executing in the Quote class to add the correct self._path from quote.py. the request tradier.stock('V', 'VZ') is being made without a complete URL path. I'm probably using it wrong but this was the examples I saw.

from pytradier.tradier import Tradier
tradier = Tradier(token, account_id, endpoint)
stocks = tradier.stock('V', 'VZ') # create instance of the Stock class
print(stocks.volume())

Generates the following error------------------

Traceback (most recent call last):
File "D:\code\roberto\rsi_calculator.py", line 15, in
print(stocks.volume())
^^^^^^^^^^^^^^^
File "D:\code\roberto\pytradier\securities\quote.py", line 115, in volume
return self._parse_response(attribute='volume', **config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\code\roberto\pytradier\securities\quote.py", line 34, in _parse_response
self.update_data() # updates by default, user must specify to not update from the API
^^^^^^^^^^^^^^^^^^
File "D:\code\roberto\pytradier\base.py", line 59, in update_data
self._data = self._api_response(self._endpoint, self._path, self._payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\code\roberto\pytradier\base.py", line 45, in api_response
j = json.loads(r.content)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\json_init
.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions