Code Monkey home page Code Monkey logo

Comments (49)

engelkohle avatar engelkohle commented on June 27, 2024 3

Hi @j1and1,
In /iqoptionapi/ws/objects/timesync.py replace the content of expiration_timestamp() method with the following code:

return time.mktime(self.expiration_datetime.replace(second=0, microsecond=0).timetuple())

It should appear:

@property
def expiration_timestamp(self):
"""
   Property to get expiration timestamp.

   :returns: The expiration timestamp.
"""

# return time.mktime(self.expiration_datetime.timetuple())
  return time.mktime(self.expiration_datetime.replace(second=0, microsecond=0).timetuple())

I'm sure this will help you.

from iqoptionapi.

j1and1 avatar j1and1 commented on June 27, 2024 1

Hey @engelkohle thanks that solved the issue with expiration times!

from iqoptionapi.

frxncisjoseph avatar frxncisjoseph commented on June 27, 2024 1

@j1and1 Check out #17, this gives you open position information in real time and the trade result.

from iqoptionapi.

HubSpace2000 avatar HubSpace2000 commented on June 27, 2024 1

give me your skype

from iqoptionapi.

n1nj4z33 avatar n1nj4z33 commented on June 27, 2024

Added a little comment to a README.md

from iqoptionapi.

engelkohle avatar engelkohle commented on June 27, 2024

Hi,
after run the api the websocket returns the following json message:

{'msg': {'code': 4, 'isSuccessful': False, 'message': ['Time for purchasing options is over, please try again later.'], 'result': {'request_id': None}}, 'name': 'buyComplete'}
{'msg': 1471594551119, 'name': 'timeSync'}

Have you the same problem?

from iqoptionapi.

n1nj4z33 avatar n1nj4z33 commented on June 27, 2024

hi try to buy on 0 seconds by server time
something like

if api.timesync.servertime.seconds == 0:
api.buy(args)

from iqoptionapi.

joebrassi avatar joebrassi commented on June 27, 2024

@n1nj4z33 And what value goes in args?

This project needs documentation.

Could you publish a sample of how to use this API?

from iqoptionapi.

n1nj4z33 avatar n1nj4z33 commented on June 27, 2024

@joebrassi Hi, i add sphinx generated documentation http://iqapi.readthedocs.io/en/latest/
I'll add a user guide to wiki soon

from iqoptionapi.

joebrassi avatar joebrassi commented on June 27, 2024

@n1nj4z33 Yes, but that documentation does not say anything about the parameters accepted by the method buy, it only mentions it. Could you just publish a sample?

from iqoptionapi.

n1nj4z33 avatar n1nj4z33 commented on June 27, 2024

@joebrassi
api.buy(price, active, option, direction)
api.buy(10, 76, "turbo", "call")

from iqoptionapi.

n1nj4z33 avatar n1nj4z33 commented on June 27, 2024

@joebrassi also you can see here https://github.com/n1nj4z33/iqpy

from iqoptionapi.

joebrassi avatar joebrassi commented on June 27, 2024

@n1nj4z33 Thank you very much. And a couple more questions,

  1. Is there any way to retrieve the current price from the API?
  2. I see you assign 76 to the parameter "active", what does 76 actually mean?

from iqoptionapi.

n1nj4z33 avatar n1nj4z33 commented on June 27, 2024

@joebrassi

  1. No way yet. You just send your price to buy
  2. https://github.com/n1nj4z33/iqapi/blob/master/iqapi/constants.py

from iqoptionapi.

joebrassi avatar joebrassi commented on June 27, 2024
  1. OK.
  2. Are those the only constants you have? How should I get the number of other symbols?

from iqoptionapi.

n1nj4z33 avatar n1nj4z33 commented on June 27, 2024

@joebrassi
Im get it from chrome devtools in websocket tab
just choose another active ad check

http://i.stack.imgur.com/OIbxT.png

from iqoptionapi.

joebrassi avatar joebrassi commented on June 27, 2024

I see. Well, it seems that it needs to be completed then.

from iqoptionapi.

n1nj4z33 avatar n1nj4z33 commented on June 27, 2024

@joebrassi of course it was )

from iqoptionapi.

n1nj4z33 avatar n1nj4z33 commented on June 27, 2024

@joebrassi and you can help by doing a pull requests )

from iqoptionapi.

joebrassi avatar joebrassi commented on June 27, 2024

