utilmon / EasyIB

Python wrapper for Interactive Brokers Client Portal Web API
BSD 3-Clause "New" or "Revised" License
89 stars 24 forks source link

get_bars() not working #2

Closed spitzbubchen closed 3 years ago

spitzbubchen commented 3 years ago

This is very nice work! I tried most of the functions and they work well, however, when I run the get_bars() example I get the following error:

Traceback (most recent call last):
  File "test.py", line 30, in <module>
    bars = ib.get_bars("AAPL", period="1w", bar="1d")
  File "/home/rod/Projects/tradingview/ibapi.py", line 252, in get_bars
    return response.json()
  File "/home/rod/Projects/tradingview/venv/lib/python3.8/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.8/json/__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.8/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.8/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)
utilmon commented 3 years ago

Thanks! It's interesting only one of the functions is not working. It looks like you are getting an empty response from the server. What do you get when you run the following at the shell terminal? curl -X GET "https://localhost:5000/v1/api/iserver/marketdata/history?conid=265598" -k Here conid=265598 implies AAPL.

spitzbubchen commented 3 years ago

It's working now. It seems the issue was that I had another IBKR session open that was blocking historical tick requests. I'll close the issue.