Why is placeorder taking 5 minute to execute?

For exchange order Id 2100000110942685

2024-12-20 12:26:53,191 - BROKER - upstox: Going to place order with params instrument_token=NSE_FO|67069, productType=ProductType.NRML, direction=SHORT, orderType=OrderType.MARKET, qty=15, price=0, triggerPrice=0 

2024-12-20 12:30:38,358 - BROKER - upstox: Order placed successfully, orderId = 241220025454911

For exchange orderid 1600000139771776, the log is as follows

2024-12-20 12:36:11,788 - BROKER - upstox: Going to place order with params instrument_token=NSE_FO|67069, productType=ProductType.NRML, direction=SHORT, orderType=OrderType.MARKET, qty=15, price=0, triggerPrice=0 

2024-12-20 12:39:57,001 - BROKER - upstox: Order placed successfully, orderId = 241220025466634 

How can anyone trade with such delays?

I am using 2.9.0 python sdk to place orders.

I am facing the issue today also

2024-12-23 10:37:03,813 - BROKER - upstox: Going to place order with params instrument_token=NSE_FO|67069, productType=ProductType.NRML, direction=SHORT, orderType=OrderType.MARKET, qty=15, price=0, triggerPrice=0 

2024-12-23 10:40:48,987 - BROKER - upstox: Order placed successfully, orderId = 241223025242429

Other API endpoints are working as normal.

@Pradeep_Jaiswar Can you kindly look into this. The logs have orderId, so it should be easy to track.

Hi @Kislay
We have reviewed the orders you shared in this thread and found no abnormal latency. All your orders were executed in approximately 30ms.

For example, your order 241223025242429 was received by our server at 23/12/2024 10:40:48.972 and executed at 23/12/2024 10:40:49.149.

To track the latency of placed orders, we recommend using the new V3 Place Order API, which provides latency details in the response for each order.

Additionally, we suggest checking your local network and code for potential latency issues, as you reported a delay of 5 minutes.

Thank you!

Hi @Ketan ,
Thanks for looking into the issue. I did some debugging and here are my observations.

  • Since the placeorder was taking minutes to go through using python sdk, I tried making direct post request. I was getting TimeOut Exception, when making direct post request to https://api-hft.upstox.com/v2/order/place.

    • So it seems the SDK has timeout=None
  • Since other API endpoints were working fine. So I thought there must be some difference in the place order API.

    • Placeorder API uses api-hft.upstox.com while other API endpoints that were working fine were using api.upstox.com
  • I tried placing orders using https://api.upstox.com/v2/order/place, and it worked, without timing out.

    • So there is some issue with https://api-hft.upstox.com/. I even tried the v3 place order API, but it was having the same issue as it also uses https://api-hft.upstox.com/
  • I tried ping api-hft.upstox.com and here are the results

ping api-hft.upstox.com
PING p-udapi-order-gateway--ext-ngav2-2147028156.ap-south-1.elb.amazonaws.com (3.111.191.11): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
Request timeout for icmp_seq 8
Request timeout for icmp_seq 9
Request timeout for icmp_seq 10
Request timeout for icmp_seq 11
- I am not sure if this is intentional or the server is misconfigured.
  • Regarding your observation that the orders are going through fine, yes, it is going through fine once it reaches your system, but here the issue is the order is not being able to reach your system.

  • The issue is not 100 percent reproducible at my end, it occurs erratically, one out of 5 orders sometimes 2 out of 5 orders.

I can understand that the issue might not be reproducible at your end, so if you need me to debug further, please let me know.

This is an unusual behavior; this is the first time itā€™s been reported to the community. Weā€™ve tested it across multiple networks, but we havenā€™t been able to reproduce the issue. Meanwhile, other vendors and clients successfully use the same URL without any problems.

Regarding the ping timeout, it seems that ICMP (ping) traffic for the HFT URL is blocked. Could you try running a traceroute to api-hft.upstox.com and share the output?

traceroute api-hft.upstox.com

Also, could you provide the response for the following curl command:

curl -v https://api-hft.upstox.com

Additionally, could you please provide more information about your current setup? Specifically:

  • From which geolocation are you accessing the API?
  • What network are you using to reach the API? (If youā€™re using an office network, please mention that as well.)

We are looking forward to your response. The goal is to understand why this is only affecting you and to find a solution to resolve the issue.

1 Like

This is an unusual behavior; this is the first time itā€™s been reported to the community.

Here are similar posts, which report delay in execution, but there is no delay in execution on server side. so these delays are attributable to connectivity issue between the user and upstox, similar to mine.


