question

Upvotes
Accepted
98 5 6 15

issue using IPA API using RD and RDP library

dear developer community


i'm facing issue to use IPA API using RD and RDP libraries.

Indeed, i upgrade my machine to Win10 (64 bits) and i insattled the latest version for RD(1.1.1) and RDP (1.0.0a21) running on Python 3.10

the script that run well before rise error and exceptions once i upgrade windows and library versions.


many thanks for your assistance and help.



url= "https://api.refinitiv.com/data/quantitative-analytics/v1/financial-contracts"

the boy request:

{"fields": ["InstrumentTag","InstrumentCode","UnderlyingRIC","Strike", "CallPut","ExerciseStyle","UnderlyingPrice","MarketDataDate","MarketValueInDealCcy","VolatilityType","VolatilityPercent","DividendType","PricingModelTypeList","DividendCurveId","DiscountCurveId"],"universe": [{

"instrumentType": "Option",

"instrumentDefinition": {

"InstrumentTag":"ES_O_InputPrice",

"underlyingType": "Eti",

"instrumentCode":"ES4900C3"

},

"pricingParameters": {

"underlyingPrice":"4015.0"

}

},{

"instrumentType": "Option",

"instrumentDefinition": {

"InstrumentTag":"ES_O_InputPrice",

"underlyingType": "Eti",

"instrumentCode":"ES5050C3"

},

"pricingParameters": {

"underlyingPrice":"4015.0"

}

},{

"instrumentType": "Option",

"instrumentDefinition": {

"InstrumentTag":"ES_O_InputPrice",

"underlyingType": "Eti",

"instrumentCode":"ES4500C3"

},

"pricingParameters": {

"underlyingPrice":"4015.0"

}

},{

"instrumentType": "Option",

"instrumentDefinition": {

"InstrumentTag":"ES_O_InputPrice",

"underlyingType": "Eti",

"instrumentCode":"ES4600C3"

},

"pricingParameters": {

"underlyingPrice":"4015.0"

}

}],

"pricingParameters": {

"volatilityType":"SVISurface"

},

"outputs" : ["Data","Headers"]


}







An error occurred while requesting URL('http://localhost:9060/api/rdp/data/quantitative-analytics/v1/financial-contracts').

ReadTimeout('timed out')

Traceback (most recent call last):

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpcore\_exceptions.py", line 8, in map_exceptions

yield

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpcore\backends\sync.py", line 26, in read

return self._sock.recv(max_bytes)

TimeoutError: timed out


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpx\_transports\default.py", line 60, in map_httpcore_exceptions

yield

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpx\_transports\default.py", line 218, in handle_request

resp = self._pool.handle_request(req)

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpcore\_sync\connection_pool.py", line 253, in handle_request

raise exc

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpcore\_sync\connection_pool.py", line 237, in handle_request

response = connection.handle_request(request)

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpcore\_sync\connection.py", line 90, in handle_request

return self._connection.handle_request(request)

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpcore\_sync\http11.py", line 105, in handle_request

raise exc

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpcore\_sync\http11.py", line 84, in handle_request

) = self._receive_response_headers(**kwargs)

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpcore\_sync\http11.py", line 148, in _receive_response_headers

event = self._receive_event(timeout=timeout)

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpcore\_sync\http11.py", line 177, in _receive_event

data = self._network_stream.read(

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpcore\backends\sync.py", line 24, in read

with map_exceptions(exc_map):

File "C:\Program Files\Python310\lib\contextlib.py", line 153, in __exit__

self.gen.throw(typ, value, traceback)

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpcore\_exceptions.py", line 12, in map_exceptions

raise to_exc(exc)

httpcore.ReadTimeout: timed out


The above exception was the direct cause of the following exception:


Traceback (most recent call last):

File "H:/PARAM/DFR/Python/test.py", line 58, in <module>

body_parameters = json.loads(Global_Query)).get_data()

File "C:\Program Files\Python310\lib\site-packages\refinitiv\data\delivery\_data\_endpoint_definition.py", line 101, in get_data

response = self._provider.get_data(

File "C:\Program Files\Python310\lib\site-packages\refinitiv\data\delivery\_data\_data_provider.py", line 72, in get_data

raw_response = self.connection.send(request, session, *args, **kwargs)

File "C:\Program Files\Python310\lib\site-packages\refinitiv\data\delivery\_data\_connection.py", line 17, in send

return session.http_request(request)

File "C:\Program Files\Python310\lib\site-packages\refinitiv\data\_core\session\_session.py", line 485, in http_request

return self._http_service.request(request)

File "C:\Program Files\Python310\lib\site-packages\refinitiv\data\_core\session\http_service.py", line 342, in request

raise error

File "C:\Program Files\Python310\lib\site-packages\refinitiv\data\_core\session\http_service.py", line 317, in request

response = self._client.send(request)

File "C:\Program Files\Python310\lib\site-packages\refinitiv\data\_core\session\http_service.py", line 207, in send

response = client.send(request)

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpx\_client.py", line 902, in send

response = self._send_handling_auth(

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpx\_client.py", line 930, in _send_handling_auth

response = self._send_handling_redirects(

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpx\_client.py", line 967, in _send_handling_redirects

response = self._send_single_request(request)

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpx\_client.py", line 1003, in _send_single_request

response = transport.handle_request(request)

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpx\_transports\default.py", line 217, in handle_request

with map_httpcore_exceptions():

File "C:\Program Files\Python310\lib\contextlib.py", line 153, in __exit__

self.gen.throw(typ, value, traceback)

File "C:\Users\YAZANEAN\AppData\Roaming\Python\Python310\site-packages\httpx\_transports\default.py", line 77, in map_httpcore_exceptions

raise mapped_exc(message) from exc

httpx.ReadTimeout: timed out

#technologyrdp-apirdp
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
80.1k 257 52 75

@anass.yazane.1

Thanks for reaching out to us.

To verify what the problem is, you need to enable the debug log level in the Refinitiv Data Library. You can do this in the RD configuration file (refinitiv-data.config.json).

{
...
    "logs": {
        "level": "debug",
        "transports": {
            "console": {
                "enabled": false
            },
            "file": {
                "enabled": true,
                "name": "refinitiv-data-lib.log"
            }
        }
    },
    "sessions": {
        "default": "desktop.workspace",
...
}

Then, you can check the refinitiv-data-lib.log file.

I hope that this information is of help.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
98 5 6 15

dear @Jirapongse

i see a content difference in rdplibconfig.prod.json file between both versions, with a new option in the new version 'request-timeout', defaulted to 20.

when a change the value to 200 the script works without any error

rather than manage value at json file level, is it possible to fix timeout value in my script using rdp library




icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
80.1k 257 52 75

@anass.yazane.1

You can reset its value by using the following code.

rdp.configure.config["http.request-timeout"] = 200
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
98 5 6 15

dear @Jirapongse

it works perfectly, than you a lot.

a have another question regarding refinitiv-data.

can i use the same code for refinitiv data to customise the timeout request value.

i don't find refinitiv-data.config.json file as it's the case for refinitiv data platform.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
80.1k 257 52 75

@anass.yazane.1

The sample refinitiv-data.config.json is available on GitHub.

You can add the following configurations to change the value of the http.request-timeout configuration.

{
    "http": {       
        "request-timeout": 60
    },
    "logs": {
...
    }
...
}

The code to change the value of the http.request-timeout configuration is:

rd.get_config()["http.request-timeout"] = 30


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.