Support Board
Date/Time: Sat, 23 Nov 2024 18:03:30 +0000
Post From: Python for Sierra Chart
[2021-06-18 20:09:53] |
biconoid - Posts: 5 |
As per https://docs.python.org/3/library/struct.html there are only three options to unpack 64 bits (8 bytes), i.e. q, Q and d. What would be correct structure to unpack? Format C Python Standard
Type Type Size(bytes) --------------------------------------------------- Q unsigned long long integer 8 q long long integer 8 d double float 8 Also Sierra documentation mentions Versions prior to 2151, use a double precision floating point type variable to represent Date-Time values.
Just for testing purposes i've tested using q and Q. $ cat files/data.tsv
Date Open High Low Close Volume NumberOfTrades BidVolume AskVolume 3795467579000000.0 2623.0 0.0 2623.0 2623.0 1 1 1 0 3795948047000000.0 2717.0 0.0 2717.0 2717.0 1 1 1 0 3796150099000000.0 2750.0 0.0 2750.0 2750.0 1 1 1 0 3796636617000000.0 2742.5 2757.75 2742.5 2742.5 1 1 1 0 When unpacking using Q or q. >>> datetime.fromtimestamp(3795467579)
datetime.datetime(2090, 4, 9, 20, 32, 59) >>> and >>> datetime.fromtimestamp(3795467579000000.0 )
Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: year 120275549 == out of range >>> Date Time Of Last Edit: 2021-06-18 20:26:19
|