OK, let me see what I can do.

from iqoptionapi.

n1nj4z33 avatar n1nj4z33 commented on June 27, 2024

@joebrassi @engelkohle @Marc1993Idel you can find some information in wiki now https://github.com/n1nj4z33/iqoptionapi/wiki.

from iqoptionapi.

fsnlarson avatar fsnlarson commented on June 27, 2024

{'msg': {'code': 4, 'isSuccessful': False, 'message': ['Time for purchasing options is over, please try again later.'], 'result': {'request_id': None}}, 'name': 'buyComplete'}
{'msg': 1471594551119, 'name': 'timeSync'}

@engelkohle Have you found a away around this?

from iqoptionapi.

fsnlarson avatar fsnlarson commented on June 27, 2024

@engelkohle @n1nj4z33

May have solved...

{'msg': {'code': 4, 'isSuccessful': False, 'message': ['Time for purchasing options is over, please try again later.'], 'result': {'request_id': None}}, 'name': 'buyComplete'} {'msg': 1471594551119, 'name': 'timeSync'}

This ^^ Is the result of expiration times. When rounding all turbo expirations to up to nearest minute, and binaries up to the nearest 15 minutes, it works.

Using datetime:

        def round_up(tm, nearest=15):
            upmins = math.ceil(float(tm.minute)/nearest)*nearest
            diffmins = upmins - tm.minute
            newtime = tm + datetime.timedelta(minutes=diffmins)
            newtime = newtime.replace(second=0)
            return newtime

from iqoptionapi.

n1nj4z33 avatar n1nj4z33 commented on June 27, 2024

https://github.com/n1nj4z33/iqoptionapi/blob/master/iqoptionapi/ws/objects/timesync.py

@property
def expiration_timestamp(self):
    """Property to get expiration timestamp.
    :returns: The expiration timestamp.
    """
    return time.mktime(self.expiration_datetime.timetuple())

https://github.com/n1nj4z33/iqoptionapi/blob/master/iqoptionapi/ws/chanels/buyv2.py

so you can try to set expiration time before buy

self.api.timesync.expiration_time = 1

from iqoptionapi.

engelkohle avatar engelkohle commented on June 27, 2024

Are we all agree that these workarounds are used to resolve the trouble about the time to buy, that is possible to do only when the time is zero zero seconds? Or it is possible to buy a position in every time using one of workarounds described before? Have implemented a method that wait until the time is to zero zero seconds and then return true.

from iqoptionapi.

joebrassi avatar joebrassi commented on June 27, 2024

How do you set the volume in a call to:

api.buy(price, active, option, direction)
api.buy(10, 76, "turbo", "call")

from iqoptionapi.

n1nj4z33 avatar n1nj4z33 commented on June 27, 2024

volume? what does it mean "volume"?

from iqoptionapi.

joebrassi avatar joebrassi commented on June 27, 2024

Also called "Trading Size" or "Amount".

from iqoptionapi.

RickyGlobal9 avatar RickyGlobal9 commented on June 27, 2024

Hi, i want to develop iqoption autotrade bot for my own strategy but i am not a Python programmer and the api script is in the same lang.

Is here anyone who can convert these scripts to .net C#.
I'll helpful to him for this kind job.

Regards

from iqoptionapi.

engelkohle avatar engelkohle commented on June 27, 2024

Sorry @n1nj4z33,
but your suggest:

self.api.timesync.expiration_time = 1

not work absolutely. At the moment I'm using a function waiting that the seconds are zero, like this:

 def zero_zero_seconds(self):
   logger = logging.getLogger(__name__)
   logger.info("Wait for zero zero seconds.")
   while not self.timesync.server_datetime.second == 0:
       time.sleep(1)
   return True

from iqoptionapi.

j1and1 avatar j1and1 commented on June 27, 2024

Hi, did you manage to figure out how to resolve the issue with expiration times? I'm kinda stuck at this...

from iqoptionapi.

jglydes avatar jglydes commented on June 27, 2024

hi, how can i retrieve profile data? i would like to get the users balance

from iqoptionapi.

j1and1 avatar j1and1 commented on June 27, 2024

hi @jglydes ,

If I am correct.... After you have created a connection with the api you can use api.profile.balance to get the balance....

from iqoptionapi.

mitch71 avatar mitch71 commented on June 27, 2024

Hi, I have been trying to access candle information but it comes back empty using
candles= api.getcandles (1,1)

