Esempio n. 1
0
    def test_Candle(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"

        I_want_money.get_candles(ACTIVES, 60, 1000, time.time())
        #realtime candle
        size = "all"
        I_want_money.start_candles_stream(ACTIVES, size, 10)
        I_want_money.get_realtime_candles(ACTIVES, size)
        I_want_money.stop_candles_stream(ACTIVES, size)
    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)