Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking Number Timestamp #33

Open
lsharples1 opened this issue Sep 19, 2022 · 2 comments
Open

Tracking Number Timestamp #33

lsharples1 opened this issue Sep 19, 2022 · 2 comments

Comments

@lsharples1
Copy link

In the Nasdaq Basic docs, I am seeing that "TrackingNumber/trackingID" for a quote is composed of the Nasdaq internal tracking number and the Timestamp in nanoseconds from midnight. I need to access the unix timestamp of this quote, and wanted to first see if there was a better way to access this than from manipulating the trackingID?

If not, I would like to confirm that the Timestamp in nanoseconds from midnight is assuming UTC?

Thanks.

@lsharples1
Copy link
Author

As a follow up, I would like to see if there is a recommended way within the python SDK to take the trackingID and return the timestamp. I have seen that the Java SDK there is a getTimestamp method. However, upon running this method with a trackingID the getTimestamp() method is returning the same as the trackingID (see attached image).

Alternatively, I have tried a python program to convert the timestamp to hex and attempting to take the 2-7 bytes for the timestamp: example trackingID = 42900650493027, converted to hex bytes 0x270496088463, in bytes 0x63, 0x84, 0x08, 0x96, 0x04, 0x27 where there are only 6 bytes.

Screen Shot 2022-09-20 at 12 20 28 PM

@trunghaonguyennasdaq
Copy link
Collaborator

Please see below for converting trackingID to timestamp in python:

def get_timestamp(tracking_id):
    return tracking_id & 0xffffffffffff
def get_counter(tracking_id):
    return tracking_id >> 48

In most cases, the returned value is going to be the same as the trackingID. In addition, the returned value is nanoseconds from midnight in EST (same timezone as New York).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants