harwee / IQOption-Api

** Unmaintained ** I have rewritten some of the functionality using async if you are want to use the updated code you can use the code from `async` branch
Apache License 2.0
52 stars 54 forks source link

Can't open a binary option #34

Closed JoseCruz9807 closed 5 years ago

JoseCruz9807 commented 5 years ago

I've been trying to place a binary option position but it pops an error in the expiration field. I'm trying the following: from iqoption_api import IQOption iqoption = IQOption("mail@email.com","pass") iqoption.start() EURUSD = iqoption.options["binary"]["EURUSD-OTC"] EURUSD.subscribe_sync() print(EURUSD.buy_v2_sync(EURUSD.sell,"put",1,1,"1M")) Does someone know where is the error? Thanks in advance.

harwee commented 5 years ago

what is the error? and have you tried the code from this branch Please try the code from async branch and check if it's working or not.

JoseCruz9807 commented 5 years ago

I'm trying the code in that branch, it looks like it is sending the request correctly, but it returns the following: {'name': 'buyComplete', 'request_id': 'r_15', 'msg': {'isSuccessful': False, 'message': ['Time for purchasing options is over, please try again later.'], 'result': {'request_id': None}}}

I've tried different numbers in the "expiration" parameter but it keeps sending the same response.

harwee commented 5 years ago

You are trying to open a position after the expiry time, try using EURUSD.get_expiration_list_sync() to get all the expiration times, you have to use one of these values for expiration.