Open raffvyr787iuf opened 6 years ago
You have the same Problem as me. Its because there is a ".0" in your "exp" in your request.
I also changed this line in the buyv2.py:
exp = self.api.timesync.expiration_timestamp
to this:
exp = int(self.api.timesync.expiration_timestamp)
So now it looks like this:
import datetime
from iqoptionapi.ws.chanels.base import Base
class Buyv2(Base):
"""Class for IQ option buy websocket chanel."""
# pylint: disable=too-few-public-methods
name = "buyV2"
def __call__(self, price, active, option, direction):
"""Method to send message to buyv2 websocket chanel.
:param price: The buying price.
:param active: The buying active.
:param option: The buying option.
:param direction: The buying direction.
"""
exp = int(self.api.timesync.expiration_timestamp)
#Round to next full minute
if datetime.datetime.now().second > 30:
exp = exp - (exp % 60) + 60
else:
exp = exp - (exp % 60)
data = {
"price": price,
"act": active,
"exp": exp,
"type": option,
"direction": direction,
"time": self.api.timesync.server_timestamp
}
self.send_websocket_request(self.name, data)
The int() normally deletes the .0 in numbers. But somehow in my request there ist still a ".0" Anyone a Solution for this?
During starting below code:
I've got these results:
Can you help me with configuration? What I did wrong?