Why starTime and endTime behaves differently in different endpoints ?

1- For GET /sapi/v1/lending/union/purchaseRecord (Get Purchase Record (USER_DATA)):
When startTime=endTime in the request it works normally and the “createTime” in the response is identical to the value sent in startTime & endTime.

That is okay and expected.

2- On the other hand, for GET /api/v3/allOrders (All Orders (USER_DATA)):
When startTime=endTime in the request it returns an error: “code”: -1102, “msg”: “Mandatory parameter ‘endTime’ was not sent, was empty/null, or malformed.”

This is not expected because I assume that you can make startTime=endTime with no problem. My understanding is that Binance response is always the items that are having their time equal to and including startTime and the items having their time equal to and including endTime and all the items between them.

Any idea what is the reason behind this?

working with other endpoints, I found more and more discrepancies like this
Any one has any experience in this regard?

For GET /api/v3/allOrders, please make sure endTime is later than startTime.

1 Like

Thank you so much for this valuable feedback.

Two observations are worth mentioning here:

1- For example, if startTime=1234567891234 and endTime=1234567891234 then this means that you are fetching all the orders having the date from and including 1234567891234 to and including 1234567891234 but if you made startTime=1234567891234 and endTime=123456789123’5’ as per your esteemed feedback then you are asking for additional orders that you do not need.

My question is, how to solve this issue? how to retrieve orders for only the desired point of time. I understand that we are speaking about milliseconds after all we can retrieve additional unneeded orders and simply ignore them - but my question is: Is there an approach or any workaround using which we can have startTime=endTime?

2- in API design, the tendency for standardization and unified behavior is always favored over the tendency to have different behaviors for the same thing with each endpoint (unless there is a technical limitation of course which is not the case here). If startTime and endTime are allowed to be equal for some endpoints then I think it will be more favorable by all the stakeholders to have all endpoints behaving the same … and if not allowed then okay, all endpoints need to the same. This will make the life of all developers and other stakeholders easier and efficient. All you need is to learn the behavior once and then apply the same understanding to all endpoints with no exception.

Thanks to you for the fruitful discussion and ideas.