dydxprotocol / v4-chain

dydx v4 protocol
Other
224 stars 103 forks source link

returnLatestOrders query param not working for indexer's ListOrders endpoint #1824

Open dmu1313 opened 3 months ago

dmu1313 commented 3 months ago

I believe there is a problem with the returnLatestOrders query param in the listOrders endpoint. If you test on any address, you'll see that it returns the same results regardless of whether you use "true" or "false". This seems like a bug unless I am misunderstanding how it's supposed to work.

Here are some examples from a random address with trading activity:

dydx1c8dhfxzh69gqnw7g7sn02v60muv2ek6s2grym8

SOL-USD, returnLatestOrders=true

https://indexer.dydx.trade/v4/orders?address=dydx1c8dhfxzh69gqnw7g7sn02v60muv2ek6s2grym8&subaccountNumber=0&ticker=SOL-USD&tickerType=PERPETUAL&limit=100&returnLatestOrders=true

SOL-USD, returnLatestOrders=false

https://indexer.dydx.trade/v4/orders?address=dydx1c8dhfxzh69gqnw7g7sn02v60muv2ek6s2grym8&subaccountNumber=0&ticker=SOL-USD&tickerType=PERPETUAL&limit=100&returnLatestOrders=false

You can see that the responses from these requests are identical. They should be sorted in reverse order. The queries above use limit=100. If an address has fewer than 100 orders returned, you can just reduce the limit to something like limit=1, and you'll see that it still returns the same response even though one query should return the oldest order and the other query should return the newest order.

Another example: the below query has returnLatestOrders set to true but does not specify the market. The response contains some of the old orders in the above queries, but it does not contain some of the new orders in the above queries. It should be the other way around.

all markets, returnLatestOrders=true https://indexer.dydx.trade/v4/orders?address=dydx1c8dhfxzh69gqnw7g7sn02v60muv2ek6s2grym8&subaccountNumber=0&tickerType=PERPETUAL&limit=100&returnLatestOrders=true

linear[bot] commented 3 months ago

GH-43 returnLatestOrders query param not working for indexer's ListOrders endpoint

davidsblom commented 3 weeks ago

Also running into this issue. Any updates?