Пример #1
0
    def test_login(self):
        iq_api = IQOption(email, password)
        check, reason = iq_api.connect()
        self.assertTrue(check)
        self.assertIsNone(reason)
        print(
            "________________________ CONNECTED ________________________________________"
        )
        self.assertTrue(iq_api.check_connect())

        print(
            "________________________ CHANGE REAL BALANCE  ________________________________________"
        )
        res = iq_api.change_balance("REAL")
        self.assertTrue(res)
        time.sleep(3)

        print(
            "________________________ CHANGE PRACTICE BALANCE  ________________________________________"
        )
        res = iq_api.change_balance("PRACTICE")
        self.assertTrue(res)

        print(
            "________________________ RESET PRACTICE BALANCE  ________________________________________"
        )
        iq_api.reset_practice_balance()

        print(
            "________________________ CLOSE CONNECTION  ________________________________________"
        )
        iq_api.close_connect()
Пример #2
0
 def test_Candle(self):
     iq_api=IQOption(email, password)
     iq_api.connect()
     iq_api.change_balance("PRACTICE")
     balance = iq_api.get_balance()
     self.assertTrue(type(balance) is float)
     print('balance: {}'.format(balance))
     iq_api.reset_practice_balance()
     self.assertEqual(iq_api.check_connect(), True)
     ALL_Asset = iq_api.get_all_open_time(('turbo',))
     if ALL_Asset["turbo"]["EURUSD"]["open"]:
         ACTIVES="EURUSD"
     else:
         ACTIVES="EURUSD-OTC"
     iq_api.get_candles(ACTIVES, 60, 1000, time.time())
     size = "all"
     iq_api.start_candles_stream(ACTIVES, size, 10)
     iq_api.get_realtime_candles(ACTIVES, size)
     iq_api.stop_candles_stream(ACTIVES, size)
     iq_api.close_connect()