from iqoptionapi.

jglydes avatar jglydes commented on June 27, 2024

hi @j1and1 ,

thank you for your response. i just followed the steps on wiki and api.profile.balance returns None. however i managed to get the balance by doing this
profile = api.getprofile()
res = json.loads(profile._content)
balance = res['result']['balance'])

Do you have any idea how can i retrieve the result of buy method? if the trade wins or lose. thanks

from iqoptionapi.

Olascoaga avatar Olascoaga commented on June 27, 2024

@mitch71

Hi, i thinks that i solved the problem, try with this:

api.getcandles(1,1)
candles = api.candles.candles_data 
print candles[-1] # current candle

from iqoptionapi.

j1and1 avatar j1and1 commented on June 27, 2024

@jglydes

Do you have any idea how can i retrieve the result of buy method? if the trade wins or lose. thanks

I'm wondering the same thing....... And I havent investigated it, but for now I have not found method to get reecent deals...... witch would be usefull for buget controll......

from iqoptionapi.

Niks005 avatar Niks005 commented on June 27, 2024

how to get current % of return of an active?

from iqoptionapi.

frxncisjoseph avatar frxncisjoseph commented on June 27, 2024

This is still a huge problem at large dispute the efforts of fixing it by @engelkohle, sadly.

from iqoptionapi.

crypto-maniac avatar crypto-maniac commented on June 27, 2024

any update on this guy ? thx you

from iqoptionapi.

frxncisjoseph avatar frxncisjoseph commented on June 27, 2024

@Niks005 There is a way, do you still need it? I can add a issue with a tutorial/code to do it.

from iqoptionapi.

j1and1 avatar j1and1 commented on June 27, 2024

@frxncisjoseph Thanks!!!

from iqoptionapi.

crypto-maniac avatar crypto-maniac commented on June 27, 2024

for fix the problem (our csharp line)

expirationtimestamp -= expirationtimestamp % 60;

the server only accept EXACT 60 sec match

from iqoptionapi.

Niks005 avatar Niks005 commented on June 27, 2024

@frxncisjoseph I had got it working. Using http request "all". Thanks.

from iqoptionapi.

conuxconux avatar conuxconux commented on June 27, 2024

Hi.

I'm not using the python api, I'm writing a little application in c#.
I'm able to send the message to setActives with:

{"msg" : {"actives" : 1}, "name" : "setActives"}

and it works fine.

Can you tell me what is the right message to send at websocket to buy an option with buyV2 message in binary mode?

I have tested the following, but any parameters I thing that are wrong, beacuse I don't know any sample to compose it:

{"msg" : {"price" : 1.17779}, "act" : 1, "exp" : 1507636800000 , "type" : 3, "direction" : "put", "time" : 1507636658690, "name" : "buyV2"}

I receive the following response:

{"msg":{"code":26,"codeList":[26],"isSuccessful":false,"message":["Failed to process"],"result":{"request_id":null}},"name":"buyComplete"}

I suppose the they are the right parameter because I have seen in the "buyv2.py" file, but i don't know the right value for field: type, direction.

The "act" i suppose is right and it is the same of "actives" that I have used in "setActives", right?

Where I can find messages that iqoption support, exist any documentation?

What are the right message to send to by an option?

Please can you help me?

Many thanks to all

from iqoptionapi.

HubSpace2000 avatar HubSpace2000 commented on June 27, 2024

just download the iqoption mobile application (apk) and you can see all the code source, since 4 month i didnt worked on the iqoption api so i dont remember the flow

from iqoptionapi.

conuxconux avatar conuxconux commented on June 27, 2024

just download the iqoption mobile application (apk) and you can see all the code source, since 4 month i didnt worked on the iqoption api so i dont remember the flow

@HubSpace2000 many thanks for your reply and suggestion.

I have downloaded the apk but I don't see anything about it... I have searched: buyv2, buy, msg but I haven't found anything ... :(

Have you any suggestion?

from iqoptionapi.

oravix avatar oravix commented on June 27, 2024

Hi to every body...Is there someone who has been able to send request_id parameter to the buyv2 method and get It into buyComplete response? If Yes..how?
Thx very much

from iqoptionapi.

oravix avatar oravix commented on June 27, 2024

@HubSpace2000
Hi HubSpace2000, could I receive source code to understand how to complete buyV2 with other parameters? (my skype is the same as github username)
Thank you

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.