% traceroute api-hft.upstox.com
traceroute: Warning: api-hft.upstox.com has multiple addresses; using 3.110.241.82
traceroute to p-udapi-order-gateway--ext-ngav2-2147028156.ap-south-1.elb.amazonaws.com (3.110.241.82), 64 hops max, 40 byte packets
 1  reliance.reliance (192.168.29.1)  4.458 ms  2.756 ms  3.115 ms
 2  10.233.56.1 (10.233.56.1)  4.692 ms  5.300 ms  3.977 ms
 3  172.31.2.14 (172.31.2.14)  4.636 ms
    172.31.1.210 (172.31.1.210)  5.805 ms  6.216 ms
 4  192.168.65.150 (192.168.65.150)  4.910 ms
    192.168.65.154 (192.168.65.154)  4.701 ms
    192.168.65.152 (192.168.65.152)  5.181 ms
 5  172.26.74.6 (172.26.74.6)  5.123 ms  4.215 ms  3.876 ms
 6  172.26.77.227 (172.26.77.227)  6.546 ms  5.594 ms  6.202 ms
 7  192.168.65.144 (192.168.65.144)  4.754 ms
    192.168.65.138 (192.168.65.138)  6.005 ms
    192.168.65.142 (192.168.65.142)  5.060 ms
 8  * * *
 9  * * *
10  * 99.83.67.46 (99.83.67.46)  17.652 ms
    99.83.67.48 (99.83.67.48)  26.558 ms
11  52.93.141.105 (52.93.141.105)  12.365 ms
    52.93.19.251 (52.93.19.251)  12.911 ms
    52.93.19.243 (52.93.19.243)  11.631 ms
12  52.93.19.45 (52.93.19.45)  13.377 ms
    52.93.19.93 (52.93.19.93)  13.181 ms
    52.93.19.111 (52.93.19.111)  33.511 ms
13  * * *
14  * * *
15  * * *
16  * * *
17  * * *
18  * * *
19  * * *
20  * * *
21  * * *
22  * * *
23  * * *
24  * * *
25  * * *
26  * * *
27  * * *
28  * * *
29  * * *
30  * * *
31  * * *
32  * * *
33  * * *
34  * * *
35  * * *
36  * * *
37  * * *
38  * * *
39  * * *
40  * * *
41  * * *
42  * * *
43  * * *
44  * * *
45  * * *
46  * * *
47  * * *
48  * * *
49  * * *
50  * * *
51  * * *
52  * * *
53  * * *
54  * * *
55  * * *
56  * * *
57  * * *
58  * * *
59  * * *
60  * * *
61  * * *
62  * * *
63  * * *
64  * * *


% curl -v https://api-hft.upstox.com
* Host api-hft.upstox.com:443 was resolved.
* IPv6: 2406:da1a:8e4:5403:d13f:6458:4d3f:5764, 2406:da1a:8e4:5401:aa73:49ed:4561:1406, 2406:da1a:8e4:5400:f64c:8f79:a81:22ee
* IPv4: 3.110.241.82, 13.126.203.253, 3.109.131.61
*   Trying [2406:da1a:8e4:5403:d13f:6458:4d3f:5764]:443...
* Connected to api-hft.upstox.com (2406:da1a:8e4:5403:d13f:6458:4d3f:5764) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES128-GCM-SHA256 / [blank] / UNDEF
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=*.upstox.com
*  start date: May 27 00:00:00 2024 GMT
*  expire date: Jun 24 23:59:59 2025 GMT
*  subjectAltName: host "api-hft.upstox.com" matched cert's "*.upstox.com"
*  issuer: C=US; O=Amazon; CN=Amazon RSA 2048 M03
*  SSL certificate verify ok.
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://api-hft.upstox.com/
* [HTTP/2] [1] [:method: GET]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: api-hft.upstox.com]
* [HTTP/2] [1] [:path: /]
* [HTTP/2] [1] [user-agent: curl/8.7.1]
* [HTTP/2] [1] [accept: */*]
> GET / HTTP/2
> Host: api-hft.upstox.com
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/2 404 
< server: awselb/2.0
< date: Fri, 27 Dec 2024 12:14:10 GMT
< content-type: text/plain; charset=utf-8
< content-length: 0
< 
* Connection #0 to host api-hft.upstox.com left intact

I am accessing API from Bengaluru using Jio Fiber.

Regarding the ping timeout, it seems that ICMP (ping) traffic for the HFT URL is blocked.

On one earlier occasion(a few months ago), it was working for me, so it would be good idea to confirm with the team.

@Pradeep_Jaiswar Did the team find the cause of this issue?

clock synchronization of upstox server can be investigated as one potential cause. It is causing other issues like ticks coming from future.