atomicDEX-API icon indicating copy to clipboard operation
atomicDEX-API copied to clipboard

`orders_history_by_filter::from_timestamp` doesn't work properly

Open rozhkovdmitrii opened this issue 1 year ago • 1 comments

Describe the bug

There is a orders_history_by_filter command to get a list of orders with a detailed information. from_timestamp filter is supposed to select all orders that were created after mentioned date. If I try to set this filter as a value that intentionally older than the current moment i often gets a list of orders that were created before the stated filter.

to_timestamp does not work as well

Example

image


P.S.: It was also checked using the other tools like postman, wireshark

@smk762, @shamardy @allikkuu

rozhkovdmitrii avatar Jun 13 '23 13:06 rozhkovdmitrii

The bug here appears to be that the to_timestamp and from_timestamp is expecting microseconds since epoch instead of seconds.

E.g.

    "from_timestamp": 1699348509000, 
    "to_timestamp": 1699348509000 

will work as expected but

    "from_timestamp": 1699348509, 
    "to_timestamp": 1699348509 

will return an unexpected result.

Currently docs have this description for the fields image and though this is accurate, it does not explicitly specify to use ms rather than sec. In responses the referenced fields are also in ms.

"created_at":1699348509394,
"last_updated":1699348513306,

Ideally, we should use the same unit of measure for timestamps across all API methods and responses. Alternatively, a method should accept either value and detect when it needs to be converted in the back end before processing.

smk762 avatar Jan 17 '24 10:01 smk762