(Resolved) Dhan API calls please suggest

This same code has been working for quite sometime now and all of sudden I am receiving these failures when placing the order via api call.

{‘status’: ‘failure’, ‘remarks’: {‘error_code’: ‘RS-9005’, ‘message’: ’ todo mandatory fields '}, ‘data’: ‘’}

1 Like

Hi @sugam192: Please check API tokens and status of this. Also for assistance on APIs, please drop a note on api@dhan.co

1 Like

Hi I am also running into the same issue as above please help.
Here is the details:

response1 = dhan.place_order(
                    transaction_type=dhan.BUY,
                    exchange_segment=dhan.NSE,
                    product_type=dhan.INTRA,
                    order_type=dhan.LIMIT,
                    security_id=212,
                    quantity=1,
                    price=182.8
                    )
{'status': 'failure', 'remarks': {'error_code': 'RS-9005', 'message': 'Invalid Request'}, 'data': ''}

Hello @saisaigraph

Trying the same request at our end. Can you please confirm the timing of this issue and check placing order again?

Thanks for the quick reply Hardik. I tried it at around 9AM to 905 AM approx.
Please let me know if you need more info.
Thnaks
Sai

Looks like it worked now @940 AM Hardik.

What is the starting time that we can start placing the order Hardik.

@Hardik faced the same issue thrice today


Hello @saisaigraph

APIs are up and running 24*7. If you are putting AMO flag as false, then you can place orders as per market timings.

@sv28

The systems are up and running. Requesting you to confirm if you are still facing any issues.

@Hardik can’t confirm until system places another order. However, what was the issue?

Hello @sv28

We are checking this. Prima facie, doesn’t look like an issue here, as orders via APIs were getting processed and placed. Let us know if and when your system places order and in case you get any issues.

@Hardik Here are the logs and the timestamp when the order was placed. One thing to note is that out of 5, 2 orders went through during the same time period. Seems like an intermittent error.

Please let me know if some more information is needed from my side

Even I got this error today, but I had retry logic in place which took care of it.
image

Getting the same problem again…
It worked for a few orders succesfully and just now started getting the problem again:

below is the info:

Placing Buy order at 2023-07-26 14:51:37.224727
response1 = dhan.place_order(
                    transaction_type=dhan.BUY,
                    exchange_segment=dhan.NSE,
                    product_type=dhan.INTRA,
                    order_type=dhan.LIMIT,
                    security_id=15254,
                    quantity=1,
                    price=2506.15
                    )
{'status': 'failure', 'remarks': {'error_code': 'RS-9005', 'message': 'Something went wrong. Error code [9003]. Application not responding. [0004]'}, 'data': ''}

'''

Another error:

Placing Buy order at 2023-07-26 15:04:21.906161
response1 = dhan.place_order(
                    transaction_type=dhan.BUY,
                    exchange_segment=dhan.NSE,
                    product_type=dhan.INTRA,
                    order_type=dhan.LIMIT,
                    security_id=15254,
                    quantity=1,
                    price=2506.05
                    )
{'status': 'failure', 'remarks': {'error_code': 'RS-9005', 'message': 'com.fasterxml.jackson.core.JsonParseException: Unexpected character (\'<\' (code 60)): expected a valid value (JSON String, Number, Array, Object or token \'null\', \'true\' or \'false\')\n at [Source: (String)"<html>\r\n<head><title>504 Gateway Time-out</title></head>\r\n<body>\r\n<center><h1>504 Gateway Time-out</h1></center>\r\n</body>\r\n</html>\r\n"; line: 1, column: 2]'}, 'data': ''}```

Any update please Hardik.

Hello @saisaigraph

Apologies for the delay in updating you here. This happened because of order queue at OMS level. Since this is on API layer, connection time out happened and orders weren’t placed.

We are looking at debugging this and ensuring such occurrences do not happen in future.

Today also running into this issue Hardik

Placing Buy order at 2023-07-27 09:08:50.571760
response1 = dhan.place_order(
                    transaction_type=dhan.BUY,
                    exchange_segment=dhan.NSE,
                    product_type=dhan.INTRA,
                    order_type=dhan.LIMIT,
                    security_id=15254,
                    quantity=1,
                    price=2517.8
                    )
{'status': 'failure', 'remarks': {'error_code': 'RS-9005', 'message': 'Market is Closed! Want to place an offline order?'}, 'data': ''}

Hello @saisaigraph

As you may know, market opens at 09:15 and hence the error. Since you tried placing orders at 09:08:50, you can instead place AMO order here.