Working with timestamps
See original GitHub issueHi, Thank you for your amazing library !
I have a hard time converting timestamps to valid datetimes and wouldn’t mind a bit of help. Here is what I’m doing :
- Create a stream for orderbook depth via
create_stream()
withdepth20@100ms
- Fetch the lastest data from the stream via
oldest_stream_data_from_stream_buffer = binance_websocket_api_manager.pop_stream_data_from_stream_buffer()
- Get the timestamp of the lastest data using
oldest_stream_data_from_stream_buffer['last_update_id']
This gives me a timestamp like 2046077850
. Fair enough, let’s convert it to a datetime object :
print(datetime.datetime.utcfromtimestamp(2046077850))
results in 2034-11-02 10:57:30
, which is nowhere near the current time.
How can I have the correct datetime, with milliseconds ?
Sorry if this not fully related to this library, I can delete my issue as soon as it’s resolved if you want.
DrPaprikaa
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Working with Timestamps - Oracle Help Center
Working with Timestamps. To specify a timestamp value in a query, provide it as a string, and cast it to a Timestamp data...
Read more >Handy Dandy Guide to Working With Timestamps in pandas
This article is your handy dandy guide to working with timestamps in pandas. We'll cover the most common problems people deal with when ......
Read more >Working with Timestamps - Services.amazon.com
The Timestamp attribute must contain the client's machine time in ISO 8601 date time format; requests with a timestamp significantly different (15 minutes)...
Read more >Timestamps, Time Zones, Time Ranges, and Date Formats
Learn how Sumo Logic manages timestamps, time zones, time ranges, and dates, and the configuration options that are available.
Read more >Using Dates and Timestamps - Snowflake Documentation
Calculating Business Calendar Dates and Times Get the first day of the month as a DATE value using the DATE_TRUNC function. For example,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
for that the stream_buffer doesnt help but if its not empty or not almost empty you know there is a delay…
I think a pop() delivers the latest entry, a pop(0) delivers the oldest entrie… anyway. It seems there are faster and better ways to do so. https://docs.python.org/2/tutorial/datastructures.html#using-lists-as-queues
Released: https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api/releases/tag/1.32.0