areed1192 / interactive-broker-python-api

A python packaged used to interact with the Interactive Brokers REST API.
MIT License
389 stars 124 forks source link

Add sample run_scanner() call to test_client.py #5

Closed chuckmelanson closed 4 years ago

chuckmelanson commented 4 years ago

Hi Alex, great library!

Been having HTTP 500 errors trying to call run_scanner - would you be able to add a test call into test_client.py?

All other test_client.py calls and get_scanner() seem to work for me.

I saw you had sample output available - hoping this isn't too much trouble! Chuck


DEBUG function: _make_request endpoint: /iserver/scanner/run req_type: POST params: {'instrument': 'STK', 'type': 'TOP_PERC_GAIN', 'filter': [{'code': 'usdPriceAbove', 'value': 1}], 'location': 'STK.US.MAJOR', 'size': 25}

REQUEST - STATUS CODE: 500
RESPONSE URL: https://localhost:5000/v1/portal//iserver/scanner/run
RESPONSE HEADERS: {'Date': 'Sat, 02 May 2020 15:26:03 GMT', 'Server': 'Apache', 'x-response-time': '0ms', 'Vary': 'Origin', 'Connection': 'close', 'Transfer-Encoding': 'chunked'}
RESPONSE TEXT:

areed1192 commented 4 years ago

Well, this is a tricky one. I modified the code to now include this endpoint, since originally it wasn't released. However, I'm getting inconsistent behavior with it. Right now, the query works perfectly on the Web interface, however, through the API it always returns an empty list.

It might be something related to it being the weekend. I know endpoints will work inconsistently during the weekend compared to regular market hours. I need to do a little bit more research on this to see if I can get it to work.

Also, just an FYI the 'size':25 needs to be a string 'size':'25' .