-
Notifications
You must be signed in to change notification settings - Fork 540
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
Buy position does not work any more? #55
Comments
They added (or req. now) another params in buyV2: |
Hello @kanXuT , please, could you explain what should I do? PS: How can I get the skey and user_balance_id? |
Sorry not using this api and not famiiar with Python, so this is just where you can look for:
And if skey and balance_id is not set/deffined, you need fill them up first from profile message ;) |
what we should to do exactly |
@kanXuT i try a version of api have skey and balance difined and the property in profil and i add self.__balance_id = None profile.py from iqoptionapi.ws.objects.base import Base
class Profile(Base):
"""Class for IQ Option Profile websocket object."""
def __init__(self):
super(Profile, self).__init__()
self.__name = "profile"
self.__skey = None
self.__balance = None
self.__balance_id = None
@property
def skey(self):
"""Property to get skey value.
:returns: The skey value.
"""
return self.__skey
@skey.setter
def skey(self, skey):
"""Method to set skey value."""
self.__skey = skey
@property
def balance(self):
"""Property to get balance value.
:returns: The balance value.
"""
return self.__balance
@balance.setter
def balance(self, balance):
"""Method to set balance value."""
self.__balance = balance
@property
def balance_id(self):
"""Property to get balance_id value.
:returns: The balance_id value.
"""
return self.__balance_id
@balance_id.setter
def balance_id(self, balance):
"""Method to set balance_id value."""
self.__balance_id = balance_id buyV2.py 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.
"""
data = {"price": price,
"act": active,
"exp": self.api.timesync.expiration_timestamp,
"type": option,
"direction": direction,
"time": self.api.timesync.server_timestamp,
"skey": self.api.profile.skey,
"user_balance_id": self.api.profile.balance_id
}
self.send_websocket_request(self.name, data) always buy not happened |
@yesamine , just a comment: I have the same version, you don't need to modify the call function to: The thing is, skey and user_balance_id aren't 'None', if you see the log when it connect to the server you will se the values there but I don't know how to retrieve it. |
now i tested the iqoptionbot in TEST mode work good and trade but buy (call , put) work fin thats mean i miss somthing in my simple buy code import time
from iqoptionapi.api import IQOptionAPI
api = IQOptionAPI("iqoption.com", "myemail@example.com", "mypass")
api.connect()
time.sleep(1)
balance = api.profile.balance
time.sleep(1)
print (balance)
api.setactives([1, 2])
time.sleep(1)
api.subscribe('tradersPulse')
reslt = api.buy(1, 1, "turbo", "call")
time.sleep(2)
print reslt |
IQ Option seems changed their API. The current code does not work any more... Have anyone a solution?
The text was updated successfully, but these errors were encountered: