diff --git a/README.md b/README.md index 6e903514..7a8feaa6 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,18 @@ [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/iqoptionapi) -last update:2019/10/9 +last update:2019/10/15 + +Version:3.9.7 + +fix buy_digital_spot duration 5&15 + +fix check binary option open +if asset is close is may return "False" !!or!! "{}" +if asset is open is return "True" +https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/122 + + Version:3.9.6 diff --git a/iqoptionapi/stable_api.py b/iqoptionapi/stable_api.py index 7fa98c4c..a6333e99 100644 --- a/iqoptionapi/stable_api.py +++ b/iqoptionapi/stable_api.py @@ -5,7 +5,7 @@ import time import logging import operator -import datetime + from collections import defaultdict from iqoptionapi.expiration import get_expiration_time from datetime import datetime,timedelta @@ -19,7 +19,7 @@ def nested_dict(n, type): class IQ_Option: - __version__ = "3.9.6" + __version__ = "3.9.7" def __init__(self, email, password): self.size = [1, 5, 10, 15, 30, 60, 120, 300, 600, 900, 1800, @@ -219,7 +219,14 @@ def get_all_open_time(self): for actives_id in binary_data[option]["actives"]: active=binary_data[option]["actives"][actives_id] name=str(active["name"]).split(".")[1] - OPEN_TIME[option][name]["open"]=active["enabled"] + if active["enabled"]==True: + if active["is_suspended"]==True: + OPEN_TIME[option][name]["open"]=False + else: + OPEN_TIME[option][name]["open"]=True + else: + OPEN_TIME[option][name]["open"]=active["enabled"] + #for digital digital_data=self.get_digital_underlying_list_data()["underlying"] @@ -765,8 +772,17 @@ def buy_digital_spot(self, active,amount, action, duration): logging.error('buy_digital_spot active error') return -1 #doEURUSD201907191250PT5MPSPT - - exp,idx=get_expiration_time(int(self.api.timesync.server_timestamp),duration) + timestamp=int(self.api.timesync.server_timestamp) + if duration==1: + exp,_=get_expiration_time(timestamp,duration) + else: + now_date = datetime.fromtimestamp(timestamp)+timedelta(minutes=1,seconds=30) + while True: + if now_date.minute%duration==0 and time.mktime(now_date.timetuple())-timestamp>30: + break + now_date = now_date+timedelta(minutes=1) + print(now_date) + exp=time.mktime(now_date.timetuple()) dateFormated = str(datetime.utcfromtimestamp(exp).strftime("%Y%m%d%H%M")) instrument_id = "do" + active + dateFormated + "PT" + str(duration) + "M" + action + "SPT" diff --git a/setup.py b/setup.py index 6a8bd357..6ee327d5 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name="iqoptionapi", - version="3.9.6", + version="3.9.7", packages=find_packages(), install_requires=["pylint","requests","websocket-client==0.47"], include_package_data = True,