rleonard21 / PyTradier

A Python library for interfacing with Tradier.com's trading API.
pytradier.readthedocs.io
GNU General Public License v3.0
53 stars 30 forks source link

Does the Stock Method work? #23

Open JasonSimms opened 11 months ago

JasonSimms commented 11 months ago

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)

RaccoonWang commented 11 months ago

same error here, but for stock data. this documentation needs updating, there are no real tutorials anywhere