Lu-Yi-Hsun / iqoptionapi

IQ Option API
373 stars 289 forks source link

get_realtime_candles cannot get realtime data #150

Open Phinox opened 4 years ago

Phinox commented 4 years ago

I run one thread to get one currency realtime data use get_realtime_candles ,the loop frequency is 0.1s, after about 1h, I can get current time new data, but it's about 5 min ago old data, not the realtime data. I wonder why and want a solution. Thanks.

Lu-Yi-Hsun commented 4 years ago

@Phinox

for now this api not support thread.

Please use multi process

Fix the code to thread safe need lot of time , so I am think is that necessary to implement that?

Lu-Yi-Hsun commented 4 years ago

I will check is that real-time candle problem or not

Lu-Yi-Hsun commented 4 years ago

@Phinox

that is thread problem for now this api not support thread.

it can work

i have been test by this code

from iqoptionapi.stable_api import IQ_Option
import logging
import time
#logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')
print("login...")
I_want_money=IQ_Option("email","password")
goal="EURUSD"
size=1#size=[1,5,10,15,30,60,120,300,600,900,1800,3600,7200,14400,28800,43200,86400,604800,2592000,"all"]
maxdict=1
print("start stream...")
I_want_money.start_candles_stream(goal,size,maxdict)

print("print candles")
cc=I_want_money.get_realtime_candles(goal,size)

while True:
    print(cc)
    time.sleep(0.1)