Open Marc1993Idel opened 8 years ago
Added a little comment to a README.md
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?
hi try to buy on 0 seconds by server time something like
if api.timesync.servertime.seconds == 0: api.buy(args)
@n1nj4z33 And what value goes in args
?
This project needs documentation.
Could you publish a sample of how to use this API?
@joebrassi Hi, i add sphinx generated documentation http://iqapi.readthedocs.io/en/latest/ I'll add a user guide to wiki soon
@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?
@joebrassi api.buy(price, active, option, direction) api.buy(10, 76, "turbo", "call")
@joebrassi also you can see here https://github.com/n1nj4z33/iqpy
@n1nj4z33 Thank you very much. And a couple more questions,
@joebrassi 1) No way yet. You just send your price to buy 2) https://github.com/n1nj4z33/iqapi/blob/master/iqapi/constants.py
@joebrassi Im get it from chrome devtools in websocket tab just choose another active ad check
I see. Well, it seems that it needs to be completed then.
@joebrassi of course it was )
@joebrassi and you can help by doing a pull requests )
OK, let me see what I can do.
@joebrassi @engelkohle @Marc1993Idel you can find some information in wiki now https://github.com/n1nj4z33/iqoptionapi/wiki.
{'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?
@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
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
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.
How do you set the volume in a call to:
api.buy(price, active, option, direction)
api.buy(10, 76, "turbo", "call")
volume? what does it mean "volume"?
Also called "Trading Size" or "Amount".
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
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
Hi, did you manage to figure out how to resolve the issue with expiration times? I'm kinda stuck at this...
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.
Hey @engelkohle thanks that solved the issue with expiration times!
hi, how can i retrieve profile data? i would like to get the users balance
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....
Hi, I have been trying to access candle information but it comes back empty using candles= api.getcandles (1,1)
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
@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
@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......
how to get current % of return of an active?
This is still a huge problem at large dispute the efforts of fixing it by @engelkohle, sadly.
any update on this guy ? thx you
@Niks005 There is a way, do you still need it? I can add a issue with a tutorial/code to do it.
@j1and1 Check out https://github.com/n1nj4z33/iqoptionapi/issues/17, this gives you open position information in real time and the trade result.
@frxncisjoseph Thanks!!!
for fix the problem (our csharp line)
expirationtimestamp -= expirationtimestamp % 60;
the server only accept EXACT 60 sec match
@frxncisjoseph I had got it working. Using http request "all". Thanks.
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
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
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?
give me your skype
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
@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
Hey, can you leave a short comment how to use this API? I want to add them to my EA. Thanks