From 6f17d9f932877ccc0600bdc1f54a5b9e124e94ad Mon Sep 17 00:00:00 2001 From: lu-yi-hsun Date: Thu, 31 Oct 2019 22:12:15 +0800 Subject: [PATCH] 4.5 --- README.md | 23 ++++++++++++++++++++++- iqoptionapi/stable_api.py | 12 +++++++++--- setup.py | 2 +- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d3c92efd..9bc30418 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,11 @@ [![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.me/iqoptionapi) -last update:2019/10/27 +last update:2019/10/31 + +Version:4.5 + +add [get_remaning](#getremaning) api Version:4.4 @@ -375,7 +379,24 @@ print("check win only one id (id_list[0])") print(I_want_money.check_win_v2(id_list[0])) ``` +#### get_remaning +purchase time=remaning time - 30 + +```python +from iqoptionapi.stable_api import IQ_Option +I_want_money=IQ_Option("email","password") +Money=1 +ACTIVES="EURUSD" +ACTION="call"#or "put" +expirations_mode=1 +while True: + remaning_time=I_want_money.get_remaning(expirations_mode) + purchase_time=remaning_time-30 + if purchase_time<4:#buy the binary option at purchase_time<4 + I_want_money.buy(Money,ACTIVES,ACTION,expirations_mode) + break +``` #### sell_option diff --git a/iqoptionapi/stable_api.py b/iqoptionapi/stable_api.py index 62e30aff..10e35248 100644 --- a/iqoptionapi/stable_api.py +++ b/iqoptionapi/stable_api.py @@ -7,7 +7,7 @@ import operator from collections import defaultdict -from iqoptionapi.expiration import get_expiration_time +from iqoptionapi.expiration import get_expiration_time,get_remaning_time from datetime import datetime,timedelta @@ -19,7 +19,7 @@ def nested_dict(n, type): class IQ_Option: - __version__ = "4.4" + __version__ = "4.5" def __init__(self, email, password): self.size = [1, 5, 10, 15, 30, 60, 120, 300, 600, 900, 1800, @@ -678,7 +678,13 @@ def buy_multi(self,price,ACTIVES,ACTION,expirations): logging.error('buy_multi error please input all same len') - + def get_remaning(self,duration): + for remaning in get_remaning_time(self.api.timesync.server_timestamp): + if remaning[0]==duration: + return remaning[1] + logging.error('get_remaning(self,duration) ERROR duration') + return "ERROR duration" + def buy(self, price, ACTIVES, ACTION, expirations): self.api.buy_successful = None self.api.buy_id = None diff --git a/setup.py b/setup.py index 565bc6fc..c126684d 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name="iqoptionapi", - version="4.4", + version="4.5", packages=find_packages(), install_requires=["pylint","requests","websocket-client==0.56"], include_package_data = True,