Skip to content

Commit

Permalink
3.9.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Lu-Yi-Hsun committed Oct 14, 2019
1 parent 73923e7 commit ac1eb78
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
26 changes: 21 additions & 5 deletions iqoptionapi/stable_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ac1eb78

Please sign in to comment.