Is there a way to access fault data on API requests, instead of returning `None`?
See original GitHub issueFor example the Trading API might return a negative response while creating or updating orders, see for example the error response in https://github.com/Chavithra/degiro-connector/pull/50#issuecomment-997392518
{"errors": [{"text": "Le prix renseigné (300.0500) ne respecte pas la tick size (écart minimal entre les décimales). Le prix doit être un multiple de (0.1000)."}]}
However, this is only observed in the CRITICAL Logging.
The functions check_order()
, confirm_order()
and update_order()
will return just None
in case of an error.
It’s important to know what the cause of the error is. Is it for example an error with the order (such as the example above), which is refused by DeGiro? Or is it caused by a server error (HTTP Status codes) or even no internet connection (HTTP Connection error)?
This data seems already present in the underlying code of the Connector, as can be seen in the Logging messages. Would it be possible to use this in the response of the functions?
For example the standard output of these functions can be a dict with 3 parameters. Here the response of a successful request:
{
"http_status" : 200
"result" : True
"error" : None
}
where result
can also contain a dict, for example with the current response from check_order()
In case of a DeGiro error, it will look like:
{
"http_status" : 200
"result" : False
"error" : 'Le prix renseigné (300.0500) ne respecte pas la tick size (écart minimal entre les décimales). Le prix doit être un multiple de (0.1000).'
}
In case of a Network error, it will look like:
{
"http_status" : 500
"result" : False
"error" : 'The server has an internal error.'
}
This information is useful for our script, to decide what fault action to take. E.g.
- updating an order
- a retry
- an abort (“call the manager” 😃)
Please let me know if this is possible.
Issue Analytics
- State:
- Created 2 years ago
- Comments:27 (23 by maintainers)
Top GitHub Comments
My bad, will respect the process.
That’s a great work @funnel20 ! Will check that in detail the following days and give you my feedback.