def test_binary_option(self): #login I_want_money = IQ_Option(email, password) I_want_money.change_balance("PRACTICE") I_want_money.reset_practice_balance() self.assertEqual(I_want_money.check_connect(), True) #start test binary option ALL_Asset = I_want_money.get_all_open_time() if ALL_Asset["turbo"]["EURUSD"]["open"]: ACTIVES = "EURUSD" else: ACTIVES = "EURUSD-OTC" Money = 1 ACTION_call = "call" #or "put" expirations_mode = 1 check_call, id_call = I_want_money.buy(Money, ACTIVES, ACTION_call, expirations_mode) self.assertTrue(check_call) self.assertTrue(type(id_call) is int) I_want_money.sell_option(id_call) ACTION_call = "put" check_put, id_put = I_want_money.buy(Money, ACTIVES, ACTION_call, expirations_mode) self.assertTrue(check_put) self.assertTrue(type(id_put) is int) I_want_money.sell_option(id_put) I_want_money.check_win_v2(id_put) I_want_money.get_binary_option_detail() I_want_money.get_all_profit() isSuccessful, dict = I_want_money.get_betinfo(id_put) self.assertTrue(isSuccessful) I_want_money.get_optioninfo(10)
from iqoptionapi.stable_api import IQ_Option import logging import time # logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s') Iq = IQ_Option("*****@*****.**", "aswdkl;123") # Iq = IQ_Option(content['email'], content['password']) Iq.connect() Money = [] ACTIVES = [] ACTION = [] expirations_mode = [] res = Iq.get_balance() print(res) print(Iq.check_connect()) Money.append(1) ACTIVES.append("EURUSD") ACTION.append("call") #put expirations_mode.append(1) Money.append(1) ACTIVES.append("EURAUD") ACTION.append("call") #put expirations_mode.append(1) print("buy multi") id_list = Iq.buy_multi(Money, ACTIVES, ACTION, expirations_mode) print("check win only one id (id_list[0])") print(Iq.check_win_v2(id_list[0], 2))
print('Not connected.') API.connect() else: print('Connected.') break time.sleep(1) print(API.get_balance()) all_assets = API.get_all_open_time() profits = API.get_all_profit() data = 'closed' if all_assets['binary'][asset]['open']: amounts = [] assets = [] actions = [] expiration_times = [] digitals = [] id_list = [] amounts.append(50) assets.append(asset) actions.append('put') expiration_times.append(15) id_list=API.buy_multi(amounts,assets,actions,expiration_times) print("check win only one id (id_list[0])") print(API.check_win_v2(id_list[0]))