Open sampyz opened 6 years ago
@sampyz ok will try to implement that today
@Lu-Yi-Hsun i love you!
@sampyz i add I_want_money.check_win(id_number) id_number more clear to get the check win try get last version
and try this code
from iqoptionapi.stable_api import IQ_Option
I_want_money=IQ_Option("email","password")
ok,id_number=I_want_money.buy(2,"EURUSD","call",1,force_buy=False)
print(id_number)
ans=I_want_money.check_win(id_number)
print(ans)
@Lu-Yi-Hsun Thanks! I will try tomorrow!!! If my bots works i will pay for your job! ;)
@Lu-Yi-Hsun hello, I have a problem when i try to send id_number to another script running I_want_money.check_win trought a .ini File..
What is it "ok," before id_number=I_want_money.buy(2,"EURUSD","call",1,force_buy=False)? Thanks for your helping
@sampyz
hello, I have a problem when i try to send id_number to another script running I_want_money.check_win trought a .ini File..
2."ok" return if "buy" ok(True/False)
some time network or some problem buy not sucess it will return False
Thanks for your assistance!! Do you know if is it possible to checkwin 2 or more bets at the same time or in the same script??
With the same time expire of course
@sampyz You can try thread
@Lu-Yi-Hsun Hi mister, i tryed check_win_v2 but is a little bit slowly...i have the result after 5 second...is it possible to make it faster?
Thanks!!!
@sampyz i set sleep 5 sec to Polling check if win,so it is slowly. i will change to 0.5 sec i thing it will better. you can try last version
@Lu-Yi-Hsun I got an issue when enter multiple order at a time. ex: id_number1=I_want_money.buy(2,"EURUSD","call",1,force_buy=False) id_number2=I_want_money.buy(2,"EURJPY","call",1,force_buy=False) id_number3=I_want_money.buy(2,"EURAUD","call",1,force_buy=False)
The problem is id_number1 = id_number2 = id_number3, all has the same value. So I cannot get the result. Note that I am using multiple threads
@jackynguyen93
Ok I will fix that
@Lu-Yi-Hsun I really appreciate that. Thanks so much
@jackynguyen93
v 3.6.3 fix
@Lu-Yi-Hsun It seems still happen
My application run 2 threads at the same time but both threads response the same ID
You can see my log show 5211822983 is the response of 2 buy difference requests
@jackynguyen93 Not thread safe, you need to use multi connect
! pseudocode !
import time
from iqoptionapi.stable_api import IQ_Option
def thread(email,password):
I_want_money=IQ_Option(email,password)
goal="goal"
print(I_want_money.get_candles(goal,60,111,time.time()))
do thread1(email,password)
do thread2(email,password)
@Lu-Yi-Hsun could you explain more. Do I need to have a connect like _I_want_money=IQOption("email","password") everytime I enter an order?
@jackynguyen93 if you want thread ,you need to build new connect
So, is it correct if in my order function I put new_connect=IQ_Option("email","password") and use new_connect to enter the order ?
Yes you need to build other connect ,I suggest use multiprocessing for multi cpu
Could you provide me an example or some article related to this? Forgive for my lack of knowledge, python is not my main language
from iqoptionapi.stable_api import IQ_Option
import multiprocessing as mp
import time
import logging
import time
def job(email,passwd):
I_want_money = IQ_Option(email, passwd)
id_number=I_want_money.buy(2,"EURJPY","call",1,force_buy=False)
print("buy-time",time.time(),id_number)
p1 = mp.Process(target=job,args=("email","passwd"))
p2 = mp.Process(target=job,args=("email","passwd"))
p3 = mp.Process(target=job,args=("email","passwd"))
p1.start()
p2.start()
p3.start()
p1.join()
p2.join()
p3.join()
you can see buy() speed up by multiprocessing
@Lu-Yi-Hsun do you have another solution. I think this solution will cause to delay on order. In my case, it takes about 6s to authenticate and makes a connection.
Can we do a thread safe for api or using scope variable instead of global variable to make api doesn't get the last response only
you can start the multiprocessing wait for buy() action
you can start the multiprocessing wait for buy() action
Sorry, I don't understand what you mean. An example will more clear with me
you need "6s to authenticate" just only at first time!
use "zmq" to connect multiprocessing request what you want
you need "6s to authenticate" just only at first time!
use "zmq" to connect multiprocessing request what you want
So you mean we run many threads at start time and do authenticate for all threads. Then zmq will send signal to each thread and enter order in each one?
Hello,
is it possible to edit api: I_want_money.check_win() like I_want_money.check_win("EURUSD")?
because i need to check win in a multiple bet
Thanks in advance!