n1nj4z33 / iqoptionapi

IQ Option API 4.x (Python 2.7) The project is obsolete and is not supported because of problems with access to IQ Options in Russia
120 stars 551 forks source link

Anyone know how to cancel a trade in the 3 second period? #32

Open MadOne199 opened 7 years ago

MadOne199 commented 7 years ago

Hi I am trying to determine how to cancel a trade within the 3 seconds allowed. The buyback doesn't seem to work? I assume that the id within the buyComplete message is used, but cannot make it work.

can anyone help?

Here I give an example of the returrn of the websocket after a call placed on active 4...

{"name":"buyComplete","msg":{"isSuccessful":true,"message":["Successful"],"result":{"refund_value":0,"price":4,"exp":1499368560,"created":1499368500,"time_rate":1499368500,"type":"turbo","act":4,"direction":"call","exp_value":1141990,"value":1.14199,"profit_income":180,"profit_return":0,"id":8734778224,"robot_id":null,"request_id":null,"client_platform_id":9},"codeList":[0]}}

MadOne199 commented 7 years ago

Google search - iqoption api buyback 1st result gave -iqoptionapi.readthedocs.io/en/latest/iqoptionapi.http.html scroll down to -iqoptionapi.http.buyback module look at the source =

"""Module for IQ option buyback resource."""

from iqoptionapi.http.resource import Resource from iqoptionapi.http.billing import Billing

[docs]class Buyback(Resource): """Class for IQ option buyback resource."""

pylint: disable=too-few-public-methods

url = "/".join((Billing.url, "buyback"))

def _post(self, data=None, headers=None):
    """Send get request for IQ Option API buyback http resource.

    :returns: The instance of :class:`requests.Response`.
    """
    return self.send_http_request("POST", data=data, headers=headers)

def __call__(self, option_id):
    """Method to get IQ Option API buyback http request.

    :param str option_id: The option identifier.

    :returns: The instance of :class:`requests.Response`.
    """
    data = {"option_id": [option_id]}
    return self._post(data=data)

yet to try.......