Open mattia177 opened 5 years ago
@mattia177 sorry i don't understand.
you want to check what price you buy?
@Lu-Yi-Hsun I want to buy a digital option, not setting a specific strike price but buying it at the spot price (closest price). Is it possibile?
Hi @mattia177 :
The method to buy a digital option require the instrument_id buy_check,id=I_want_money.buy_digital(amount,instrument_id)
that require the strike price. If you want to buy an active at the spot price you can try with the binary option because it doesn´t need a strike price.
from iqoptionapi.stable_api import IQ_Option
import logging
import time
logging.basicConfig(level=logging.DEBUG,format='%(asctime)s %(message)s')
I_want_money=IQ_Option("email","pass")
goal="EURUSD"
print("get candles")
print(I_want_money.get_candles(goal,60,111,time.time()))
Money=1
ACTIVES="EURUSD"
ACTION="call"#or "put"
expirations_mode=1
force_buy= False#i suggest use False
I_want_money.buy(Money,ACTIVES,ACTION,expirations_mode,force_buy)
Hi @Mecabot :
I’m not sure you are right. I know that you tipically you have to buy digital options at a specific strike price, but if you check well you will see that you can buy a digital option at the spot price, and the payout is fixed (usually at 87%). It’s an update of the platform che implemented about one month ago. It give you the chance to trade digital options in a similar way to binary options, but you can buy them till 15 seconds to expiry.
Someone can Help me?
@mattia177 you want set the price ,like forex limit price?
@Lu-Yi-Hsun yes, something like: if [my asset] has a particular condition, then buy the digital options with limit price (strike price) equal to the spot price. It’s like forex limit price, and I want to use it with digitals (I know it’s possible)
Any news?
Hi @Lu-Yi-Hsun what @mattia177 means is that he wishes to do a purchase with the percentage ROI that you would get from a regular purchase that is not through using strike prices, in other words making a decision that the price will be higher or lower than it currently is using digital options(Due to the percentage ROI being different from Binary at times). I have attached an image below to help with understanding. I require this solution too, please.
https://github.com/Lu-Yi-Hsun/iqoptionapi/blob/master/README.md#data-format
Your can get that data
Ho @TileshB, exactly, you understood what I mean :)
If someone of you is interested, I developed an algo strategy to play with digital options, and backtested it through Bloomberg terminal. I can write it through Python, I am an engineer, but I do not have a professional account, if you want to join a business with me we could reach a strong result. Have a good day guys...
You can get profit percentag.
Sorry I still can not get your point.
You can not set that limit price in digit
You can buy digit by choose what profit you and price
Essentially if you look at the picture attached, what your function does is provide all the strikes in the list but how do we know which one is the white bar. We want to buy a position based on that particular strike. In other words, how do we purchase the position at the current strike position(The strike in the white block). In this example I want to buy digital at the instrument ID that is "1.122700". If that makes sense?
@Lu-Yi-Hsun Sorry, maybe I didn’t explain well.
Usually when you trade a classic binary option, you have a fixed payout percentage and you can buy it till 30 seconds to expiry.
If you want to buy an option till 15seconds to expiry you have to buy a digital option, where you have to specify the strike price you want to execute the option. If you move far from the spot price the payout percentage will be slower, right?
But you have a second way: buying a digital option without specifying the strike price, because you buy that option at the spot price.
IQ Options tells you: Eur/Usd is @1.1213? If you don’t want to buy a digital option with strike price higher or lower, you can buy a digital option with strike price equals to 1.1213, the same level of the spot price.
So, I would be interested to know how I could do this with python. I mean, how can I do a similar buy trade?
I think what is trying to say is: how to get the current price in digital options like in pic below
1 - First go to settings
2 - Select the option "Current Price"
This way it`s possible to open digital orders in the current price instead of orders to hit strike prices. Btw, I dont think this API offers this option yet
Right!
Il giorno ven 5 apr 2019 alle 16:03 hesller notifications@github.com ha scritto:
I think what is trying to say is: how to get the current price in digital options like in pic below
1 - First go to settings [image: settings 1] https://user-images.githubusercontent.com/25598426/55633043-eed01700-5791-11e9-87a9-21e06b3bce01.PNG
2 - Select the option "Current Price" [image: settings 2] https://user-images.githubusercontent.com/25598426/55633283-64d47e00-5792-11e9-8d47-e634bb98ecec.PNG
This way it`s possible to open digital orders in the current price instead of orders to hit strike prices.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/65#issuecomment-480287230, or mute the thread https://github.com/notifications/unsubscribe-auth/Aoy4dEUChlbbJLFkrZSEd5aH7tC_Pkw0ks5vd1fNgaJpZM4ZgWHE .
https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/65#issuecomment-480194708 use real-time candle you can get white bar
Any solution for this issue?
@Lu-Yi-Hsun any news? Could you provide as a code to buy Digital Options with ACTUAL PRICE?
I haven’t implement yet
@Lu-Yi-Hsun I understand, do you think it will be long time for developing? Thank you
I think it is very easy , I will add it
Thank you, really appreciate it!
Il giorno mer 10 lug 2019 alle 15:45 Anson notifications@github.com ha scritto:
I think it is very easy , I will add it
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/65?email_source=notifications&email_token=AKGLQ5EPFA4XJUKFNEUCHWTP6XRWFA5CNFSM4GMBMHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZTQEPY#issuecomment-510067263, or mute the thread https://github.com/notifications/unsubscribe-auth/AKGLQ5DUWG4F32IQJH5PV7DP6XRWFANCNFSM4GMBMHCA .
Nothing my friend?
Il giorno mer 10 lug 2019 alle ore 17:50 ardemagni mattia < ardemagni.mattia@gmail.com> ha scritto:
Thank you, really appreciate it!
Il giorno mer 10 lug 2019 alle 15:45 Anson notifications@github.com ha scritto:
I think it is very easy , I will add it
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/65?email_source=notifications&email_token=AKGLQ5EPFA4XJUKFNEUCHWTP6XRWFA5CNFSM4GMBMHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZTQEPY#issuecomment-510067263, or mute the thread https://github.com/notifications/unsubscribe-auth/AKGLQ5DUWG4F32IQJH5PV7DP6XRWFANCNFSM4GMBMHCA .
Nothing my friend? Il giorno mer 10 lug 2019 alle ore 17:50 ardemagni mattia < ardemagni.mattia@gmail.com> ha scritto: … Thank you, really appreciate it! Il giorno mer 10 lug 2019 alle 15:45 Anson @.***> ha scritto: > I think it is very easy , I will add it > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <#65?email_source=notifications&email_token=AKGLQ5EPFA4XJUKFNEUCHWTP6XRWFA5CNFSM4GMBMHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZTQEPY#issuecomment-510067263>, > or mute the thread > https://github.com/notifications/unsubscribe-auth/AKGLQ5DUWG4F32IQJH5PV7DP6XRWFANCNFSM4GMBMHCA > . >
this code can buy the price near current price!
from iqoptionapi.stable_api import IQ_Option
import time
import random
I_want_money=IQ_Option("email","pasword")
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")
candle=I_want_money.get_realtime_candles(goal,size)
key=list(candle)[0]
current_price=candle[key]["close"]
print("current_price",current_price)
######
duration=1#minute 1 or 5
amount=1
buy="call"#or "put"
I_want_money.subscribe_strike_list(goal)
#get strike_list
data=I_want_money.get_realtime_strike_list(goal, duration)
#get price list
price_list=list(data.keys())
close_current_price=[]
for p_list in price_list:
close_current_price.append(abs(current_price-float(p_list)))
most_close_price=price_list[close_current_price.index(min(close_current_price))]
print("most_close_price",most_close_price,"current_price",current_price)
print(data[str(most_close_price)])
#random choose Strategy
choose_price=most_close_price
#get instrument_id
instrument_id=data[choose_price][buy]["id"]
#get profit
profit=data[choose_price][buy]["profit"]
print("choose you want to buy")
print("price:",choose_price,"side:call","instrument_id:",instrument_id,"profit:",profit)
#put instrument_id to buy
buy_check,id=I_want_money.buy_digital(amount,instrument_id)
if buy_check:
print("wait for check win")
#check win
while True:
check_close,win_money=I_want_money.check_win_digital(id)
if check_close:
if float(win_money)>0:
win_money=("%.2f" % (win_money))
print("you win",win_money,"money")
else:
print("you loose")
break
I_want_money.unsubscribe_strike_list(buy)
else:
print("fail to buy,please run again,digit is change very fast so sometime if can not buy the price!,please try more time")
Thank you!!
Il giorno mar 16 lug 2019 alle ore 06:33 Anson notifications@github.com ha scritto:
Nothing my friend? Il giorno mer 10 lug 2019 alle ore 17:50 ardemagni mattia < ardemagni.mattia@gmail.com> ha scritto: … <#m5113456737074033187> Thank you, really appreciate it! Il giorno mer 10 lug 2019 alle 15:45 Anson @.***> ha scritto: > I think it is very easy , I will add it > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <#65 https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/65?email_source=notifications&email_token=AKGLQ5EPFA4XJUKFNEUCHWTP6XRWFA5CNFSM4GMBMHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZTQEPY#issuecomment-510067263>,
or mute the thread > https://github.com/notifications/unsubscribe-auth/AKGLQ5DUWG4F32IQJH5PV7DP6XRWFANCNFSM4GMBMHCA . >
this code can get the close current price!
from iqoptionapi.stable_api import IQ_Option import time import random
I_want_money=IQ_Option("email","pasword")
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")
candle=I_want_money.get_realtime_candles(goal,size)
key=list(candle)[0]
current_price=candle[key]["close"] print("current_price",current_price)
duration=1#minute 1 or 5
amount=1
buy="call"#or "put"
I_want_money.subscribe_strike_list(goal)
get strike_list
data=I_want_money.get_realtime_strike_list(goal, duration)
get price list
price_list=list(data.keys())
close_current_price=[] for p_list in price_list:
close_current_price.append(abs(current_price-float(p_list)))
most_close_price=price_list[close_current_price.index(min(close_current_price))] print("most_close_price",most_close_price,"current_price",current_price) print(data[str(most_close_price)])
random choose Strategy
choose_price=most_close_price
get instrument_id
instrument_id=data[choose_price][buy]["id"]
get profit
profit=data[choose_price][buy]["profit"] print("choose you want to buy") print("price:",choose_price,"side:call","instrument_id:",instrument_id,"profit:",profit)
put instrument_id to buy
buy_check,id=I_want_money.buy_digital(amount,instrument_id) if buy_check:
print("wait for check win") #check win while True: check_close,win_money=I_want_money.check_win_digital(id) if check_close: if float(win_money)>0: win_money=("%.2f" % (win_money)) print("you win",win_money,"money") else: print("you loose") break I_want_money.unsubscribe_strike_list(buy)
else:
print("fail to buy,please run again,digit is change very fast so sometime if can not buy the price!,please try more time")
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/65?email_source=notifications&email_token=AKGLQ5FQ2XJRGKGEY33AAU3P7VFRDA5CNFSM4GMBMHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ7VG3A#issuecomment-511660908, or mute the thread https://github.com/notifications/unsubscribe-auth/AKGLQ5ARRVJW4SFUZHVMKO3P7VFRDANCNFSM4GMBMHCA .
Not working: buy_order() got an unexpected keyword argument 'stop_lose_price'
Il giorno mar 16 lug 2019 alle ore 11:09 ardemagni mattia < ardemagni.mattia@gmail.com> ha scritto:
Thank you!!
Il giorno mar 16 lug 2019 alle ore 06:33 Anson notifications@github.com ha scritto:
Nothing my friend? Il giorno mer 10 lug 2019 alle ore 17:50 ardemagni mattia < ardemagni.mattia@gmail.com> ha scritto: … <#m_5021003690527267350_m5113456737074033187> Thank you, really appreciate it! Il giorno mer 10 lug 2019 alle 15:45 Anson @.***> ha scritto: > I think it is very easy , I will add it > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <#65 https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/65?email_source=notifications&email_token=AKGLQ5EPFA4XJUKFNEUCHWTP6XRWFA5CNFSM4GMBMHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZTQEPY#issuecomment-510067263>,
or mute the thread > https://github.com/notifications/unsubscribe-auth/AKGLQ5DUWG4F32IQJH5PV7DP6XRWFANCNFSM4GMBMHCA . >
this code can get the close current price!
from iqoptionapi.stable_api import IQ_Option import time import random
I_want_money=IQ_Option("email","pasword")
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")
candle=I_want_money.get_realtime_candles(goal,size)
key=list(candle)[0]
current_price=candle[key]["close"] print("current_price",current_price)
duration=1#minute 1 or 5
amount=1
buy="call"#or "put"
I_want_money.subscribe_strike_list(goal)
get strike_list
data=I_want_money.get_realtime_strike_list(goal, duration)
get price list
price_list=list(data.keys())
close_current_price=[] for p_list in price_list:
close_current_price.append(abs(current_price-float(p_list)))
most_close_price=price_list[close_current_price.index(min(close_current_price))] print("most_close_price",most_close_price,"current_price",current_price) print(data[str(most_close_price)])
random choose Strategy
choose_price=most_close_price
get instrument_id
instrument_id=data[choose_price][buy]["id"]
get profit
profit=data[choose_price][buy]["profit"] print("choose you want to buy") print("price:",choose_price,"side:call","instrument_id:",instrument_id,"profit:",profit)
put instrument_id to buy
buy_check,id=I_want_money.buy_digital(amount,instrument_id) if buy_check:
print("wait for check win") #check win while True: check_close,win_money=I_want_money.check_win_digital(id) if check_close: if float(win_money)>0: win_money=("%.2f" % (win_money)) print("you win",win_money,"money") else: print("you loose") break I_want_money.unsubscribe_strike_list(buy)
else:
print("fail to buy,please run again,digit is change very fast so sometime if can not buy the price!,please try more time")
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/65?email_source=notifications&email_token=AKGLQ5FQ2XJRGKGEY33AAU3P7VFRDA5CNFSM4GMBMHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ7VG3A#issuecomment-511660908, or mute the thread https://github.com/notifications/unsubscribe-auth/AKGLQ5ARRVJW4SFUZHVMKO3P7VFRDANCNFSM4GMBMHCA .
@mattia177 What your api version? Try update
Ok I try and then will tell you, thanks
Il giorno mer 17 lug 2019 alle 00:29 Anson notifications@github.com ha scritto:
@mattia177 https://github.com/mattia177 What your api version? Try update
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/65?email_source=notifications&email_token=AKGLQ5CFECOKP46F2TUKCQDP7ZDUVA5CNFSM4GMBMHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2COMDI#issuecomment-512026125, or mute the thread https://github.com/notifications/unsubscribe-auth/AKGLQ5H52KHGW3OGCYP4IITP7ZDUVANCNFSM4GMBMHCA .
My friend, I just tried but it's not what I would need yet.
If you see the image I'm actually pasting, you will see that on digital option instrument you can chose between two options:
The nearest strike price (just like the code you sent me yesterday)
The strike price equal to the ACTUAL PRICE.
I would need to buy the option at the actual price, as you can see in the image where the flag is on the right option.
Do you think to be able to solve this issue?
@mattia177 You just want the api change mode?
The sample code can buy the actual price!
In the low level iqoption buy the Actual price
is working the same as my code.
2.buy the actual price near the candle
Hi guys, I just figured out. I got a list of all possible Quotes. Among them there was a code that was different. The usual code is like this: doEURUSD201907191250PT5MP11216 But one of them is like this: doEURUSD201907191250PT5MPSPT Look at the end: "SPT" (spot?)
I just tested and it worked. And we dont even need to get a list of all of the Quotes ans Strikes (unless you want to know the payout). We can make the code by hand like this: do => Always "do" EURUSD => Asset you want to buy (I dont know how it changes in OTC) 201907191250 => Current Year, Month, Day, Hour and Minute of expiration (GMT time) PT => Always "PT" - every time I tested it was PT, I dont know if it could change 5M => Candle Time P => Call or Put (in this case Put) SPT => Always "SPT"
@Lu-Yi-Hsun You can implement this by just creating a function that return this and we can use on buy_digital()!
For OTC you just need to put the name with -OTC (doEURUSD-OTC201907201150PT5MPSPT).
@Lu-Yi-Hsun https://github.com/Lu-Yi-Hsun Can you help us developing such function? I tried your previous code but it does not buy at the SPOT PRICE as the guys wrote couple of days ago. Thank you
Il giorno sab 20 lug 2019 alle ore 13:49 thiagottjv < notifications@github.com> ha scritto:
For OTC you just need to put the name with -OTC (doEURUSD-OTC 201907201150PT5MPSPT).
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Lu-Yi-Hsun/iqoptionapi/issues/65?email_source=notifications&email_token=AKGLQ5BX6LGVKG3NQ6QPQUDQAL3TJA5CNFSM4GMBMHCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2NMV5Y#issuecomment-513460983, or mute the thread https://github.com/notifications/unsubscribe-auth/AKGLQ5BVPS5IVJHMPUHXCLDQAL3TJANCNFSM4GMBMHCA .
@Lu-Yi-Hsun @mattia177 I'm not using the actual library, I`m developing in PHP, Phyton isnt my strong language. But the function will be something like this:
(on stable_api.py
)
def buy_digital_spot(self, amount, active, action, time, expiration):
#Expiration time need to be formatted like this: YYYYMMDDHHII
#And need to be on GMT time
dateFormated = expiration
#Type - P or C
if action == 'put':
action = 'P'
else:
action = 'C'
#doEURUSD201907191250PT5MPSPT
instrument_id = "do" + active + dateFormated + "PT" + time + "M" + action + "SPT"
return self.buy_digital(self, amount, instrument_id)
For the dateFormated
I think you can use the same function get_expiration_time
you use on buyv2.py
but you need to format it to GMT format, like I told on the comments.
On PHP there is an easy way, I don't know how to do it on py.
$date = new DateTime();
$date->setTimestamp($expTime);
$date->setTimezone(new DateTimeZone('GMT'));
$dateFormated = $date->format('YmdHi');
I hope it helps.
@Lu-Yi-Hsun
I was reading again your answer:
You just want the api change mode?
The sample code can buy the actual price!
In the low level iqoption buy the Actual price is working the same as my code.
Iqoption is check the real-time candle 2.buy the actual price near the candle
The issue is the same: you are right, it works and it buys the digital option near the actual price, but when you buy - on the platform - the asset with the ACTUAL PRICE MODE the payout is on a fixed level. I tried your code and often, not buying with actual price mode, the payout is lower when you buy the option. That's the real issue, I hope you understand what I mean.
Thank you
@Lu-Yi-Hsun
As the guys said in the previous messages, I tried to change a little part of your code and I put as "INSTRUMENT ID" = doEURUSD201907242130PT5MCSPT
In this way it works and it buys always at the ACTUAL PRICE.
Now the only thing you could do, if not a problem, is putting it into a function...and the last problem is that in the strike list there are the payouts for all the strikes, but not for the instrument id that finishes with "SPT" --> that means SPOT. How could you do to find that in your opinion?
Nothing mi friend?
@thiagottjv thank you ,I will check how to implement! And put your name on the code haha
@Lu-Yi-Hsun We trust in your ability to develop our request my friend :)
Does the code still work? I'm having trouble getting the current price
Not working , I am find what happen
Not working , I am find what happen
Thanks. You are good!
I am waiting for a solution for getting the actual price and a fixed profit as well. Tks for the great work.
@Lu-Yi-Hsun
As the guys said in the previous messages, I tried to change a little part of your code and I put as "INSTRUMENT ID" = doEURUSD201907242130PT5MCSPT
In this way it works and it buys always at the ACTUAL PRICE.
Now the only thing you could do, if not a problem, is putting it into a function...and the last problem is that in the strike list there are the payouts for all the strikes, but not for the instrument id that finishes with "SPT" --> that means SPOT. How could you do to find that in your opinion?
Not work?
thank@thiagottjv
@mattia177 @valderind4 @htnlabs fix and implement in the last version
Great job
thank@thiagottjv
Your welcome. Your code helped me a lot understanding how the api works. Thanks for that!
thank@thiagottjv
@mattia177 @valderind4 @htnlabs fix and implement in the last version
Thank You so much for your effort, but I am getting some return of "error" on using buy_digital_spot and when It works I am getting error on check_win_digital as you can see at the picture attached, maybe the problem is that you return digital_option_placed_id in the new code instead return order_id required to use on check_win_digital as before.
Is there another python def to check win for digital spot or I am doing something wrong?
@valderind4 thank ,i will check id problem
@valderind4 thank ,i will check id problem
thanks for your great job again. Below is more specifically the "error" returned when it try buying a digital spot sometimes:
Is It not possible to return the specific error message explaining the reason for not buying at that time?
PS: Please check that buy_order_id is always returning "None".
Hi my friend,
Could you please tell me (and write) a code where I can buy a digital option (for example EURUSD digital) where as buy price I have the actual price?
Now on IQ Option you can buy digitals both setting a specific price or with the actual price (with a fixed payout associated). I would be interested into this second way. Could you help me?
Thanks!