Closed Flowelfox closed 5 years ago
what operating system are you running this on ?
I investigated a little and it would seem that %s (small s) is operating system dependent and that is why you might be getting an error if using something different than macos / ubuntu.
However %S (big S) even if it works is something enterily different and it would not generate the same numbers expected from that function.
A good solution that is not operating system dependant is suggested in this stackoverflow answer :
I have adapted the code so we get similar results as the old code :
`
from datetime import datetime now = datetime.utcnow() now.strftime("%s") '1551110468' now.strftime("%S") '08' epoch = datetime.utcfromtimestamp(0) int((now - epoch).total_seconds() 10000) 15511176686818 int(float(now.strftime("%s.%f"))10000) 15511104686818`
what operating system are you running this on ?
I was getting this error on windows 10
You are welcome to submit a pull request for this issue that provides the same response but is platform agnostic.
You are welcome to submit a pull request for this issue that provides the same response but is platform agnostic.
I'll submit pull request tomorrow with code that you provided
When creating order getting error:
File "...venv\lib\site-packages\bitfinex\websockets\client.py", line 648, in new_order set_cid=set_cid
File "...venv\lib\site-packages\bitfinex\websockets\client.py", line 562, in new_order_op client_order_id = utils.create_cid()
File "...venv\lib\site-packages\bitfinex\utils\__init__.py", line 16, in create_cid return int(float(now.strftime("%s.%f"))*10000)
ValueError: Invalid format string
I did some research, it works fine with upper 'S'.
I am using Python 3.7.0 Library version 1.1.4