iqoptionapi
iqoptionapi copied to clipboard
Digital options buy with actual price
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!
@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 [email protected] 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 [email protected] 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 < [email protected]> ha scritto:
Thank you, really appreciate it!
Il giorno mer 10 lug 2019 alle 15:45 Anson [email protected] 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 < [email protected]> 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 [email protected] ha scritto:
Nothing my friend? Il giorno mer 10 lug 2019 alle ore 17:50 ardemagni mattia < [email protected]> ha scritto: … <#m_5113456737074033187_> 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 < [email protected]> ha scritto:
Thank you!!
Il giorno mar 16 lug 2019 alle ore 06:33 Anson [email protected] ha scritto:
Nothing my friend? Il giorno mer 10 lug 2019 alle ore 17:50 ardemagni mattia < [email protected]> ha scritto: … <#m_5021003690527267350_m_5113456737074033187_> 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 [email protected] 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.
- Iqoption is check the real-time candle
2.buy the actual price near the candle