Code Monkey home page Code Monkey logo

Comments (7)

kanXuT avatar kanXuT commented on June 27, 2024 1

They added (or req. now) another params in buyV2:
skey - is stored in profile
user_balance_id - not sure if it's required but I added that and works fine

from iqoptionapi.

milteven12 avatar milteven12 commented on June 27, 2024

Hello @kanXuT , please, could you explain what should I do?
My current code is:
captura eurusd

PS: How can I get the skey and user_balance_id?
I tried print (api.profile.skey) but the output is None.

from iqoptionapi.

kanXuT avatar kanXuT commented on June 27, 2024

Sorry not using this api and not famiiar with Python, so this is just where you can look for:
you need update buyv2.py ad add something like this:

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 }

And if skey and balance_id is not set/deffined, you need fill them up first from profile message ;)

from iqoptionapi.

iQBotProject avatar iQBotProject commented on June 27, 2024

what we should to do exactly

from iqoptionapi.

iQBotProject avatar iQBotProject commented on June 27, 2024

@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
i think skey and balance_id is always None

from iqoptionapi.

milteven12 avatar milteven12 commented on June 27, 2024

@yesamine , just a comment: I have the same version, you don't need to modify the call function to:
def call(self, price, active, option, direction,skey,user_balance_id)
?

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.

from iqoptionapi.

iQBotProject avatar iQBotProject commented on June 27, 2024

now i tested the iqoptionbot in TEST mode work good and trade
and i see skey and balance_id in loge file
the probleme this robot not working with other methods like TBL , TBH , ... and have many issues (candles and market ... )

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", "[email protected]", "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 

from iqoptionapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.